x86汇编学习 ----- 五
;将data段中的每个单词的每个字母改成大写字母
;2011-9-27 YoungWei
assume cs:code,ds:data
data segment
db 'ibm '
db 'dec '
db 'dos '
db 'vax '
data ends
code segment
start: mov ax,data
mov ds,ax ;将data段和数据段相关联
mov cx,4 ;要处理4个单词,外层循环数
mov si,0 ;每次循环指向每个单词的首个字母
S0: mov dx,cx ;将外层循环次数用dx保存起来,让cx接受内循环的次数,因为先进行内层循环
mov cx,3
mov bx,0 ;索引单词的每个字母
S1: mov al,[bx+si]
and al,11011111B
mov [bx+si],al
inc bx
loop S1
mov cx,dx
add si,10h
loop S0
mov ax,4c00h
int 21h
code ends
end start
程序刚载入是查看数据
E:\SOURCE~1\Assemble\Masm615>debug code77.exe
-r
AX=0000 BX=0000 CX=0068 DX=0000 SP=0000 BP=0000 SI=0000 DI=0000
DS=141F ES=141F SS=142F CS=1433 IP=0000 NV UP EI PL NZ NA PO NC
1433:0000 B82F14 MOV AX,142F
-d 142f:0
142F:0000 69 62 6D 20 20 20 20 20-20 20 20 20 20 20 20 20 ibm
142F:0010 64 65 63 20 20 20 20 20-20 20 20 20 20 20 20 20 dec
142F:0020 64 6F 73 20 20 20 20 20-20 20 20 20 20 20 20 20 dos
142F:0030 76 61 78 20 20 20 20 20-20 20 20 20 20 20 20 20 vax
142F:0040 B8 2F 14 8E D8 B9 04 00-BE 00 00 8B D1 B9 03 00 ./..............
142F:0050 BB 00 00 8A 00 24 DF 88-00 43 E2 F7 8B CA 83 C6 .....$...C......
142F:0060 10 E2 E8 B8 00 4C CD 21-00 00 00 00 00 00 00 00 .....L.!........
142F:0070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
执行完程序后查看数据
-d 142f:0
142F:0000 49 42 4D 20 20 20 20 20-20 20 20 20 20 20 20 20 IBM
142F:0010 44 45 43 20 20 20 20 20-20 20 20 20 20 20 20 20 DEC
142F:0020 44 4F 53 20 20 20 20 20-20 20 20 20 20 20 20 20 DOS
142F:0030 56 41 58 20 20 20 20 20-20 20 20 20 20 20 20 20 VAX
142F:0040 B8 2F 14 8E D8 B9 04 00-BE 00 00 8B D1 B9 03 00 ./..............
142F:0050 BB 00 00 8A 00 24 DF 88-00 43 E2 F7 8B CA 83 C6 .....$...C......
142F:0060 10 E2 E8 B8 00 4C CD 21-00 00 00 00 00 00 00 00 .....L.!........
142F:0070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
作者:VI_Young
补充:软件开发 , 其他 ,