2021-01-21 23:28:57 +01:00
|
|
|
; Program segment prefix headers and constants
|
|
|
|
|
|
|
|
section .bss
|
|
|
|
|
|
|
|
curpsp: resw 1
|
|
|
|
|
|
|
|
absolute 0
|
|
|
|
|
|
|
|
resb 2 ; ret 0 exit
|
|
|
|
resb 2 ; next unusable segment
|
|
|
|
PSPDD: resb 1 ; BYTE default drive
|
|
|
|
; CP/M entry point
|
|
|
|
resb 1 ; instruction byte
|
|
|
|
resw 1 ; usable length of segment (needs to be here for compata)
|
|
|
|
resb 4 ; opcodes to call us
|
|
|
|
|
|
|
|
; saved userdata
|
|
|
|
PSPAX: resw 1
|
|
|
|
PSPCX: resw 1
|
|
|
|
; SS:SP
|
|
|
|
PSPSP: resw 1
|
|
|
|
PSPSS: resw 1
|
|
|
|
; DS:DX
|
|
|
|
PSPDX: resw 1
|
|
|
|
PSPDS: resw 1
|
|
|
|
; ES:BX
|
|
|
|
PSPBX: resw 1
|
|
|
|
PSPES: resw 1
|
|
|
|
|
|
|
|
PSPDTA: resd 1 ; DWORD ptr to disk transfer area
|
|
|
|
|
|
|
|
section .text
|
|
|
|
|
|
|
|
; set default drive for current process
|
|
|
|
; IN dl drive number
|
|
|
|
setdd: push es
|
|
|
|
mov es, [curpsp]
|
|
|
|
mov [es:PSPDD], dl
|
|
|
|
pop es
|
|
|
|
ret
|
|
|
|
|
|
|
|
; get default drive for current process
|
|
|
|
; OUT al drive number
|
|
|
|
getdd: push es
|
|
|
|
mov es, [curpsp]
|
|
|
|
mov al, [es:PSPDD]
|
|
|
|
pop es
|
|
|
|
ret
|
|
|
|
|
|
|
|
; set DTA ptr
|
|
|
|
; IN es:bx far ptr
|
2021-01-21 23:30:35 +01:00
|
|
|
setdta: push ds
|
2021-01-21 23:28:57 +01:00
|
|
|
mov ds, [curpsp]
|
|
|
|
mov [PSPDTA], bx
|
|
|
|
mov [PSPDTA+2], es
|
2021-01-21 23:30:35 +01:00
|
|
|
pop ds
|
2021-01-21 23:28:57 +01:00
|
|
|
|
|
|
|
; get DTA ptr
|
|
|
|
; OUT es:bx far ptr
|
|
|
|
getdta: mov es, [curpsp]
|
|
|
|
les bx, [es:PSPDTA]
|
|
|
|
ret
|