资源描述
1.实验要求
程序接收用户键入的一行字符(字符个数不超过80个,该字符串用回车符结束),并按字母、数字及其它字符分类计数,然后将结果存入以letter、digit和other为名的存储单元中。
(1)程序可0AH功能调用把键入字符直接送到缓冲区中,然后再逐个取出分类计数。也可01H功能调用在接收字符后先分类计数再存入缓冲区中。
(2)程序需要进入debug运行并查看计数结果。
2. 实验代码
datarea segment
letter db ?
digit db ?
other db ?
datarea ends
;------------------------------
prognam segment
main proc far
assume cs:prognam,ds:datarea
start:
push ds
sub ax,ax
push ax
mov letter,al
mov digit,al
mov other,al
inloop:
mov ah,1
int 21h
cmp al,0dh
je exit
cmp al,30h
jb charinc
cmp al,3Ah
jb digitinc
cmp al,41h
jb charinc
cmp al,5bh
jb letterinc
cmp al,61h
jb charinc
cmp al,7bh
jb letterinc
charinc:
inc other
jmp inloop
digitinc:
inc digit
jmp inloop
letterinc:
inc letter
jmp inloop
exit:
ret
main endp
prognam ends
end start
展开阅读全文