mastersystem.package
README.md
mastersystem.machine
The Sega Master System / Game Gear / SG-1000 machine (NTSC) as Luau: Z80
(neogeo.machine.z80), the SMS VDP (vdp.luau), SN76489 (megadrive.psg),
cart loader and mappers (cart.luau), I/O and the line scheduler (init.luau).
local Sms = require("mastersystem.machine")
local m = Sms.new(cartBytes, { gg = false }) -- .sms/.gg/.sg or a zip of one
m:runFrame(true) -- one 59.92 Hz frame (262 lines x 228 T-states)
m.vdp.fb -- 256*192*4 RGBA8 (160*144 on a Game Gear)
m:setPad(p1, p2) -- station pad words: d-pad, A = button 1, B = button 2, Start = Pause / GG Start
m:drainAudio() -- (buffer, frames) 44.1 kHz stereo f32
m:saveRam() / m:loadRam(s) -- cartridge battery RAM
m:snapshot() / m:restore(s) -- save states
m:watchRam(addr) -- count a game's own logic-step counter