Tuesday, August 17, 2010

Numbers only

;This program accepts only numbers. Press enter to quit.


stak segment para stack 'stack'
db 100 dup (0)
stak ends

dta segment
msg1 db "Enter a number: $"
dta ends

kod segment
main proc

assume ss:stak, ds:dta, cs:kod

mov ax,dta
mov ds,ax
mov ah,09
mov dx,offset msg1
int 21h

start: mov ah,07
int 21h

cmp al,0dh
je exit

cmp al,30h
jb start

cmp al,39h
ja start


disp: mov ah,02
mov dl,al
int 21h
jmp start

exit: mov ax,4c00h
int 21h

main endp
kod ends
end main

No comments:

Post a Comment