First post, by Rav
Hi, I did made an option rom for my 486 not so long ago and slowly improve it to add features.
So far it does :
* Setup the ALI1429 chipset properly (memory timing, cache stuff, etc, etc)
* Setup the Cyrix 5x86 register to optimal one
* Add Keyboard hook so I can press ctrl-alt-pageup/down to enable or disable cyrix BTB
Everything work everywhere! Except....
The keyboard hook when I boot with QEMM instead of himem/emm386, in that case QEMM bark with a Exception #6 error.
Keyboard hook code attached, I don't know if someone can help me with that. The crash does not append when dos&qemm load, it append at the moment I press any key after qemm is loaded.
The initial 0x09 IVT pointed to 0xF000E987, crash is as F000E991, really not far after.
Crash :
newInt9:clipush ax ; Save registerspush bxpush esmov ax, 0x40mov es, axmov al, byte [es:0x17] ; Check if Ctrl+Alt are pressedand al, 0x0Ccmp al, 0x0Cjne .exit_int9h_hookin al, 0x60 ; Read keyboard scancodecmp al, 0x49 ; PgUp checkje .enable_btbcmp al, 0x51 ; PgDn checkje .disable_btbjmp .exit_int9h_hook.enable_btb:; Enable registers map trap mode MASK = 0F, Register = 0xC3, 0x00 = disabled, 0x10 = enabled; We have to enable that to write in the CPU register instead of the chipset registersmov bl,0x0Fmov al,0xC3mov ah,0x10call setRegister_from_hook; Now we disable LOOP_EN and RTSK_ENmov bl,0xFAmov al,0x20mov ah,0x00call setRegister_from_hook; We disabled BWRTmov bl,0xBFmov al,0xC2mov ah,0x00call setRegister_from_hook; We enable BTB_ENmov bl,0xFDmov al,0x20mov ah,0x02call setRegister_from_hook; Enable registers map trap mode MASK = 0F, Register = 0xC3, 0x00 = disabled, 0x10 = enabled; We have to DISABLE that because we are done and put it back to defaultmov bl,0x0Fmov al,0xC3mov ah,0x00call setRegister_from_hookjmp .exit_int9h_hook.disable_btb:; Enable registers map trap mode MASK = 0F, Register = 0xC3, 0x00 = disabled, 0x10 = enabled; We have to enable that to write in the CPU register instead of the chipset registersmov bl,0x0Fmov al,0xC3mov ah,0x10call setRegister_from_hook; We disable BTB_EN
mov bl,0xFDmov al,0x20mov ah,0x00call setRegister_from_hook; Now we enable LOOP_EN and RTSK_ENmov bl,0xFAmov al,0x20mov ah,0x05call setRegister_from_hook; We enable BWRTmov bl,0xBFmov al,0xC2mov ah,0x40call setRegister_from_hook; Enable registers map trap mode MASK = 0F, Register = 0xC3, 0x00 = disabled, 0x10 = enabled; We have to DISABLE that because we are done and put it back to defaultmov bl,0x0Fmov al,0xC3mov ah,0x00call setRegister_from_hook.exit_int9h_hook:pop espop bxpop axstipushfcall far [cs:OldInt9]iret