![]() |
CHGame 0.3.0
Libraries for the CHGame handheld
|
The serial debug protocol (CHGAME_DEBUG builds only; see chgame/Config.h). More...
Go to the source code of this file.
Namespaces | |
| namespace | dbg |
| The serial debug protocol. | |
Functions | |
| void | dbg::begin (const char *hello) |
Start the protocol: at the top of setup(). | |
| void | dbg::poll () |
Read and answer commands: at the top of loop(), before nextFrame(). | |
| void | dbg::markUpdateStart () |
Frame timing for P: call when the logic tick starts. | |
| void | dbg::markRenderStart () |
Frame timing for P: call when drawing starts. | |
| void | dbg::markRenderEnd () |
Frame timing for P: call when drawing ends (before the flush). | |
| void | dbg::print (const char *s) |
| Send text to the host as it is (no newline added). | |
| void | dbg::waitInput () |
| In the simulator, block until input may have arrived (elsewhere nothing). | |
| uint32_t | dbg::parseNum (const char *&p, uint8_t base) |
| Parse a number from a command's arguments, for a game's hook. | |
| void | dbg::holdInto (bool(*busy)(char cmd), char *buf) |
| Hold the game's commands while it is busy, in a caller's buffer. | |
| void | dbg::holdWhile (bool(*busy)(char cmd)) |
| holdInto() with a buffer of its own (which exists only in a game that calls this). | |
| void | dbg::frameStack (uint32_t *lo, uint32_t *hi) |
Report a second stack's high-water mark in P (fstk=): frames drawn from inside a search, for instance. | |
| void | dbg::profStart () |
Start a profiled frame (CHGAME_PROFILE builds): T reports averages per call. | |
| void | dbg::prof (uint8_t slot) |
| Charge the time since the previous prof() to a slot. | |
Variables | |
| bool(* | dbg::hook )(char cmd, const char *args) |
| The game's own commands, or nullptr. | |
| static const uint8_t | dbg::LINE = 100 |
| The longest command line, in characters. | |
The serial debug protocol (CHGAME_DEBUG builds only; see chgame/Config.h).
Line-based ASCII over the USB CDC port, or the simulator's pipe. The simulator, tools/chsim/chdrive.py and tools/device.py run scripts through it, on the PC and on the board alike.
In a release build every call here is an empty inline, so a sketch calls them without #if.