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

📄 subp2.asm

📁 x86汇编程序。 从键盘输入一个字符串,先把它原样显示一遍 然后将其中的小写字母转换为大写显示,再将其中的大写字母转换为小写显示,最后将其中的大小写字母互换显示.显示字符串的功能调用采用宏,大写转换
💻 ASM
字号:
;------------------------------------
input proc near
          
    push dx
    push ax
    
    lea dx, in_str
    mov ah, 0ah
    int 21h  
    
    pop ax
    pop dx
    
    ret   
              
input endp 

;------------------------------------------  
;换行
crlf proc near
    push dx
    push ax
    
    mov ah, 02h
    mov dl, 0dh
    int 21h
    
    mov ah, 02h
    mov dl, 0ah
    int 21h
    
    pop ax
    pop dx
    
    ret
crlf endp  
;------------------------------------------- 
upper_to_lower proc near
    push cx
    push si
    push bx

    ;set the counter
    mov cl, in_str + 1
    mov ch, 0
    
    mov si, 2
    
again1:
    
    ;只要处理A--Z的字符
    mov bl, in_str[si]
    cmp bl, 'A'  
    jb continue1
    cmp bl, 'Z'
    jb to_lower1
    jmp continue1
    
to_lower1:
    add bl, 20h
    
continue1:
    mov temp_str[si - 2], bl
    inc si
    loop again1
    
    pop bx
    pop si
    pop cx
    
    ret 
    
upper_to_lower endp
;----------------------------------
lower_to_upper proc near
    push cx
    push si
    push bx

    ;set the counter
    mov cl, in_str + 1
    mov ch, 0
    
    mov si, 2
    
again2:
    
    ;只要处理a--z的字符
    mov bl, in_str[si]
    cmp bl, 'a'  
    jb continue2
    cmp bl, 'z'
    jb to_upper2
    jmp continue2
    
to_upper2:
    sub bl, 20h
    
continue2:
    mov temp_str[si - 2], bl
    inc si
    loop again2
    
    pop bx
    pop si
    pop cx
    
    ret 
    
lower_to_upper endp 
;----------------------------------
mutual_convert proc near
    push cx
    push si
    push bx

    ;set the counter
    mov cl, in_str + 1
    mov ch, 0
    
    mov si, 2
    
again3:
    mov bl, in_str[si]
    cmp bl, 'A'  
    jb continue3
    cmp bl, 'Z'
    jb to_lower3
    cmp bl, 'a'
    jb continue3
    cmp bl, 'z'
    jb to_upper3
    jmp continue3 
    
to_lower3:
    add bl, 20h
    jmp continue3
    
to_upper3:
    sub bl, 20h
    
continue3:
    mov temp_str[si - 2], bl
    inc si
    loop again3
    
    pop bx
    pop si
    pop cx
    
    ret 
    
mutual_convert endp

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -