汇编语言课程实验一

实验一,编写汇编程序,验证从键盘输入的是否为一合法的整数

assume cs:code,ds:data
data segment
	show db "Input a charactor ",0dh,0ah,"$"
	msg  db " is a number",13,10,"$"
	msg2 db " is not a number$"
data ends

code segment
start:
	mov ax,data
	mov ds,ax

	lea dx,show
	mov ah,9
	int 21h

	mov ah,1
	int 21h
	
	cmp al,'0'
	jb no
	cmp al,'9'
	ja no

yes:	lea dx,msg
	mov ah,9
	int 21h
	jmp exit

no:	lea dx,msg2
	mov ah,9
	int 21h
exit:	mov ax,4c00h
	int 21h

code ends
end start


 

你可能感兴趣的:(汇编语言)