Kernel (src/kernel.c)
What kernel_main() Does
kernel_main() is the orchestrator of NoirOS runtime behavior.
Startup Sequence
- Initialize serial, memory, IDT, input, mouse, and filesystem.
- Compute UI layout.
- Show boot loader splash.
- Draw the main desktop UI.
Main Event Loop
- Reads keyboard input (
read_key()). - Handles global browser hotkeys (
Tab,c/C,Esc). - Routes to module-specific handlers based on current mode:
- Browser mode ->
shell_loop(...) - Editor mode ->
editor_handle_key(...) - Game mode -> snake update/draw + restart/exit handling
- Browser mode ->
Game Timing
- Snake uses a tick counter (
game_timer) andgame_speedthreshold. - Rendering is flushed regularly through VGA backbuffer logic.
Debug Support
- Optional input debug overlay displays last scancode/key.
- Debug info is mirrored to serial output for headless troubleshooting.
Mode Model
MODE_BROWSER: file browser + command panel accessMODE_EDITOR: text editing sessionMODE_GAME: snake runtime loop
The kernel returns to browser mode on mode exit or Esc paths.
Source: kernel.c on GitHub