Hello Guys
I want to make an assembly program that get 2 inputs and compare between them if equal or not and if not I want to say which number is the maximum and which one is the minimum

I did the Equal part , I need help with the maximum and minimum part, I cant get its Idea year im still a nOOb with assembly

Best Regards

.MODEL SMALL
.DATA
                V3 DB   'EQUAL$'
                V4 DB   'NOTEQAUL$'
.CODE
MAIN    PROC 
        MOV  AX,@DATA
        MOV  DS,AX 
        MOV  AH,01H
        INT  21H
        MOV  DL,AL   
        INT 21H     
        CMP AL,DL
        JNE NOEQUAL
        MOV AH,09H
        LEA DX,V3
        INT 21H
        JMP BYE
NOEQUAL:
 
        MOV AH,09H
        LEA DX,V4       ; LOAD EFECTIVE ADDRESS OF V4 IN DX
        INT 21H
BYE:
        MOV AH,4CH
        INT 21H
MAIN    ENDP
        END  MAIN

Since you need to differentiate between min and max, I suggest you use something else instead of JNE.

Suppose you want the max to be in AL, and min in DL then:

...
CMP AL,DL
JG notequal  ; max is in AL, nothing should be done
JE equal     ; jump to equal part
XCHG AL,DL   ; since the only possibility left is that AL<DL, they are exchanged
jmp notequal ; now you can jump to notequal
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.