feat: playable snake game via UART terminal rendering

Snake renders using ANSI escape codes via debug_putchar syscall,
bypassing the VirtIO GPU (which has a QEMU 11.x legacy MMIO bug
where transfer_to_host_2d succeeds but doesn't transfer data).

Full microkernel stack running end-to-end:
  adapter → init → storage-server IPC → load snake from disk →
  input-server IPC (UART keyboard) → snake game logic →
  debug_putchar syscall → UART → terminal display

Controls: WASD to steer, runs at 0.2s tick rate.
Green O=head, o=body, red @=food, #=border.
This commit is contained in:
2026-10-18 22:08:52 +02:00
parent 27be73f42d
commit a3b15e5264
6 changed files with 117 additions and 191 deletions

View File

@@ -165,10 +165,10 @@ pub fn run(shared_buf_va: usize) -> ! {
debug_print(b")\n");
}
// Load snake — give it display endpoint (slot 0) and input endpoint (slot 1)
// Load snake — give it input endpoint (slot 0) for keyboard input
// Snake renders via debug_putchar (UART) — no display endpoint needed
debug_print(b"init: loading snake... ");
if let Some(snake) = load_binary(shared_buf, b"snake.elf") {
syscall::delegate(display_ep(), snake.process_cap, ipc_perms);
syscall::delegate(input_ep(), snake.process_cap, ipc_perms);
syscall::spawn_thread_in(snake.process_cap, snake.entry_point, USER_STACK_TOP);
debug_print(b"ok\n");