assume cs:codesg
data segment
db "Beginner's All-puroise Symbolic Instruction Code.", 0
data ends
codesg segment
start: mov ax, data
mov ds, ax
mov si, 0
call letterc
mov ax, 4c00H
int 21H
letterc:
sub ax, ax ;清一下标志寄存器 可以不用
s:cmp byte ptr [si], 0 ;字符串以零为结束标记 用一次比较来判断字符结尾
je endletterc
cmp byte ptr [si], 'a' ;判断是否在a-z范围 如果不在 则跳到下一个字符
jb next ;bellow 'a'则跳过
cmp byte ptr [si], 'z'
ja next ;above 'z'则跳过
mov al, [si]
and al, 11011111b ;小写变大写
mov [si], al
next:inc si
jmp s
endletterc: ret
codesg ends
end start