[Real mode] PIT and Keyboard IRQs not firing on laptop
Posted: Mon Aug 08, 2022 7:57 am
Hi all,
I am currently developing a small program purely in 16-bits assembly. This program is a sort of game working with software rendering using video mode 0x13.
I tested it on many emulators : QEMU, Bochs, VirtualBox, VMWare... They all work the same. I event tested it on an old desktop PC with UEFI and CSM for old-style booting, and it works! Until I decided to test it on another physical machine, a Toshiba Satellite L670 laptop.
What I see
The splash screen is displayed correctly. What this means is a lot : Back buffer over the 1 MiB limit works, font loading using int 0x13 works, and segments have all been loaded correctly. Hurray!
Although, after that, I have added a sort of "sleep" call which tells the game to wait for a second. The way this works is by trapping the CPU into a loop with a hlt, and testing the number of remaining frames.
Meanwhile, IRQ0 (the PIT) is triggered 30 times a second and decrements this counter. So, execution blocks until this countdown reaches 0.
But on the laptop I mentioned above, it simply hangs, and I can't figure out why. It doesn't go past the splash screen, even though everything else worked until this point.
What I have tried
- Yes, I have checked if I had set up the IVT correctly, and I did.
- Yes, I did call sti to re-enable interrupts.
- And yes, I am sending EOI at the end of my handlers.
I also tried removing ALL halts and wait calls to jump directly to the game's main loop. I do see the scene, the player's health, everything is as it should be. BUT, the keyboard is not responding. I have tried pressing all the keys I have bound to some action, and they all do nothing.
There are also some moving elements in the scene, which are staying absolutely still, which in turn means that the PIT's interrupt is not being picked up...
This is where I am currently. The bootloader loads the rest of the game fine. The game sets itself up, renders the splash screen, and then hangs on hlt, only on this Toshiba laptop. With all the tests I made, it does seem like my ISRs are not being called. And at this point, I am too afraid to try it on other laptops, as I don't know how they might react.
Any help would be apreciated.
Thanks!
I am currently developing a small program purely in 16-bits assembly. This program is a sort of game working with software rendering using video mode 0x13.
I tested it on many emulators : QEMU, Bochs, VirtualBox, VMWare... They all work the same. I event tested it on an old desktop PC with UEFI and CSM for old-style booting, and it works! Until I decided to test it on another physical machine, a Toshiba Satellite L670 laptop.
What I see
The splash screen is displayed correctly. What this means is a lot : Back buffer over the 1 MiB limit works, font loading using int 0x13 works, and segments have all been loaded correctly. Hurray!
Although, after that, I have added a sort of "sleep" call which tells the game to wait for a second. The way this works is by trapping the CPU into a loop with a hlt, and testing the number of remaining frames.
Meanwhile, IRQ0 (the PIT) is triggered 30 times a second and decrements this counter. So, execution blocks until this countdown reaches 0.
But on the laptop I mentioned above, it simply hangs, and I can't figure out why. It doesn't go past the splash screen, even though everything else worked until this point.
What I have tried
- Yes, I have checked if I had set up the IVT correctly, and I did.
- Yes, I did call sti to re-enable interrupts.
- And yes, I am sending EOI at the end of my handlers.
I also tried removing ALL halts and wait calls to jump directly to the game's main loop. I do see the scene, the player's health, everything is as it should be. BUT, the keyboard is not responding. I have tried pressing all the keys I have bound to some action, and they all do nothing.
There are also some moving elements in the scene, which are staying absolutely still, which in turn means that the PIT's interrupt is not being picked up...
This is where I am currently. The bootloader loads the rest of the game fine. The game sets itself up, renders the splash screen, and then hangs on hlt, only on this Toshiba laptop. With all the tests I made, it does seem like my ISRs are not being called. And at this point, I am too afraid to try it on other laptops, as I don't know how they might react.
Any help would be apreciated.
Thanks!