源码:
data segment
string1 db 'Please input a number:',0dh,0ah,'$'
string2 db 0dh,0ah,'It is a number!',0dh,0ah,'$'
string3 db 0dh,0ah,'It is not a number!',0dh,0ah,'$'
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
TIP:
lea dx,string1
mov ah,09h
int 21h
mov ah,01h
int 21h
cmp al,30h
jnc GOON
lea dx,string3
mov ah,09h
int 21h
jmp TIP
GOON:
cmp al,3ah
jnc DONE
lea dx,string2
mov ah,09h
int 21h
jmp EXIT
DONE:
lea dx,string3
mov ah,09h
int 21h
jmp TIP
EXIT:
mov ah,4ch
int 21h
code ends
end start
运行截图: