A walkthrough of how KnightOS implements preemptive multitasking on z80-based TI calculators using a simple round-robin scheduler. Covers the fundamentals of context switching via interrupt handlers, how the kernel manipulates the stack pointer and program counter to switch between processes, and the design goals of keeping context switches short while supporting suspended and background processes. Includes links to the actual assembly source code.
Sort: