📄 2-3.asm
字号:
data segment
inpu db 'please input:$'
output db 'the rusult is:$'
ct1 db 'letter:$'
ct2 db 'digit:$'
ct3 db 'other:$'
letter dw ?
digit dw ?
other dw ?
data ends
code segment
assume cs:code,ds:data
;--------------------------------
main proc far
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
lea dx,inpu
mov ah,09h
int 21h
sub bx,bx
mov letter,bx
mov digit,bx
mov other,bx
input:
mov ah,01h
int 21h
cmp al,0dh
jz over
cmp al,30h
jb oth
cmp al,3ah
jb dig
cmp al,41h
jb oth
cmp al,5ah
jb let
cmp al,61h
jb oth
cmp al,7ah
jb let
jmp oth
jmp input
oth:
mov bx,other
inc bx
mov other,bx
jmp input
let:
mov bx,letter
inc bx
mov letter,bx
jmp input
dig:
mov bx,digit
inc bx
mov digit,bx
jmp input
over:
call crlf
lea dx,output
mov ah,09h
int 21h
call crlf
lea dx,ct1
mov ah,09h
int 21h
mov dx,letter
add dx,30h
mov ah,02h
int 21h
call crlf
lea dx,ct2
mov ah,09h
int 21h
mov dx,digit
add dx,30h
mov ah,02h
int 21h
call crlf
lea dx,ct3
mov ah,09h
int 21h
mov dx,other
add dx,30h
mov ah,02h
int 21h
mov ah,4ch
int 21h
ret
main endp
CRLF PROC NEAR
MOV DL,0DH
MOV AH,2
INT 21H
MOV DL,0AH
INT 21H
RET
CRLF ENDP
;---------------
CODE ENDS
END START
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -