2020-10-30 10:29:22 +01:00
|
|
|
; Utilities to help with far pointers
|
|
|
|
|
|
|
|
; exchange DS:SI with ES:DI
|
|
|
|
xchgs: push ds
|
|
|
|
push es
|
|
|
|
pop ds
|
|
|
|
pop es
|
|
|
|
xchg si, di
|
|
|
|
ret
|
|
|
|
|
2020-10-25 00:50:23 +02:00
|
|
|
; far pointer load
|
|
|
|
; IN ES:BX far pointer to data
|
|
|
|
; CX number of bytes to copy
|
|
|
|
; 0:DX destination buffer
|
|
|
|
|
2020-10-30 10:29:22 +01:00
|
|
|
lod: push es
|
2020-10-25 00:50:23 +02:00
|
|
|
|
|
|
|
; 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
|
|
|
|
ret
|
|
|
|
|
|
|
|
; far pointer store
|
|
|
|
; IN ES:BX far ptr
|
|
|
|
; CX number of bytes
|
|
|
|
; 0:DX source buffer
|
|
|
|
; only CX is trashed
|
|
|
|
|
2020-10-30 10:29:22 +01:00
|
|
|
sto: mov si, dx
|
2020-10-25 00:50:23 +02:00
|
|
|
mov di, bx
|
|
|
|
cld
|
|
|
|
rep movsb
|
|
|
|
ret
|