Start IVT handling, create debug IR as example user
This commit is contained in:
parent
8c4821967c
commit
4150ef90ef
@ -1,5 +1,8 @@
|
|||||||
|
cpu 8086
|
||||||
|
|
||||||
; this kprints registers
|
; this kprints registers
|
||||||
_int_2F:
|
; expect to be called as interrupt routine
|
||||||
|
debug_reg_ir:
|
||||||
push ss
|
push ss
|
||||||
push es
|
push es
|
||||||
push ds
|
push ds
|
||||||
@ -30,4 +33,4 @@ _int_2F:
|
|||||||
pop ss
|
pop ss
|
||||||
iret
|
iret
|
||||||
.fmt:
|
.fmt:
|
||||||
db "AX=%X BX=%X CX=%X DX=%X SP=%X BP=%X SI=%X DI=%X", 0x0A, 0x0D, "DS=%X ES=%X SS=%X IP=%X CS=%X FL=%B", 0
|
db "AX=%X BX=%X CX=%X DX=%X SP=%X BP=%X SI=%X DI=%X", 0x0A, 0x0D, "DS=%X ES=%X SS=%X IP=%X CS=%X FL=%X", 0
|
21
intr.asm
Normal file
21
intr.asm
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
cpu 8086
|
||||||
|
|
||||||
|
; set item in interrupt vector table
|
||||||
|
; in: bx interrupt number
|
||||||
|
; ds:dx new handler address
|
||||||
|
ivt_set:
|
||||||
|
push es
|
||||||
|
push ax
|
||||||
|
|
||||||
|
xor ax,ax
|
||||||
|
mov es,ax
|
||||||
|
|
||||||
|
sal bx,1
|
||||||
|
sal bx,1
|
||||||
|
|
||||||
|
mov [es:bx], dx
|
||||||
|
mov [es:bx+2], ds
|
||||||
|
|
||||||
|
pop ax
|
||||||
|
pop es
|
||||||
|
ret
|
20
main.asm
20
main.asm
@ -43,21 +43,17 @@ main:
|
|||||||
mov ax, cs
|
mov ax, cs
|
||||||
mov ds, ax
|
mov ds, ax
|
||||||
|
|
||||||
sub sp, 0x30
|
mov bx, 0x002E
|
||||||
|
mov dx, debug_reg_ir
|
||||||
|
|
||||||
xor ax,ax
|
call ivt_set
|
||||||
mov es,ax
|
|
||||||
mov ax,_int_2F
|
|
||||||
xchg ax,[es:0x2F*4]
|
|
||||||
mov ax,cs
|
|
||||||
xchg ax,[es:0x2F*4+2]
|
|
||||||
int 0x2F
|
|
||||||
test ax, 0xFF
|
|
||||||
int 0x2F
|
|
||||||
|
|
||||||
add sp, 0x30
|
int 0x2E
|
||||||
|
cmp ax,0x55AA
|
||||||
|
int 0x2E
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
|
||||||
%include "dumpreg.asm"
|
%include "intr.asm"
|
||||||
|
%include "debug.asm"
|
||||||
%include "kprintf.asm"
|
%include "kprintf.asm"
|
||||||
|
Loading…
Reference in New Issue
Block a user