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

homebrew

The HuC6280 runtime every shelf HuCard in `pcengine.package` is built on, the Luau helpers that turn pixel art, palettes, waveforms and note strings into cart data, and `build()`, which assembles the package's original games (CC0 1.0) into `/zero/source/pcengine_roms`. Called by…

by◐Deata·posted 2d ago
What it does

pcengine.homebrew

The HuC6280 runtime every shelf HuCard in pcengine.package is built on, the Luau helpers that turn pixel art, palettes, waveforms and note strings into cart data, and build(), which assembles the package's original games (CC0 1.0) into /zero/source/pcengine_roms. Called by hand when a game changes, and by the package tests.

  • Runtime (bank 0, $E000): boot (MMU, RAM/VRAM clear, VDC/VCE/PSG init), IRQ1 handler with a raster-split table (splitTab: line, BXR, BYR per split, applied by RCR interrupts) and vblank work (sprite table upload + SATB DMA, top-segment scroll, music), multitap reader for two pads, VRAM/palette block transfers, text and BCD printing, RNG, a 3-voice wavetable music driver with a drum track (noise hats; sampled DDA kick + snare streamed at 6.99 kHz by the timer interrupt once a game calls ddaInit), tone and noise sound effects.
  • Helpers: H.tile, H.sprite, H.spriteCells, H.rgb/H.hex, H.fontTiles, H.trackAsm("C4:8 E4:8 | G4:16"), H.drumsAsm, H.waveAsm, H.sineAsm, H.assemble(src, {dotclock, width}).
  • Games: nebula.luau (Nebula Storm), tanks.luau (Tank Duel).
local H = require("pcengine.homebrew")
H.build()          -- writes every .pce into /zero/source/pcengine_roms

Interface

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

conforms to

zero/source-extract/v2

strict

pix(ch: string) → number

argtypedescription
chstring

tile(rows: { string }) → void

8 rows of 8 pixels ("0-F", "." = 0) -> the 16 words of a PC Engine BG tile

argtypedescription
rows{ string }

sprite(rows: { string }) → void

16 rows of 16 pixels -> the 64 words of a sprite cell (4 planes x 16 rows)

argtypedescription
rows{ string }

spriteCells(rows: { string }) → void

a big picture (rows of equal length, multiples of 16) cut into 16x16 cells, left to right then top to bottom (32-wide sprites: pairs; 32 tall: rows of pairs)

argtypedescription
rows{ string }

rgb(r: number, g: number, b: number) → number

colour 0-7 per component -> the VCE's 9-bit GRB

argtypedescription
rnumber
gnumber
bnumber

hex(s: string) → number

"#rrggbb" -> 9-bit

argtypedescription
sstring

wordsAsm(label: string, words: { number }) → string

words as assembler data (16 per line)

argtypedescription
labelstring
words{ number }

bytesAsm(label: string, bytes: { number }) → string

argtypedescription
labelstring
bytes{ number }

blockAsm(label: string, list: { { number } }) → string

a list of tiles (each 16 words) / cells (64 words) as one data block

argtypedescription
labelstring
list{ { number } }

paletteAsm(label: string, cols: { number }) → string

16 colours (9-bit) of one palette, padded with 0

argtypedescription
labelstring
cols{ number }

fontTiles(fg: number, sh: number, fg2: number?) → void

64 tiles for ASCII 32..95: glyph in colour `fg` (top rows `fg2` when given) with a drop shadow in `sh`; colour 0 behind (transparent)

argtypedescription
fgnumber
shnumber
fg2number?

noteIndex(name: string) → number

argtypedescription
namestring

noteTableAsm( ) → string

trackAsm(label: string, text: string) → string

"C4:8 E4:8 R:4 | loop" -> [note, frames] pairs; a "|" marks the loop point (the track jumps back there at its end), no "|" loops from the start

argtypedescription
labelstring
textstring

drumsAsm(label: string, text: string) → string

drum track: "K:8 H:4 S:8 -:4" (K kick, S snare, H hat, - rest)

argtypedescription
labelstring
textstring

waveAsm(label: string, f: (number) → void

a 32-step 5-bit waveform from a function of phase 0..1 (-1..1)

argtypedescription
labelstring
f(number

sineAsm(label: string, n: number, centre: number, amp: number) → string

n bytes of a sine: centre + amp * sin

argtypedescription
labelstring
nnumber
centrenumber
ampnumber

drumSamplesAsm( ) → string

the runtime's sampled drums: kick and snare synthesized as 5-bit DDA at the timer's rate (7.16 MHz / 1024 = 6991 Hz); kinds 0 and 3 have none

render(n: number, f: (number) → void

argtypedescription
nnumber
f(number

noise( ) → number

assemble(src: string, opts: any?) → void

assemble a game: `src` holds the game's code (bank 1, $C000) and data (banks 2-5, $4000-$BFFF) and defines main, vbl_hook, sfxTable and fontTiles; opts.dotclock 0/1/2, opts.width 256/336/512, opts.fontPal

argtypedescription
srcstring
optsany?

buildGame(name: string) → string

argtypedescription
namestring

build(write: boolean?) → void

assemble every game; write = false only returns their sizes

argtypedescription
writeboolean?

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.