Each time I press a key after I changed the ivt bochs throws an error my way and halts (note no triple fault)
Here's what I do:
I switch to protected mode, change all my segments to 32 bit(cs and ss not included) and then switch back to real mode. After outputting a message to inform the user of success, I do this:
Code: Select all
cli ;no interruptions
mov bx, 0x09 ;hardware interrupt #
shl bx, 2 ;multiply by 4
xor ax, ax
mov gs, ax ;start of memory
mov [gs:bx], word getc
mov [gs:bx+2], ds ; segment = 0 (while debugging)
sti
I took this code from one of the babysteps tutorials.
Code: Select all
pusha
;Apparently spinning until the byte is ready is necessary on some older machines.
.spin:
in al, 0x64
and al, 0x01
jz .spin
xor eax, eax
;read scancode
in al, 0x60
and al, 0x80
jz Done
;Here you can do with the scancode whatever you like.
;For example converting it to another keyboard layout or test for special keys and trigger a reboot
lea ax, [KeyMap]
add bx, ax
mov cl, byte [bx]
mov ch, 0x7
push cx
push 0xb8000
call putc
;Now we tell the first PIC that the IRQ is handled
Done:
mov al, 0x20
out 0x20, al
popa
iret
Code: Select all
8. 0xbar:0xfoo
9. 0x0000:0xcorrect address to getc function(I checked)
10. 0xbar:0xfoo
This recursive error I get when I replace the segment of the handler with 0(my ds):
int13_cdrom: function 00, ELDL out of range fe (this goes on indefinitely)
If I don't replace the segment of the handler, I get this error after a considerable timeout (after pressing a key) and no triple fault:
int13_cdrom: function 00, status 04 !
I think I'm overwriting the wrong address (obviously)
Does anyone know how to fix this?
ps, before you ask, I'm not switching to pmode because I tried that and found that it was too hard to start with. And I'm not staying in realmode since I want more memory to play with, even if I don't need it and programs can't run outside the first 64KBs of memory.