| ||||
| ||||
![]() Title:An Algorithmically-Decoded Game Boy Emulator with Concurrent Lua Instrumentation Conference:SYNASC 2026 Tags:barrier synchronization, concurrency, deterministic execution, dynamic instrumentation, Game Boy emulation, instruction decoding, interpreter dispatch, Lua scripting, software testing and timing analysis Abstract: This paper studies two techniques for building a fast, instrumentable instruction-set interpreter, using a Nintendo Game Boy emulator (Mithril, written in Zig) as the testbed. First, we exploit the regular octal bitfield structure (x, y, z, p, q) of the Sharp LR35902/Zilog Z80 opcode space to replace a hand-enumerated switch dispatcher of more than 500 arms with a compact, parameterized decoder. In a same-codebase controlled benchmark over 50 million iterations, the algorithmic decoder runs at 10.77 ns/op (92.7 Mops/s) against the dispatcher’s 18.75 ns/op (53.3 Mops/s), a 1.74× improvement; we attribute a structurally certain share to an eliminated metadata-materialization-and-double-dispatch stage and advance the remaining micro-architectural effects as hypotheses rather than measured facts. Second, we present a concurrent, blocked-by-default Lua instrumentation engine that dispatches hook callbacks to a host thread pool while suspending the emulation thread at the exact instruction boundary where a hook fires, via an atomic barrier and condition-variable protocol. We describe the protocol formally and argue, on classical monitor/happens-before grounds, that it yields deterministic, race-free state inspection and patching without degrading host frame rates. Correctness is validated against the Blargg CPU test suite, the dmg-acid2 PPU test, and Game Boy Doctor register-parity auditing; the source and benchmark are publicly available. An Algorithmically-Decoded Game Boy Emulator with Concurrent Lua Instrumentation ![]() An Algorithmically-Decoded Game Boy Emulator with Concurrent Lua Instrumentation | ||||
| Copyright © 2002 – 2026 EasyChair |
