Code
data segment
string db 'My name is Lin Yan Miao' ;待输出的字符串
cnt equ $ - offset string ;取字符串长度
data ends
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
mov cx,cnt ;循环次数为字符串长度
mov si,offset string ;取string的首地址
next:
mov al,[si] ;循环比较字符串,若有小写字母则进行处理
cmp al,'a'
jb change ;非小写字母则跳转
sub al,32 ;减去32,大小写字母相差32
change:
mov dl,al
mov ah,02h
int 21h
inc si
loop next
mov ah,4ch
int 21h
code ends
end start