1- SI和DI是8086CPU中和bx功能相近的寄存器, SI和DI不能够分成两个8位寄存器来使用, 下面的三组指令实现了相同的功能:
(1) mov bx,0
mov ax,[bx]
(2) mov si,0
mov ax,[si]
(3) mov di,0
mov ax,[di]
或者
(1) mov bx,0
mov ax,[bx + 123]
(2) mov si,0
mov ax,[si + 123]
(3) mov di,0
mov ax,[di + 123]
方法一:
1 ;用寄存器SI和DI实现将字符串‘welcome to masm!‘复制到它后面的数据区中. 2 assume cs:codesg, ds:datasg 3 datasg segment 4 db ‘welcome to masm!‘ 5 db ‘................‘ 6 datasg ends 7 codesg segment 8 start: mov ax,datasg 9 mov ds,ax 10 mov si,0 11 mov di,16 12 13 mov cx,8 14 s: mov ax,[si] 15 mov [di],ax 16 add si,2 17 add di,2 18 loop s 19 20 mov ax,4c00H 21 int 21h 22 codesg ends 23 end start
方法二:
用 [bx(si 或 di) + idata]的方式实现
1 ;用寄存器SI和DI实现将字符串‘welcome to masm!‘复制到它后面的数据区中. 2 assume cs:codesg, ds:datasg 3 datasg segment 4 db ‘welcome to masm!‘ 5 db ‘................‘ 6 datasg ends 7 codesg segment 8 start: mov ax,datasg 9 mov ds,ax 10 mov si,0 11 12 mov cx,8 13 s: mov ax,[si] 14 mov 16[si],ax 15 add si,2 16 loop s 17 18 mov ax,4c00H 19 int 21h 20 codesg ends 21 end start
原文:http://www.cnblogs.com/galoishelley/p/3567166.html