data segment
buf1 db '0123456789'
data ends
ext segment
buf2 db 10 dup(0)
ext ends
assume cs:code,ds:data,es:ext
code segment
start: mov ax,data
mov ds,ax;源址
mov ax,ext
mov es,ax;目标段址
cld
lea si,buf1
lea di,buf2
mov cx,10
rep movsb;拷贝
mov ax,4c00h
int 21h
code ends
end start
结果:
-d 0710:0
0710:0000 30 31 32 33 34 35 36 37-38 39 00 00 00 00 00 00 0123456789......
0710:0010 30 31 32 33 34 35 36 37-38 39 00 00 00 00 00 00 0123456789......
0710:0020 B8 10 07 8E D8 B8 11 07-8E C0 FC BE 00 00 BF 00 ?.???.????..?.
0710:0030 00 B9 0A 00 F3 A4 B8 00-4C CD 21 90 90 90 90 90 .?..???.L?!?????
0710:0040 90 90 90 90 90 90 90 90-90 90 90 90 90 90 90 F4 ????????????????
0710:0050 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
0710:0060 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
0710:0070 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
data segment
buf1 dw 0h,1h,2h,3h,4h,5h,6h,7h,8h,9h
buf2 dw 10 dup(0)
data ends
assume cs:code,ds:data
code segment
start: mov ax,data
mov ds,ax
mov ax,0
mov bx,0
mov cx,10
s:add ax,buf1[bx]
inc bx
loop s
mov buf2,ax
mov ax,4c00h
int 21h
code ends
end start
结果:
-d 0711:0004
0711:0004 0A 0F 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ...............