Implement jump table for syscalls
This commit is contained in:
parent
3a721063f4
commit
d3f6915af4
@ -7,24 +7,32 @@ ORG BDOS
|
|||||||
DISKBUF: EQU (BDOS-0x200) ; deblocking
|
DISKBUF: EQU (BDOS-0x200) ; deblocking
|
||||||
DISKBPB: EQU (DISKBUF-21) ; BPB of the current driv
|
DISKBPB: EQU (DISKBUF-21) ; BPB of the current driv
|
||||||
DISKDRV: EQU (DISKBPB-1) ; BYTE denoting drive of current fcb (1=A, ...)
|
DISKDRV: EQU (DISKBPB-1) ; BYTE denoting drive of current fcb (1=A, ...)
|
||||||
STACK: EQU (DISKDRV & 0xFFFE) ; even address, grows down
|
|
||||||
|
PROGBX: EQU (DISKDRV-2)
|
||||||
|
|
||||||
|
STACK: EQU (PROGBX & 0xFFFE) ; even address, grows down
|
||||||
|
|
||||||
DEFDRV: EQU 4 ; default drive when opening a FCB (1=A, ...)
|
DEFDRV: EQU 4 ; default drive when opening a FCB (1=A, ...)
|
||||||
|
|
||||||
SYSCALL:
|
SYSCALL:
|
||||||
TEST CL, CL
|
MOV [PROGBX], BX
|
||||||
JE SETUP
|
XOR BH, BH
|
||||||
CMP CL, 1
|
MOV BL, CL
|
||||||
JE GETC
|
ADD BX, BX
|
||||||
CMP CL, 2
|
ADD BX, FUNCS
|
||||||
JE PUTC
|
MOV BX, [BX]
|
||||||
CMP CL, 9
|
PUSH BX
|
||||||
JE PUTS
|
MOV BX, [PROGBX]
|
||||||
CMP CL, 10
|
SYSRET:
|
||||||
JE GETS
|
RET
|
||||||
CMP CL, 11
|
|
||||||
JE STATUS
|
FUNCS:
|
||||||
JMP SYSCALL2
|
DW SETUP,GETC,PUTC,SYSRET
|
||||||
|
DW SYSRET,SYSRET,SYSRET,SYSRET
|
||||||
|
DW SYSRET,PUTS,GETS,STATUS
|
||||||
|
DW SYSRET,DISKRST,SETDEFDSK,FCBOPEN
|
||||||
|
DW SYSRET,SYSRET,SYSRET,SYSRET
|
||||||
|
DW SYSRET,SYSRET,SYSRET,SYSRET
|
||||||
|
|
||||||
SETUP:
|
SETUP:
|
||||||
MOV SP, STACK
|
MOV SP, STACK
|
||||||
@ -126,16 +134,6 @@ GETS_BS:
|
|||||||
STATUS:
|
STATUS:
|
||||||
JMP CONST
|
JMP CONST
|
||||||
|
|
||||||
SYSCALL2:
|
|
||||||
CMP CL, 13
|
|
||||||
JE DISKRST
|
|
||||||
CMP CL, 14
|
|
||||||
JE SETDEFDSK
|
|
||||||
CMP CL, 15
|
|
||||||
JE FCBOPEN
|
|
||||||
RET:
|
|
||||||
RET
|
|
||||||
|
|
||||||
DISKRST:
|
DISKRST:
|
||||||
MOV BYTE [DISKDRV], 0xFF
|
MOV BYTE [DISKDRV], 0xFF
|
||||||
RET
|
RET
|
||||||
@ -153,6 +151,8 @@ FCBOPEN:
|
|||||||
NODEFDRV:
|
NODEFDRV:
|
||||||
CALL LOADBPB
|
CALL LOADBPB
|
||||||
|
|
||||||
|
MOV CX, [DISKBPB+BPB_RDE]
|
||||||
|
|
||||||
CALL FATSIZE
|
CALL FATSIZE
|
||||||
ADD DX, WORD [DISKBPB+BPB_RSC]
|
ADD DX, WORD [DISKBPB+BPB_RSC]
|
||||||
CALL SETLSEC
|
CALL SETLSEC
|
||||||
@ -192,6 +192,7 @@ FATSIZE:
|
|||||||
MUL DL
|
MUL DL
|
||||||
XCHG AX, DX
|
XCHG AX, DX
|
||||||
POP AX
|
POP AX
|
||||||
|
RET:
|
||||||
RET
|
RET
|
||||||
|
|
||||||
; IN CL drive num, 1=A, 2=B, 3=C
|
; IN CL drive num, 1=A, 2=B, 3=C
|
||||||
|
Loading…
Reference in New Issue
Block a user