implements PLN-0153
This commit is contained in:
@@ -50,13 +50,16 @@ The VM does not own the machine lifecycle. Firmware does.
|
||||
- **Suspended**: an OS-owned scheduler/runtime state. A suspended Game remains
|
||||
resident but does not receive normal gameplay ticks, normal Game input, or
|
||||
frame pacing.
|
||||
- **VM session**: the POS-owned mutable execution context for one VM-backed
|
||||
process. It contains the VM instance and per-session runtime state.
|
||||
|
||||
## 3 POS Responsibilities
|
||||
|
||||
POS is responsible for:
|
||||
|
||||
- deterministic reset into known machine state;
|
||||
- VM initialization and teardown for cartridge execution;
|
||||
- VM session creation, initialization, activation, and teardown for cartridge
|
||||
execution;
|
||||
- input latching and logical-frame budgeting;
|
||||
- peripheral reset/orchestration;
|
||||
- fault capture and crash-flow transition;
|
||||
@@ -68,6 +71,10 @@ At the VM boundary, POS must preserve:
|
||||
- `FRAME_SYNC` as the canonical frame boundary;
|
||||
- deterministic transition from host tick to VM slice execution.
|
||||
|
||||
Firmware must not treat a single global VM object as the canonical execution
|
||||
owner for all cartridges. The firmware state machine orchestrates macro-state;
|
||||
POS/session services own VM-backed process context.
|
||||
|
||||
## 4 PrometeuHub Responsibilities
|
||||
|
||||
PrometeuHub is responsible for:
|
||||
@@ -204,19 +211,31 @@ boundaries. Game audio pauses with the Game VM in v1. Independent background
|
||||
audio, real background execution, multiple resident Games, multiple foreground
|
||||
Shells, and direct Game-to-Game switching are outside this contract.
|
||||
|
||||
The resident Game VM session remains allocated while Hub or Shell is foreground.
|
||||
It preserves Game VM state but is not execution-eligible except for the bounded
|
||||
pause handoff and later foreground resume. A VM-backed Shell has a separate VM
|
||||
session. A native Shell has no VM session.
|
||||
|
||||
## 8 Cartridge Load Flow
|
||||
|
||||
Current high-level flow:
|
||||
|
||||
1. POS receives a cartridge to load;
|
||||
2. asset manager is initialized from the cartridge asset table, preload list, and packed asset bytes;
|
||||
3. POS initializes the VM/runtime for the cartridge;
|
||||
4. launch behavior branches by `AppMode`:
|
||||
3. POS creates or selects the VM session for the cartridge;
|
||||
4. POS initializes the session-owned VM/runtime for the cartridge;
|
||||
5. launch behavior branches by `AppMode`:
|
||||
- `Game` -> transition to the game-running firmware state;
|
||||
- `System` -> create/focus a Hub window and return to the Hub state.
|
||||
|
||||
If VM initialization fails, firmware transitions to the crash path.
|
||||
|
||||
For v1, POS must enforce at most one resident Game session. Selecting the same
|
||||
resident Game from Home resumes that session. Selecting a different Game while a
|
||||
resident Game exists is outside the v1 foreground contract and must not create a
|
||||
second resident Game session. VM-backed Shell loading creates a distinct Shell
|
||||
session and must not overwrite resident Game VM state.
|
||||
|
||||
POS selects the cartridge and its execution context, but the cartridge's initial callable is not chosen by firmware metadata. Execution starts from the cartridge boot protocol defined in [`13-cartridge.md`](13-cartridge.md), currently `func_id = 0`.
|
||||
|
||||
When Home launches a discovered Game entry, the request is a system-owned action
|
||||
@@ -239,6 +258,7 @@ The current firmware state model includes:
|
||||
- `HubHome`
|
||||
- `LoadCartridge`
|
||||
- `GameRunning`
|
||||
- `ShellRunning`
|
||||
- `AppCrashes`
|
||||
|
||||
These states express machine orchestration above the VM. They are not guest-visible bytecode states.
|
||||
@@ -286,6 +306,8 @@ Expected behavior:
|
||||
- Home remains foreground while the Game is resident;
|
||||
- launching and closing a Shell app returns to Home without losing the resident
|
||||
Game;
|
||||
- a VM-backed Shell advances its own VM session and does not tick the suspended
|
||||
resident Game session;
|
||||
- returning to the same Game resumes it through the foreground lifecycle and
|
||||
waits for current-epoch Game rendering before visual Game presentation.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user