Vous êtes sur la page 1sur 1

DATA SEGMENT

PROMPT DB 10,13,”ENTER ANY ASCII VALUE : $”


MSG DB 10,13,”PRINTING AL VALUE : $”

DATA ENDS

CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA ; initialize DS
MOV DS,AX

LEA DX,PROMPT ; load and print PROMPT


MOV AH,9
INT 21H

CALL DIVZERO

MOV AH,4CH
INT 21H
CODE ENDS

DIVZERO PROC NEAR

MOV AH,1 ; read a character


INT 21H
MOV BL,AL ; save the input character into BL

CMP BL, 30H ; compare input digit and 0

JZ EXIT ; jump to label EXIT if digit=0

LEA DX,MSG
MOV AH,9
INT 21H

MOV DL,BL
MOV AH,2
INT 21H

EXIT:
MOV AH,04CH
INT 21H

RET
DIVZERO ENDP
END START