3.9 KiB
Cartridges
Domain: cartridge package Function: normative
This chapter defines the cartridge contract consumed by the current runtime.
1 Scope
A cartridge is the distributable unit loaded by firmware/runtime.
In the current implementation, the supported dev/runtime form is a directory containing:
manifest.jsonprogram.pbx- optional
assets.pa
The loader also recognizes .pmc as a future packaged form, but packaged cartridge loading is not implemented yet.
2 Cartridge Metadata
The runtime currently expects the following manifest fields:
{
"magic": "PMTU",
"cartridge_version": 1,
"app_id": 1234,
"title": "My Game",
"app_version": "1.0.0",
"app_mode": "Game",
"entrypoint": "main"
}
Additional manifest-supported fields include:
capabilities
3 Required Fields
Current required manifest fields:
magiccartridge_versionapp_idtitleapp_versionapp_modeentrypoint
Current required file payloads:
program.pbx
Optional file payloads:
assets.pa
4 Runtime Validation Rules
The current loader validates:
magic == "PMTU"cartridge_version == 1- manifest parse validity
- capability normalization
- presence of
program.pbx - when
Assetcapability is declared, presence of validassets.pabefore asset bootstrap
If validation fails, cartridge loading is rejected before execution.
5 App Mode and Entrypoint
app_mode controls firmware launch behavior:
GameSystem
entrypoint is passed to the VM initialization flow and may be resolved as a symbol or function identifier according to the VM/runtime contract.
6 Assets and Preload
assets.pa is the runtime-facing asset artifact consumed by the current runtime.
assets.pa v1 is an autocontained binary with:
- fixed binary prelude;
- JSON header;
- binary payload region.
The fixed prelude includes, at minimum:
magicschema_versionheader_lenpayload_offset
It may additionally include:
flagsreservedheader_checksum
The JSON header carries:
asset_tablepreload
asset_table and preload are therefore no longer the primary runtime contract of manifest.json.
preload is structurally validated as part of assets.pa bootstrap:
- each preload entry is
{ asset_id, slot }; asset_iduses 32-bit signed integer semantics;- each
preload.asset_idmust resolve to an entry in the sameasset_table; - no two preload entries may claim the same
(bank_type, slot)pair oncebank_typeis resolved fromasset_table.
Runtime lifecycle:
asset_tableis loaded fromassets.paand remains live while the cartridge is running;preloadis loaded fromassets.pa, consumed during cartridge initialization, and may be discarded after boot;- payload bytes are resolved from the payload region using offsets relative to
payload_offset.
Runtime loading policy:
- cartridges without
assets.paremain valid whenAssetcapability is not declared; - cartridges that declare
Assetcapability must provide validassets.pa; assets.pawith invalid preload references or preload slot clashes is structurally invalid;- failure must occur as early as cartridge bootstrap, before preload execution.
7 Runtime Forms
Directory form
This is the working runtime/dev form used by the current loader.
Packaged .pmc form
This form is recognized conceptually by the loader boundary, but its actual load path is not implemented yet.
The cartridge spec therefore distinguishes:
- supported current load form;
- reserved future distribution form.
8 Relationship to Other Specs
12-firmware-pos-and-prometeuhub.mddefines how firmware consumes cartridge metadata.14-boot-profiles.mddefines cartridge selection at boot.15-asset-management.mddefines theassets.paenvelope, asset table semantics, preload lifecycle, and residency semantics.