⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 宏汇编字符串处理.txt

📁 字符串处理 从键盘输入不超过20个字符的字符串
💻 TXT
字号:
include   C:\Documents and Settings\陈永\桌面\汇编课程设计\字符串\macro.mac
	
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 
    
   shuchu 1
   shuchu 2
   shuchu 3
   shuchu 4
   
    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 + -