Skip to content

Lab 2 Check

Run the focused timer tests before trying to use the timer from a larger program. They verify the controller-facing pieces directly: divisor arithmetic, status reads, interrupt subscription, and tick accounting. Then run a small headless example to confirm that the timer behaves correctly in an application loop.

sh
machinelab test timer
machinelab run --headless -- build/examples/timer_int 3

Discussion Prompts

When discussing the result, focus on policy. Why does the timer API expose timer_ticks() instead of sleeping directly? What changes if your game updates at 60 Hz but the timer fires faster? Which timing values should be constants, and which ones should be configurable by a final project?

External Reading

The LCOM chapters on the timer controller, interrupts, and timer libraries are good companion readings. For broader background, review the OSDev pages on the Programmable Interval Timer and interrupts. The GNU C notes on integer types are useful when divisor arithmetic behaves unexpectedly.

Course/docs licensed CC BY 4.0. Code licensed MIT.