News:

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

Help for these instructions.

Started by josefalarka, January 22, 2011, 10:22:35 AM

Previous topic - Next topic

josefalarka

What will be the result of these instructions.
Assume that BYTE1 is defined as DB 05.             

                                                   BEFORE
a.)   MOV CX, 25H         ;CX = 0000H      
b.)   MOV CL, 0                 ;CX = FFFFH      
c.)   MOV AX, BYTE1         ;AX = 1234H      
d.)   ADD DL, BYTE1         ;DX = 0120H      
e.)   INC DX            ;DX = FFFFH      
f.)   INC DL            ;DX = FFFFH      
g.)   XCHG AH,AL         ;AX = 1234H      
h.)   SUB CX,CX                 ;CX = 1234H      
i.)   XCHG CX, CX              ;CX = 1234H      

I got these from my cousin's notebook in his class in assembly 2 years ago, and I can't figure it out the final result. 

dedndave

a.)   MOV CX, 25H         ;CX = 0000H     
CX = 0025h

b.)   MOV CL, 0                 ;CX = FFFFH     
CX = 0FF00h

c.)   MOV AX, BYTE1         ;AX = 1234H     
we do not know what BYTE1 is, but you can't add a byte operand to a word register

d.)   ADD DL, BYTE1         ;DX = 0120H     
we do not know what BYTE1 is

e.)   INC DX            ;DX = FFFFH 
DX = 0000   

f.)   INC DL            ;DX = FFFFH     
DX = 0FF00h

g.)   XCHG AH,AL         ;AX = 1234H     
AX = 3412h

h.)   SUB CX,CX                 ;CX = 1234H     
CX = 0000

i.)   XCHG CX, CX              ;CX = 1234H
CX = 1234h

redskull

Quote from: j053f on January 22, 2011, 10:22:35 AM
I got these from my cousin's notebook in his class in assembly 2 years ago, and I can't figure it out the final result. 

:cheekygreen:

Why not type them into DEBUG and watch what happens?
Strange women, lying in ponds, distributing swords, is no basis for a system of government

josefalarka

To dedndave, thank you very much for your help.  I hope I can still ask your help if you don't mind. God bless you.

josefalarka

To redskull, thank you very much for your help, I did not know that these the result of these instructions can be viewed in debug command.  Now I know, thank you once again.