Answer to Question #285126 in Assembler for Zeck

Question #285126

if 

   ((ax>bx && (bx < cx or ax<ax))

    Var1=3

    else

    Ax=Var3


write code in assembly code


1
Expert's answer
2022-01-06T08:51:52-0500
DATA SEGMENT
a    DW 1  
b    DW 5
c    DW 3

VAR1 DW 0
VAR3 DW 7

DATA ENDS

code segment
start:
; set segment registers:
    mov ax, data
    mov ds, ax
    MOV ES,AX    

    mov ax, a    
    mov bx, b    
    mov cx, c    
    
    CMP AX,BX   ; AX > BX ?
    JLE L_ELSE   ; AX <= BX
    
    CMP BX,CX
    JL L_IF
    
    CMP AX,CX
    JL L_IF
    

 L_ELSE:
    MOV AX,VAR3
    JMP _QUIT
     
L_IF:
     MOV VAR1,3
    
_QUIT:
    MOV AH,1            ; Waiting for a key press
    INT 16H
    
    mov ah, 4ch
    int 21h        ; exit

end start

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS