标签:
dseg segment str_source db "HelloWorld$" str1 db 20 dup(0) str2 db 20 dup(0) int_caption db 0 int_lower db 0 dseg ends cseg segment ;设置代码段 assume cs:cseg,ds:dseg start: mov ax , dseg ;初始化ds mov ds , ax mov si , offset str_source ;offset str_source-->si 变址 xor ax , ax push ax push ax ;str1,str2指针入栈 read_loop: mov al , [si] ;取[si]中的内容,即偏移量 cmp al , ‘$‘ je exit cmp al , ‘Z‘ ja lower_case pop di ;大写 mov al , [si] mov [di] , al inc di push di inc int_caption inc si jmp read_loop lower_case: ;小写 inc int_lower inc si jmp read_loop exit: mov dl , int_caption add dl , 30h mov ah , 02h int 21h mov dl , 0ah ;回车换行 mov ah , 02h int 21h mov dl , 0dh mov ah , 02h int 21h mov dl , int_lower add dl , 30h mov ah , 02h int 21h mov dl , 0ah ;回车换行 mov ah , 02h int 21h mov dl , 0dh mov ah , 02h int 21h pop di mov al ,‘$‘ mov [di] , al mov dl , offset str1 mov ah , 09h int 21h mov ax , 4c00h ;返回DOS int 21h cseg ends ;代码段结束 end start ;汇编语言源程序结束
标签:
原文地址:http://www.cnblogs.com/Karma-wjc/p/4184809.html