CHGame 0.3.0
Libraries for the CHGame handheld
Loading...
Searching...
No Matches
Debug protocol

dbg::: the serial protocol the simulator and the PC tools drive a game through. More...

Namespaces

namespace  dbg
 The serial debug protocol.
 

Detailed Description

dbg::: the serial protocol the simulator and the PC tools drive a game through.

A game calls dbg::begin() at the top of setup() and dbg::poll() at the top of loop(); the rest is optional. With CHGAME_DEBUG off (a release build) every call is an empty inline that costs nothing.

Command Answer / effect
? the game's hello line, e.g. CHCR 0.1
S FB <frame> 8224 and a newline, then 8192 framebuffer + 32 palette bytes
K <hex> hold these buttons (ORed with the real ones); K alone releases
L1 / L0 lockstep on / off (on: the game only advances on N)
N <k> run k frames, then answer OK <frame>
P PERF rnd=<us> max=<us> late=<n> frames=<n> stk=<b> (+ fstk=<b> with a second frame stack, + host ns in the sim)
T PROF <slot>=<us> ... section timings (CHGAME_PROFILE)
B reboot into the CHGame bootloader
! FAULT none, or the crash before the last restart (the core's fault handler: A restarts after one) as FAULT mcause=<hex> mepc=<hex> mtval=<hex> ra=<hex> sp=<hex>
Q (simulator) CAL <ns> x5: host time of CHGfx's benchmark primitives, for estimated device times (chdrive's cal)
anything else goes to the game's hook: OK if it took it, else ERR