问题7.2 用si和di实现将字符串‘welcome to masm!’复制到它后面的数据区中

方法一:

assume     cs:codesg,ds:datasg
datasg      segment
db            'welcome to masm!'
db            '................'
datasg      ends
codesg     segment
start:         mov    ax,datasg
                 mov    ds,ax
                 mov    si,0
                 mov    cx,8
s:               mov    ax,0[si]
                 mov    16[si],ax
                 add      si,2
                 loop     s
                 mov     ax,4c00h
                 int        21h
codesg      ends
                  end     start

  

方法二:

assume    cs:codesg,ds:datasg
datasg     segment
db           'welcome to masm!'
db           '................'
datasg     ends
codesg    segment
start:        mov  ax,datasg
                mov  ds,ax
                mov  si,0
                mov  di,16
                mov  cx,8
s:              mov ax,[si]
                mov  [di],ax
                add   si,2
                add   di,2
                loop  s
                mov  ax,4c00h
                int     21h
codesg    ends
end          start  
上一篇:使用汇编语言编写第一个程序


下一篇:Spring Boot:理解CommandLineRunner和ApplicationRunner