;编程,将data段的每个单词的前四个字母改写为大写。
assume cs:code
stack segment
dw 10 dup(10)
stack ends
data segment
db '1. display '
db '2. brows '
db '3. replace '
db '4. modify '
data ends
code segment
start: mov ax,stack
mov ss,ax
mov sp,20 ;初始化栈顶指针
mov ax,data
mov ds,ax ;初始化数据段段地址
mov bx,0 ;初始化偏移地址
mov cx,4 ;外层循环4次
s1: push cx
mov cx,4 ;内存循环4次
mov di,3
s2: mov al,[bx+di]
and al,11011111B ;转成大写
mov [bx+di],al ;写入内存
inc di
loop s2
add bx,16 ;处理下一行
pop cx ;出栈外层循环次数
loop s1
mov ax,4c00h
int 21h
code ends
end start
结果如下所示:
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有