using 8086 microprocessor
oding] Convert the following C++ code into assembly if ((AX 3) II (Bx > 0)) AX=CX2 else Show transcribed image text oding] Convert the following C++ code into assembly if ((AX 3) II (Bx > 0)) AX=CX2 else
Solution
DATA SEGMENT
ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX
LOOP:
CMP AX,3
JG IF
JLE ELSE
CMP BX,0
JG IF
JLE ELSE
IF:
MUL CX,CX
MOV AX,CX
GOTO LOOP
ELSE:
MOV DX,CX
MUL CX,CX
SUB CX,DX
ADD CX,1
GOTO LOOP
MOV AH,4CH
INT 21H
ENDS
END START
Hope this helps you 🙂