方法一:
assume cs:code, ds:data
data segment
db 'welcome to mams!'
db '----------------'
data ends
code segment
start:
mov ax, data
mov ds, ax
mov es, ax
mov si, 0
mov di, 16
mov cx, 16
copyData:
mov dl, ds:[si]
mov es:[di], dl
inc si
inc di
loop copyData
mov ax, 4C00H
int 21H
code ends
end start
方法二:
assume cs:code, ds:data
data segment
db 'welcome to mams!'
db '----------------'
data ends
code segment
start:
mov ax, data
mov ds, ax
mov es, ax
mov si, 0
mov di, 16
mov cx, 8
copyData:
mov dx, ds:[si]
mov es:[di], dx
add si, 2
add di, 2
loop copyData
mov ax, 4C00H
int 21H
code ends
end start
方法三:
assume cs:code, ds:data
data segment
db 'welcome to mams!'
db '----------------'
data ends
stack segment
dw 0, 0, 0, 0, 0, 0, 0, 0
dw 0, 0, 0, 0, 0, 0, 0, 0
stack ends
code segment
start:
mov ax, stack
mov ss, ax
mov sp, 32
mov ax, data
mov ds, ax
mov es, ax
mov si, 0
mov di, 16
mov cx, 8
copyData:
push ds:[si]
pop es:[di]
add si, 2
add di, 2
loop copyData
mov ax, 4C00H
int 21H
code ends
end start
方法四:
assume cs:code, ds:data
data segment
db 'welcome to mams!'
db '----------------'
data ends
code segment
start:
mov ax, data
mov ds, ax
mov si, 0
mov cx, 8
copyData:
mov dx, ds:[si]
mov ds:[si + 16], dx
add si, 2
loop copyData
mov ax, 4C00H
int 21H
code ends
end start
程序运行的结果:
上一篇:汇编语言 乘法和除法指令
下一篇:汇编语言 字母的大小写转换