35 lines
569 B
NASM
35 lines
569 B
NASM
|
; reset segments
|
||
|
rstseg mov ax, cs
|
||
|
mov ds, ax
|
||
|
mov es, ax
|
||
|
ret
|
||
|
|
||
|
; copy to far memory
|
||
|
; IN es:bx far memory ptr (preserved)
|
||
|
; ds:dx local ptr (preserved)
|
||
|
; cx number of bytes to transfer
|
||
|
; OUT cx set to zero
|
||
|
; si & di trashed
|
||
|
stofar mov si, dx
|
||
|
mov di, bx
|
||
|
rep movsb
|
||
|
ret
|
||
|
|
||
|
; copy from far memory
|
||
|
; IN es:bx far memory ptr (preserved)
|
||
|
; ds:dx local ptr (preserved)
|
||
|
; cx number of bytes to copy
|
||
|
; OUT cx set to zero
|
||
|
; si & di trashed
|
||
|
lodfar call xchgdes
|
||
|
mov si, bx
|
||
|
mov di, dx
|
||
|
rep movsb
|
||
|
|
||
|
; exchange es and ds
|
||
|
xchgdes push ds
|
||
|
push es
|
||
|
pop ds
|
||
|
pop es
|
||
|
ret
|