谁帮我分析一下原因?
如下题目与代码:将40个字母a的字符串从源缓冲区传送到目的缓冲区。
程序代码:
data segment s_buf db 40 dup('a') data ends extra segment d_buf db 40 dup(?) extra ends cseg segment main proc far assume cs:cseg, ds:data, es:extra start: push ds xor ax, ax push ax mov ax, data mov ds, ax mov ax, extra mov es, ax mov cx,40 lea si, s_buf lea di, d_buf cld rep movsb ret main endp cseg ends end start
编译后debug调试运行结果如下:
程序代码:
-u 0 0AB1:0000 1E PUSH DS 0AB1:0001 33C0 XOR AX,AX 0AB1:0003 50 PUSH AX 0AB1:0004 B8AB0A MOV AX,0AAB 0AB1:0007 8ED8 MOV DS,AX 0AB1:0009 B8AE0A MOV AX,0AAE 0AB1:000C 8EC0 MOV ES,AX 0AB1:000E B92800 MOV CX,0028 0AB1:0011 8D360000 LEA SI,[0000] 0AB1:0015 8D3E0000 LEA DI,[0000] 0AB1:0019 FC CLD 0AB1:001A F3 REPZ 0AB1:001B A4 MOVSB 0AB1:001C CB RETF -g1c AX=0AAE BX=0000 CX=0000 DX=0000 SP=FFFC BP=0000 SI=0028 DI=0028 DS=0AAB ES=0AAE SS=0AAB CS=0AB1 IP=001C NV UP EI PL ZR NA PE NC 0AB1:001C CB RETF -d 0aab:0 0AAB:0000 61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61 aaaaaaaaaaaaaaaa 0AAB:0010 61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61 aaaaaaaaaaaaaaaa 0AAB:0020 61 61 61 61 61 61 61 61-00 00 00 00 00 00 00 00 aaaaaaaa........ 0AAB:0030 61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61 aaaaaaaaaaaaaaaa 0AAB:0040 61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61 aaaaaaaaaaaaaaaa 0AAB:0050 61 61 61 61 61 61 61 61-00 00 00 00 00 00 00 00 aaaaaaaa........ 0AAB:0060 1E 33 C0 50 B8 AB 0A 8E-D8 B8 AE 0A 8E C0 B9 28 .3繮斧.庁府.幚? 0AAB:0070 00 8D 36 00 00 8D 3E 00-00 FC F3 A4 CB 74 6F 20 .?..?..?にto -d 0aae:0 0AAE:0000 61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61 aaaaaaaaaaaaaaaa 0AAE:0010 61 61 61 61 61 61 61 61-61 61 61 61 61 61 61 61 aaaaaaaaaaaaaaaa 0AAE:0020 61 61 61 61 61 61 61 61-00 00 00 00 00 00 00 00 aaaaaaaa........ 0AAE:0030 1E 33 C0 50 B8 AB 0A 8E-D8 B8 AE 0A 8E C0 B9 28 .3繮斧.庁府.幚? 0AAE:0040 00 8D 36 00 00 8D 3E 00-00 FC F3 A4 CB 74 6F 20 .?..?..?にto 0AAE:0050 64 6F 20 72 65 71 75 65-73 74 65 64 20 63 6F 6D do requested com 0AAE:0060 6D 61 6E 64 0D 0A 33 0D-0A 49 6E 66 69 6E 69 74 mand..3..Infinit 0AAE:0070 65 20 72 65 74 72 79 20-6E 6F 74 20 73 75 70 70 e retry not supp
运行结果确定是正确的,数据从0AAB:0000 copy到了0AAE:0000,可我疑惑的是,为什么程序
还附带拷贝了一份数据到0AAB:0030?
我用了Borland的tasm,微软的masm编译都得到了相同的运行结果。why?