What would be in registers ax, ah and al after these commands:

MOV AX, 1010
MOV AH, 5
ADD AL, 5

I understand that ax contains ah and al but I don't know the answer of this question

Recommended Answers

All 3 Replies

You can type in the code using DEBUG at the DOS command-line and step through each command and watch the registers.

C:\science>debug
-a
1424:0100 mov ax, 1010
1424:0103 mov ah, 5
1424:0105 add al, 5
1424:0107
-r
AX=0000  BX=0000  CX=0000  DX=0000  SP=FFEE  BP=0000  SI=0000  DI=0000
DS=1424  ES=1424  SS=1424  CS=1424  IP=0100   NV UP EI PL NZ NA PO NC
1424:0100 B81010        MOV     AX,1010
-p

AX=1010  BX=0000  CX=0000  DX=0000  SP=FFEE  BP=0000  SI=0000  DI=0000
DS=1424  ES=1424  SS=1424  CS=1424  IP=0103   NV UP EI PL NZ NA PO NC
1424:0103 B405          MOV     AH,05
-p

AX=0510  BX=0000  CX=0000  DX=0000  SP=FFEE  BP=0000  SI=0000  DI=0000
DS=1424  ES=1424  SS=1424  CS=1424  IP=0105   NV UP EI PL NZ NA PO NC
1424:0105 0405          ADD     AL,05
-p

AX=0515  BX=0000  CX=0000  DX=0000  SP=FFEE  BP=0000  SI=0000  DI=0000
DS=1424  ES=1424  SS=1424  CS=1424  IP=0107   NV UP EI PL NZ NA PO NC
1424:0107 0000          ADD     [BX+SI],AL                         DS:0000=CD
-q
C:\science>

So, you can see that the AX register contains 0515
AH=05 AL=15

Thank you :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.