Work on interrupt subfunctions, remove drvtab experiments

This commit is contained in:
Nero 2019-09-08 15:18:37 +00:00
parent 05c7e905d0
commit cd258ccbe4
4 changed files with 84 additions and 68 deletions

View file

@ -6,10 +6,7 @@ org 0x0100
mov ax, 0x21
call intr_register
.loop:
mov ah, 0x01
int 0x21
jmp .loop
int3
cli
.halt:
@ -17,10 +14,41 @@ org 0x0100
jmp .halt
isr_dos_main:
cmp ah, 0x01
je isr_getc
cmp ah, 0x02
je isr_putc
; Bail out if subfunction number too high
cmp ah, 0x0F
jnc isr_invalid
; allocate our return address
push bx
; actual BX backup
push bx
; transfer subfunction number into BX
xor bx, bx
mov bl, ah
; table offset = AH * 2
shl bx, 1
; fetch from table
mov bx, [dos_functions+bx]
; inject our address into the stack
add sp, 4
push bx
sub sp, 2
; restore BX
pop bx
; reads our address from the stack and jumps there
ret
; ISR for invalid subfunctions or unimplemented
isr_invalid:
mov bp, 0xFEFE
int3
.hlt:
hlt
jmp .hlt
; ISR tail to set carry flag to signal error
isr_error:
push bp
mov bp, sp
@ -30,9 +58,31 @@ isr_error:
isr_return:
iret
; Table for DOS subfunctions
dos_functions:
; AH 00-03
dw isr_invalid
dw isr_getc_echo
dw isr_putc
dw isr_invalid
; AH 04-07
dw isr_invalid
dw isr_invalid
dw isr_invalid
dw isr_invalid
; AH 08-0B
dw isr_invalid
dw isr_invalid
dw isr_invalid
dw isr_invalid
; AH 0C-0F
dw isr_invalid
dw isr_invalid
dw isr_invalid
dw isr_invalid
%include "intr.asm"
%include "drvtab.asm"
%include "chario.asm"
times 1000 db 0xEA
kernel_end: