MOV AL, 10 ; Initialize NUM1 to 10
MOV AH, 0 ; Initialize NUM2 to 0
WHILE_LOOP:
CMP AL, AH ; Compare NUM1 and NUM2
JE EXIT_LOOP ; If NUM1 is equal to NUM2, exit the loop
DEC AL ; Decrement NUM1 by 1
INC AH ; Increment NUM2 by 1
ADD BL, AL ; Add NUM1 and NUM2 and store the result in NUM3
JMP WHILE_LOOP ; Jump back to WHILE_LOOP
EXIT_LOOP:
; NUM1 equals NUM2, exit the loop
; Your code after the loop ends
Consider the following high-level program:
Uint_8 NUM1 = 10, NUM2 = 0, NUM3;
While (NUM1 != NUM2)
{
NUM1 --;
NUM2 ++;
NUM3 = NUM1 +NUM2;
}
Convert the above code into 8086 assembly code.
1 answer