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

📄 ex7_3.asm

📁 x86汇编程序。 从键盘输入一个字符串,先把它原样显示一遍 然后将其中的小写字母转换为大写显示,再将其中的大写字母转换为小写显示,最后将其中的大小写字母互换显示.显示字符串的功能调用采用宏,大写转换
💻 ASM
字号:
;The first method

.model small

dis_str macro x
    lea dx, x
    mov ah, 09h
    int 21h
endm
.data
    
    prompt db 'Please enter the string:', '$'
    ;the initial value is set to '$', so as to display string
    in_str db 100, ?, 100 DUP('$')  
    temp_str db 100 DUP('$')
    result1 db 'The initial string:', '$'
    result2 db 'The lowercase string:', '$'
    result3 db 'The uppercase string:', '$'
    result4 db 'The mutual exchanged string:', '$'

.code  
    public in_str, temp_str
    extern upper_to_lower:near, lower_to_upper:near, mutual_convert:near 
.startup
		
    mov ax, @data
    mov ds, ax
    
    dis_str prompt   ;显示提示信息
    
    call input       ;调用输入字符串函数
    call crlf 
    call crlf 
    
    dis_str result1     ;显示原始字符串
    dis_str in_str+2 
    call crlf 
    call crlf 
    
    call upper_to_lower ;调用把大写字母转换为小写字母的函数
    
    dis_str result2     ;显示转换结果
    dis_str temp_str
    call crlf  
    call crlf 
    
    call lower_to_upper ;调用把小写字母转换为大写字母的函数
    
    dis_str result3     ;显示转换结果
    dis_str temp_str
    call crlf 
    call crlf  
    
    call mutual_convert ;调用把小写字母转换为大写字母的函数
    
    dis_str result4    ;显示转换结果
    dis_str temp_str
    call crlf
    call crlf   
    
    .exit 0


;------------------------------------
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  
;------------------------------------------- 

    end 

⌨️ 快捷键说明

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