ALP to demonstrate even or odd number using procedure

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 ; al has the number

call evenodd

MOV AH,4CH
INT 21H
evenodd proc near
 MOV BL,02H
 DIV BL
CMP AH,00H
JNE E
LEA DX,STR2
MOV AH,09H
INT 21H
        JMP O

  E:
LEA DX,STR3
MOV AH,09H
  INT 21H
  O:
   ret
evenodd endp
 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