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
|
||||
DISKBPB: EQU (DISKBUF-21) ; BPB of the current driv
|
||||
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, ...)
|
||||
|
||||
SYSCALL:
|
||||
TEST CL, CL
|
||||
JE SETUP
|
||||
CMP CL, 1
|
||||
JE GETC
|
||||
CMP CL, 2
|
||||
JE PUTC
|
||||
CMP CL, 9
|
||||
JE PUTS
|
||||
CMP CL, 10
|
||||
JE GETS
|
||||
CMP CL, 11
|
||||
JE STATUS
|
||||
JMP SYSCALL2
|
||||
MOV [PROGBX], BX
|
||||
XOR BH, BH
|
||||
MOV BL, CL
|
||||
ADD BX, BX
|
||||
ADD BX, FUNCS
|
||||
MOV BX, [BX]
|
||||
PUSH BX
|
||||
MOV BX, [PROGBX]
|
||||
SYSRET:
|
||||
RET
|
||||
|
||||
FUNCS:
|
||||
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:
|
||||
MOV SP, STACK
|
||||
@ -126,16 +134,6 @@ GETS_BS:
|
||||
STATUS:
|
||||
JMP CONST
|
||||
|
||||
SYSCALL2:
|
||||
CMP CL, 13
|
||||
JE DISKRST
|
||||
CMP CL, 14
|
||||
JE SETDEFDSK
|
||||
CMP CL, 15
|
||||
JE FCBOPEN
|
||||
RET:
|
||||
RET
|
||||
|
||||
DISKRST:
|
||||
MOV BYTE [DISKDRV], 0xFF
|
||||
RET
|
||||
@ -153,6 +151,8 @@ FCBOPEN:
|
||||
NODEFDRV:
|
||||
CALL LOADBPB
|
||||
|
||||
MOV CX, [DISKBPB+BPB_RDE]
|
||||
|
||||
CALL FATSIZE
|
||||
ADD DX, WORD [DISKBPB+BPB_RSC]
|
||||
CALL SETLSEC
|
||||
@ -192,6 +192,7 @@ FATSIZE:
|
||||
MUL DL
|
||||
XCHG AX, DX
|
||||
POP AX
|
||||
RET:
|
||||
RET
|
||||
|
||||
; IN CL drive num, 1=A, 2=B, 3=C
|
||||
|
Loading…
Reference in New Issue
Block a user