汇编语言(王爽)——实验十一 编写子程序

1、原题目

汇编语言(王爽)——实验十一 编写子程序_第1张图片

 

2、个人代码

assume cs:codesg

datasg segment
db "Beginner's All-purpose Symbolic Instruction Code.",0
datasg ends

codesg segment
begin:
mov ax,datasg
mov ds,ax
mov si,0
call letterc

mov ax,4c00h
int 21h

letterc:
push ax
push ds
push si;压栈保存数据
s:
mov al,[si];第si个字节(从0开始)
cmp al,0;改变ZF标志位
je ok;第si个字节为0时字符串结束
cmp al,97
jb s0
cmp al,122
ja s0;不再97-122之中(不是小写字母)跳到s0
;是小写字母的转成大写字母
and al,11011111B;置第5位为0转成大写也可以减去20h
mov [si],al;将大写字母存到原位置
s0:
inc si
loop s
 
ok:
pop si
pop ds
pop ax
ret

codesg ends
end begin

3、结果

 

汇编语言(王爽)——实验十一 编写子程序_第2张图片

你可能感兴趣的:(汇编语言)