Expand description
The arithmetic of the game’s own stack (crate::device).
The device gives the C stack about 10 KB, and a game’s load or search can
go deeper. So the backend runs the game on a block from the heap, filled
with PAINT first. A stack grows down from its top, so the painted bytes
left at the bottom say how deep it ever went (high_water).
Constants§
- DEFAULT_
BYTES - The game’s stack unless its
main!says otherwise, in bytes. The first game on the backend measured 15,256 bytes at its deepest, in its load. - PAINT
- The byte the stack is filled with before the game first runs on it.
- RED_
ZONE - The bottom bytes of the stack that count as an overflow once used: the game has gone, or is about to go, past its stack.
Functions§
- high_
water - The bytes ever used of a stack of
sizebytes, given itsbyteslowest address first: everything above the painted bytes at its bottom. - overflowed
- Whether a stack, given its
byteslowest address first, has been used into itsRED_ZONE. It reads that zone alone, so it can run every frame. - run
- Runs
fthroughswitch, which moves to the stack, makes the call it is handed and comes back. A call made whileinsidesays the game is on the stack already is a plain one, so it doesn’t start again from the top. - top
- The starting stack pointer for a stack of
sizebytes atbase: its top, rounded down to 8 bytes as the ARM procedure call standard asks.