实验11
assume cs:codedata segment
db 'Welcome to c32!', 0;为了方便在debug中显示
data ends
code segment
start:
mov ax, data
mov ds, ax
mov si, 0FFFFH ;si设置为-1
call letterrc
mov ax, 4C00H
int 21H
letterrc:
inc si
mov ch, 0
mov cl,
jcxz ok
;如果ASCII码范围不再97~122(a~z)内则跳转
cmp cl, 97
jb letterrc
cmp cl, 122
ja letterrc
and byte ptr , 11011111B ;减32变成大写
jmp short letterrc
ok: ret
code ends
end start
;欢迎指正! assume cs:code , ds:code
stack segment stack para 'stack'
dw 400h dup(00)
stack ends
code segment para public 'code'
str db 'Welcome to c32!' , 0
upcase proc near
push bp
mov bp,sp
push bx
mov bx,word ptr
u1:cmp byte ptr,0
jz u3
cmp byte ptr,'a'
jb u2
cmp byte ptr,'z'
ja u2
sub byte ptr,20h
u2:inc bx
jmp short u1
u3:pop bx
mov sp,bp
pop bp
ret 02h
upcase endp
start proc far
push cs
pop ds
mov ax, offset str
push ax
call upcase
mov ax, 4c00h
int 21H
start endp
code ends
end start
页:
[1]