Close

Mouse Support

A project log for MooseOS

x86 Operating System that runs on QEMU, Bochs and physical PCs.

ethan-zhangEthan Zhang 10/11/2025 at 01:520 Comments

Retroactive Log – July 17th (Reconstructed from memory and commit logs)

Adding mouse support was a big step. It required another interrupt, so I had to refactor my IDT setup. That part wasn’t too hard, and I got a mouse working within a few days.

The real challenge was drawing the cursor. This was similar to the Pong problem: moving the cursor too fast caused MooseOS to lag or even grind to a halt. I implemented a function that only redraws the area where the cursor moves, which helped, but it caused unwanted artifacts at high speeds. This led me to create a function that calculates which areas to erase and restore when the cursor moves.

I also ran into an issue where the mouse masked keyboard interrupts. The problem was that the mouse and keyboard interrupt code ran in separate loops, so updates in one loop could disable the other.

Discussions