The MASM Forum Archive 2004 to 2012
Welcome, Guest. Please login or register.
November 01, 2014, 01:43:13 PM

Login with username, password and session length
Search:     Advanced search
128553 Posts in 15254 Topics by 684 Members
Latest Member: mottt
* Home Help Search Login Register
+  The MASM Forum Archive 2004 to 2012
|-+  Miscellaneous Forums
| |-+  16 bit DOS Programming
| | |-+  Help for these instructions.
« previous next »
Pages: [1] Print
Author Topic: Help for these instructions.  (Read 1246 times)
josefalarka
Guest


Email
Help for these instructions.
« 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. 
Logged
dedndave
Member
*****
Posts: 12523


Re: Help for these instructions.
« Reply #1 on: January 22, 2011, 01:16:47 PM »

Code:
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
Logged
redskull
Member
*****
Gender: Male
Posts: 837


It rubs the lotion on its skin...


Re: Help for these instructions.
« Reply #2 on: January 22, 2011, 03:46:18 PM »

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?
Logged

Strange women, lying in ponds, distributing swords, is no basis for a system of government
josefalarka
Guest


Email
Re: Help for these instructions.
« Reply #3 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.
Logged
josefalarka
Guest


Email
Re: Help for these instructions.
« Reply #4 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.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP The MASM Forum Archive 2004 to 2012 | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!