News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

is there a way to convert db to dd?

Started by elmo, October 23, 2010, 04:50:26 AM

Previous topic - Next topic

elmo

   ;DWORD=DATA WORD
   ;DD=DATA DOUBLEWORD (DEFINE DOUBLEWORD)
   ;DB=DEFINE BYTE
   ;DW=DEFINE WORD
   ;DQ=DEFINE QUADWORD


I declare:
   hButton1            dd ?
   h               db 32 dup(?)


is there any way to convert db to dd?
So, if I do:
      invoke SetWindowText,hButton1,ADDR Caption
will give the same result with:
      invoke SetWindowText,h,ADDR Caption
where h contain the value of hButton1( after converted to dd).

I had try CWD (convert Word to double word) that return value in dx. But it still fail.
      CWD
      invoke SetWindowText,dx,ADDR Caption

http://www.masm32.com/board/index.php?PHPSESSID=45161102b7e9b36e503418a4d40f36ce&topic=3501.0
http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/ProgrammersGuide/Chap_04.htm

Don't multiple post in this forum.
be the king of accounting programmer world!

dedndave

        mov     al,ByteVal
        cbw     ;extend into AX
        cwde    ;extend into EAX

vanjast


dedndave

oh - i forgot to mention the obvious ones, too   :bg
        movsx   eax,byte ptr ByteVal
or
        movsx   eax,al
those instructions sign-extend the byte into EAX

if you want to zero-extend it...
        movzx   eax,byte ptr ByteVal
or
        movzx   eax,al