ALP to check if the given number is even or odd

ASSUME CS:CODE,DS:DATA
DATA SEGMENT
STR1 DB "ENTER NUMBER:$"
STR2 DB 0AH,"NUMBER IS EVEN$"
STR3 DB 0AH,"NUMBER IS ODD$"
DATA ENDS
CODE SEGMENT
START:
MOV AX,DATA
MOV DS,AX
LEA DX,STR1
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H
SUB AL,30H
 MOV BL,02H
 DIV BL
CMP AH,00H
JNE E
LEA DX,STR2
        JMP O
  E:
LEA DX,STR3
  O:
  MOV AH,09H
  INT 21H
MOV AH,4CH
INT 21H
 CODE ENDS
END START

Comments

Popular posts from this blog

ALP to demonstrate shift operations

ALP to transfer a block of data from one location to another

Fibonacci series to display first 5 terms