mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-14 01:14:27 +02:00
commit Bart's patch to fix CP/M call psp:05h compatibility call along with some comments to explain the call trampoline
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1372 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
497a2337ef
commit
240bcc30e2
@ -65,11 +65,19 @@ typedef struct {
|
||||
UWORD ps_exit; /* 00 CP/M-like exit point: int 20 */
|
||||
UWORD ps_size; /* 02 segment of first byte beyond */
|
||||
/* memory allocated to program */
|
||||
BYTE ps_fill1; /* 04 single char fill */
|
||||
BYTE ps_fill1; /* 04 single char fill=0 */
|
||||
|
||||
/* CP/M-like entry point */
|
||||
/* offsets 5-9 are a far call to absolute address 0:000Ch
|
||||
coded so that CP/M apps can do a near call to psp:5, does a
|
||||
far call but ensures word at offset 6 is size of COM file
|
||||
e.g. FEF0h by using 1MB wrap around address 0F01D:FEF0
|
||||
(jmp code stored at 0:000C should be duplicated in HMA FFFF:00D0)
|
||||
Note: MS-DOS has value as FEEE which wraps to 0:00BEh */
|
||||
UBYTE ps_farcall; /* 05 far call opcode */
|
||||
VOID(FAR ASMCFUNC * ps_reentry) (void); /* 06 re-entry point */
|
||||
|
||||
|
||||
intvec ps_isv22, /* 0a terminate address */
|
||||
ps_isv23, /* 0e break address */
|
||||
ps_isv24; /* 12 critical error address */
|
||||
|
@ -65,9 +65,14 @@ segment HMA_TEXT
|
||||
; VOID FAR
|
||||
; cpm_entry(iregs UserRegs)
|
||||
;
|
||||
; This one is a strange one. The call is to psp:0005h but it returns to the
|
||||
; function after the call. What we do is convert it to a normal call and
|
||||
; fudge the stack to look like an int 21h call.
|
||||
; For CP/M compatibility allow a program to invoke any DOS API function
|
||||
; between 0 and 24h by doing a near call to psp:0005h which embeds a far call
|
||||
; to absolute address 0:00C0h (int vector 30h & 31h) or FFFF:00D0 (hma).
|
||||
; Note: int 31h is also used for DPMI
|
||||
; Upon entry the stack has a near return offset (desired return address) and
|
||||
; far return seg:offset (useless return to data at offset 0ah after far call
|
||||
; in psp). We convert it to a normal call and correct the stack to appear same
|
||||
; as if invoked via an int 21h call including proper return address.
|
||||
;
|
||||
reloc_call_cpm_entry:
|
||||
; Stack is:
|
||||
@ -75,10 +80,7 @@ reloc_call_cpm_entry:
|
||||
; psp seg
|
||||
; 000ah
|
||||
;
|
||||
push bp ; trash old return address
|
||||
mov bp,sp
|
||||
xchg bp,[2+bp]
|
||||
pop bp
|
||||
add sp, 2 ; remove unneeded far return offset 0ah
|
||||
pushf ; start setting up int 21h stack
|
||||
;
|
||||
; now stack is
|
||||
@ -107,12 +109,12 @@ reloc_call_cpm_entry:
|
||||
; psp seg (alias .COM cs)
|
||||
; return offset
|
||||
;
|
||||
cmp cl,024h
|
||||
jbe cpm_error
|
||||
cmp cl,024h ; restrict calls to functions 0-24h
|
||||
ja cpm_error
|
||||
mov ah,cl ; get the call # from cl to ah
|
||||
jmp reloc_call_int21_handler ; do the system call
|
||||
cpm_error: mov al,0
|
||||
iret
|
||||
iret ; cleanup stack and return to caller
|
||||
|
||||
;
|
||||
; interrupt zero divide handler:
|
||||
|
Loading…
x
Reference in New Issue
Block a user