From 170b35d8122b199988803ba6a5f594fa882afdc8 Mon Sep 17 00:00:00 2001 From: Cyd Date: Wed, 15 Jul 2026 18:05:13 -0500 Subject: [PATCH] emu_main: IGC drain-wait completion is NONZERO status, not zero (per-page done flag; loop exits when [page]!=0) Co-Authored-By: Claude Opus 4.8 --- emulator/firmware-decomp/emu_main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/emulator/firmware-decomp/emu_main.py b/emulator/firmware-decomp/emu_main.py index e8cf56a..007ee90 100644 --- a/emulator/firmware-decomp/emu_main.py +++ b/emulator/firmware-decomp/emu_main.py @@ -111,9 +111,10 @@ class MainRunner: self.heap = [0x08010000, 0x0c010000] # bump allocator over the DRAM banks def h_igcwait(self, cpu): - # Post-flush drain wait: the firmware polls [r16] until the IGC clears - # it after consuming the region queue. We are the IGC: consume instantly. - cpu.mem.w32(cpu.rd(16), 0) + # Post-flush drain wait: the firmware polls [page] until the IGC writes a + # NONZERO completion status after consuming it (loop at 0xf0421504: exits + # the per-page wait when [r16] != 0). We are the IGC: complete instantly. + cpu.mem.w32(cpu.rd(16), 1) cpu.step() return True