The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: josefalarka on January 22, 2011, 10:22:35 AM

Title: Help for these instructions.
Post by: josefalarka on January 22, 2011, 10:22:35 AM
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. 
Title: Re: Help for these instructions.
Post by: dedndave on January 22, 2011, 01:16:47 PM
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
Title: Re: Help for these instructions.
Post by: redskull on January 22, 2011, 03:46:18 PM
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?
Title: Re: Help for these instructions.
Post by: josefalarka on January 23, 2011, 12:24:09 AM
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.
Title: Re: Help for these instructions.
Post by: josefalarka on January 23, 2011, 12:26:17 AM
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.