Add WIP for new debugger

This commit is contained in:
Nero 2020-05-11 22:22:58 +00:00
parent 5129a5499e
commit 2569dde385

76
driver/debug.asm Normal file
View File

@ -0,0 +1,76 @@
jmp init
align 4
db "rDos"
align 8
; hook interrupt 3
db 3
db 0
dw int3entry
dd 0
; end of header
db 0
stacksize: equ 0x20
init:
mov ax, 0x0e33
xor bx, bx
int 0x10
retf
int3entry:
; save DS and AX
mov [cs:reg_ds], ds
mov [cs:reg_ax], ax
; use AX to load DS=CS
mov ax, cs
mov ds, ax
; pop IP, CS and flags from stack
pop ax
mov [reg_ip], ax
pop ax
mov [reg_cs], ax
pop ax
mov [reg_fl], ax
; save the other registers
mov [reg_cx], cx
mov [reg_dx], dx
mov [reg_bx], bx
mov [reg_sp], sp
mov [reg_bp], bp
mov [reg_si], si
mov [reg_di], di
; save other segment registers we can access
mov [reg_ss], ss
mov [reg_es], es
; initialize other segments and setup stack
mov es, ax
mov ss, ax
mov sp, (stack+stacksize)
hlt: hlt
jmp hlt
reg_ax: dw 0
reg_cx: dw 0
reg_dx: dw 0
reg_bx: dw 0
reg_sp: dw 0
reg_bp: dw 0
reg_si: dw 0
reg_di: dw 0
reg_es: dw 0
reg_cs: dw 0
reg_ss: dw 0
reg_ds: dw 0
reg_ip: dw 0
reg_fl: dw 0
names: db "AXCXDXBXSPBPSIDI"
db "DSESSSCSIPFL"
stack: times stacksize dw 0
align 16