start:
MOV AH,08 ; Function to read char from keyboard
INT 21h ; and save it to AL
CMP AL,65 ; Compare what valu in AL to "A"
JNZ output ; if not same (not zero), please jump and
; skip middle. If zero, please run code normally
middle:
MOV AH,02 ; Function to output char
MOV DL,"R" ; Char to output
INT 21h
output:
MOV AH,02 ; Function to output char
MOV DL,"T" ; Char to output
INT 21h
exit:
MOV AH,4Ch ; Exit function
MOV AL,00 ; Return 0
INT 21h
If you type "A", it means that the comparison is same, and the command is JUMP IF NOT EQUAL, so the result is that the code will executed normally:
output> RT
But if you type other than "A", it means that the comparison result is not equal to zero (not same), and the command is JUMP IF NOT EQUAL, so the result is that the program will jump to output and skip middle label:output> T
AWESOME
ReplyDeleteQuite helpful.
ReplyDelete