我需要帮助才能打印2次。 有什么建议吗?
.stack 100H
.model small
.386
.data
source DB "Something in here", 10, 13
lsource EQU ($ - source)
target DB 128 DUP (?)
ltarget EQU ($ - target)
.code
main:
mov ax, @data ; set up data addressability
mov ds, ax
; mov string from source to destination
cld ; clear direction flag = forward
mov cx, lsource ; set REP counter
mov si, OFFSET source ; set si to point to source
mov di, OFFSET target ; set di to point to target
rep movsb
mov ax, 4000h ; dos service to display...
mov bx, 1 ; to screen
mov cx, lsource ; number of bytes
mov dx, OFFSET source ; where to get data
int 21h
mov ax, 4000h ; dos service to display...
mov bx, 1 ; to screen
mov cx, ltarget ; number of bytes
mov dx, OFFSET target ; where to get data
int 21h
mov ah, 4ch
int 21h
end main
为什么不打印2次?
答案 0 :(得分:2)
rep movsb
将CX
个字节从DS:SI
复制到ES:DI
。您没有初始化ES
。在mov es, ax
之后只插入一行mov ds, ax
。