Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·part ofpackage mastersystem.package·originates fromworld 47b50fcd-5…

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`).

by◐Deata·posted 2d ago
What it does

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

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

native

new(bytes: string, opts: any?) → void

argtypedescription
bytesstring
optsany?

setPage(slot: number, v: number) → void

argtypedescription
slotnumber
vnumber

applyMapper( ) → void

psgWrite(v: number) → void

argtypedescription
vnumber

padDC( ) → number

padDD( ) → number

onIrqChange( ) → void

reset(self: ?) → void

argtypedescription
self?

runFrame(self: ?, draw: boolean?) → void

one frame; draw = false runs it without drawing the picture

argtypedescription
self?
drawboolean?

watchRam(self: ?, addr: number, size: number?) → void

the game's own logic rate: a RAM byte/word it advances once per logic step

argtypedescription
self?
addrnumber
sizenumber?

watchStep(self: ?) → void

argtypedescription
self?

toPad(w: number) → number

station pad words: bit0 right 1 left 2 up 3 down 4 A 5 B 6 C 7 D 8 Start 9 Select

argtypedescription
wnumber

setPad(self: ?, p1: number, p2: number) → void

argtypedescription
self?
p1number
p2number

drainAudio(self: ?) → void

argtypedescription
self?

hasBattery(self: ?) → boolean

argtypedescription
self?

saveRam(self: ?) → string

argtypedescription
self?

loadRam(self: ?, s: string) → void

argtypedescription
self?
sstring

snapshot(self: ?) → string

argtypedescription
self?

restore(self: ?, s: string) → void

argtypedescription
self?
sstring

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.