rdos/kernel/debug.asm
2019-05-02 21:06:02 +00:00

53 lines
792 B
NASM

; this prints registers
; expect to be called as interrupt routine
isr_debug:
push ss
push es
push ds
push di
push si
push bp
push sp
push dx
push cx
push bx
push ax
call printf
db "AX=%X BX=%X CX=%X DX=%X", 0x20
db "SP=%X BP=%X SI=%X DI=%X", 0x0A, 0x0D
db "DS=%X ES=%X SS=%X IP=%X CS=%X", 0x20, 0
mov bp, sp
mov bx, [ss:bp+26]
mov si, .flags
mov cx, 0x0010
.loop:
mov al, [cs:si]
inc si
test bx, 0x8000
jnz .write
mov al, '-'
.write:
sal bx, 1
call putc
loop .loop
call printf
db 0x0A, 0x0D, 0
pop ax
pop bx
pop cx
pop dx
pop sp
pop bp
pop si
pop di
pop ds
pop es
pop ss
iret
.flags:
; 16 letters for each bit in flags register
db "++++ODITSZ+A+P+C"