第二次的实验
atarea segmentmaxlen db 80
actlen db ?
string db 80 dup(?)
case db 'input:$'
case1 db 0ah,0dh,'letter:$'
case2 db 0ah,0dh,'digit:$'
case3 db 0ah,0dh,'other:$'
letter dw ?
digit dw ?
other dw ?
datarea ends
prognam segment
main proc far
assume cs:prognam,ds:datarea
start:
push ds
sub ax,ax
push ax
mov ax,datarea
mov ds,ax
mov dx,offset case
mov ah,09h
int 21h
mov dx,offset maxlen
mov ah,0ah
int 21h
mov di,offset string
mov letter,0
mov digit,0
mov other,0
loop2:
mov al,[di]
cmp al,0dh
jz exit
cmp al,30h
jl next3
cmp al,3ah
jl next2
cmp al,41h
jl next3
cmp al,5bh
jl next1
cmp al,61h
jl next3
cmp al,7bh
jl next1
jmp next3
next1:
inc letter
jmp loop1
next2:
inc digit
jmp loop1
next3:
inc other
jmp loop1
loop1:
inc di
jmp loop2
exit:
mov dx,offset case1
mov ah,09h
int 21h
mov bx,letter
call show_msg
mov dx,offset case2
mov ah,09h
int 21h
mov bx,digit
call show_msg
mov dx,offset case3
mov ah,09h
int 21h
mov bx,other
call show_msg
ret
main endp
show_msg proc near
mov ch,4
rotate:
mov cl,4
rol bx,cl
mov al,bl
and al,0fh
add al,30h
cmp al,3ah
jl printit
add al,7h
printit:
mov dl,al
mov ah,2
int 21h
dec ch
jnz rotate
ret
show_msg endp
prognam ends
end start