Save Point
README.md
gameboy
A Game Boy / Game Boy Color emulator, shipped as one installable package.
Runs actual .gb / .gbc cartridge ROMs: LR35902 CPU interpreter, CGB PPU,
MBC1/3/5 mappers with battery RAM, timers, joypad, and a 4-voice APU. Passes
blargg's cpu_instrs (11/11) and instr_timing accuracy test ROMs.
What installs
gb.module— the machine core.Gb.new(romBytes)→gb:runFrame(); the framebuffer isgb.ppu.fb(160×144×4 RGBA buffer). Submodules:bus,mbc,cpu/cpu_cb,timers,ppu,joypad,apu,display,snapshot. Save states:gb:snapshot()returns the whole machine as a binary string andgb:restore(state)resumes it bit-exactly in a machine built from the same ROM (wrong-cartridge states are rejected).GameBoy.component— drop it on a flat panel entity. Loads the ROM atromPath, steps frames at true hardware speed, blits to the screen texture, maps keyboard input (arrows/WASD = d-pad, Z/J = A, X/K = B, Enter = Start, Right Shift = Select), voices audio through the MIDI synth, and persists battery saves in the world's runtime data. In play mode it also shows a ROM loader window: pick any cartridge in/zero/source/gb_roms/or fetch one by URL.gb_screen_mat.material+gb_screen.texture— the unlit screen surface and the stable texture the emulator blits into. Apply the material to the panel that carries the component.gameboy_core.emulatorCore— the console spec that plugs this machine into theRetroConsolearcade cabinet (fromretro.package): with both packages installed, Game Boy cartridges appear in the cabinet's loader.
Quick start
local id = tools.use("primitives", "cube", "gb_screen", 0, 2, 0)
local e = entity.find("gb_screen")
e.localScale = { 3.2, 2.88, 0.05 }
e.component.get("Model").material = asset.resolve("gb_screen_mat", "material")
e.component.add("GameBoy", { romPath = "/zero/source/gb_roms/your_cart.gbc" })
Put cartridge files under /zero/source/gb_roms/.