.model small
.stack 100h
cr equ 13d
lf equ 10d
.data
msg1 db'enter valid digit 0-9: ','$'
wrong_msg db cr, lf,'invalid:','$'
right_msg db cr, lf,'valid:','$'
.code
start:
mov ax,@data
mov ds,ax
mov dx, offset msg1
call put_string
call get_char
mov bl, al
cmp bl, '0'
jl jeff
cmp bl, '9'
jg jeff
mov dx, offset right_msg
call put_string
call exit
jeff:
mov dx, offset wrong_msg
call put_string
exit:
mov ax, 4c00h
int 21h
put_string:
mov ah, 9h
int 21h
ret
get_char:
mov ah, 1h
int 21h
ret
end start
No comments:
Post a Comment