53 lines
590 B
NASM
53 lines
590 B
NASM
; far pointer load
|
|
; IN ES:BX far pointer to data
|
|
; CX number of bytes to copy
|
|
; 0:DX destination buffer
|
|
; only CX is trashed
|
|
|
|
lod: push si
|
|
push di
|
|
push es
|
|
|
|
; ES:DI := DS:DX
|
|
mov ax, ds
|
|
mov es, ax
|
|
mov di, dx
|
|
; DS:SI := 0:BX
|
|
xor ax, ax
|
|
mov ds, ax
|
|
mov si, bx
|
|
; copy
|
|
pushf
|
|
cld
|
|
rep movsb
|
|
popf
|
|
; reset DS to kernel data
|
|
mov ds, cx
|
|
|
|
pop es
|
|
pop di
|
|
pop si
|
|
ret
|
|
|
|
; far pointer store
|
|
; IN ES:BX far ptr
|
|
; CX number of bytes
|
|
; 0:DX source buffer
|
|
; only CX is trashed
|
|
|
|
sto: push si
|
|
push di
|
|
|
|
mov si, dx
|
|
mov di, bx
|
|
|
|
; do the copy
|
|
pushf
|
|
cld
|
|
rep movsb
|
|
popf
|
|
|
|
pop di
|
|
pop si
|
|
ret
|