📄 字符串.txt
字号:
datas segment
string db 20,?,20 dup(?)
input db 0ah,0dh,'Please input one string:$'
output1 db 0ah,0dh,' the number of others is:$'
output2 db 0ah,0dh,' the number of datas is:$'
output3 db 0ah,0dh,' the number of words is:$'
output4 db 0ah,0dh,' the number of chars is:$'
output db 0ah,0dh,'Output the right string:$'
count1 db 0
count2 db 0
count3 db 0
count4 db -1
count db 0
crlf db 0ah,0dh,'$'
datas ends
code segment
main proc far
assume cs:code,ds:datas
start:
push ds
sub ax,ax
push ax
mov ax,datas
mov ds,ax
lea dx,input
mov ah,9
int 21h
lea si,string+2
mov cx,20
inputs:
inc count4
mov ah,01h
int 21h
cmp al,0dh
jz display
cmp al,30h
jl jishu1
cmp al,39h
jg jishu2
jmp jishu4
jishu1:
inc count1
jmp next
jishu2:
cmp al,41h
jl jishu1
cmp al,5ah
jg jishu3
jmp jishu
jishu3:
cmp al,61h
jl jishu1
cmp al,7bh
jg jishu1
jmp jishu
jishu4:
inc count2
mov string[si],al
inc si
inc count
jmp next
jishu:
inc count3
mov string[si],al
inc si
inc count
next:
inc di
loop inputs
display:
lea dx,crlf
mov ah,09h
int 21h
lea dx,output1
mov ah,09h
int 21h
add count1,30h
cmp count1,3ah
jl display1
mov dl,31h
mov ah,02h
int 21h
sub count1,0ah
display1:
mov dl,count1
mov ah,02h
int 21h
lea dx,output2
mov ah,09h
int 21h
add count2,30h
cmp count2,3ah
jl display2
mov dl,31h
mov ah,02h
int 21h
sub count2,0ah
display2:
mov dl,count2
mov ah,02h
int 21h
lea dx,output3
mov ah,09h
int 21h
add count3,30h
cmp count3,3ah
jl display3
mov dl,31h
mov ah,02h
int 21h
sub count3,0ah
display3:
mov dl,count3
mov ah,02h
int 21h
lea dx,output4
mov ah,09h
int 21h
add count4,30h
cmp count4,3ah
jl display4
mov dl,31h
mov ah,02h
int 21h
sub count4,0ah
display4:
mov dl,count4
mov ah,02h
int 21h
lea dx,crlf
mov ah,09h
int 21h
lea dx,output
mov ah,09h
int 21h
mov cl,count
mov ch,0
lea di,string+2
print:
mov dl,string[di]
mov ah,02h
int 21h
inc di
loop print
ret
main endp
code ends
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -