gbrom.assetType
- README.md2.1 KB
- about.yaml798 B
- behavior.luau2.4 KB
- template
- type.yaml424 B
README.md
gbrom (asset type)
A Game Boy cartridge project as one asset. Everything a cartridge is — its title, its build inputs, and the ROM it produces — lives in one folder, so a new game is a new instance of this type.
Instance shape
<name>.gbrom/
game.luau the project — required
README.md what the game is — required
game.gb the built cartridge — written by :build()
game.luau returns a project table:
return {
title = "MY GAME", -- cartridge title (up to 15 characters, uppercased)
cgb = false, -- true / "only" for a Color cartridge, false for DMG
-- one of these two:
source = [[ -- SM83 assembly, assembled by gbdev.gbasm
.org $0150
start:
di
ld sp,$fffe
halt
]],
}
or, when the project is generated by code — art built as tiles, maps emitted
from tables, a whole toolchain — build instead:
return {
title = "MOTH LIGHT",
cgb = false,
build = function()
return require("gbdev.mothlight").build() -- returns ROM bytes
end,
}
Methods on every instance
| Method | Does |
|---|---|
:project(reload?) | loads and caches the project table from game.luau |
:build() | assembles the project and writes game.gb beside it; returns the ROM |
:romPath() | builds if game.gb is missing, then answers that path |
Using one
Point a GameBoy component's romPath at the built cartridge:
local cart = asset.resolve("mothlight", "gbrom")
cart:build()
screen.component.get("GameBoy").romPath = cart:romPath()
Or hand the path straight to the gameboy package's loader UI, which lists every
cartridge under gb_roms/ — copy the built game.gb there under any name.
Notes
- Builds are deterministic: the same
game.luauproduces the same bytes, so a rebuild is safe to run every time the project is edited. - The assembler, cartridge header, checksums and mapper byte live in
gbdev.gbasm; this type only decides where the project is and where the ROM lands.