VERTEX

STATIC TRACEfactorial.stnSTORN → VTX → ROM
SOURCEfactorial.stn17 lines
selectable constructClick source or assembly
LOWERING INSPECTORRECURSIVE CALL · STACK CONTRACT04 / 06
SELECTED CONSTRUCT

!factorial(n - 1:8)

[8] → [8]

Before CAL, the caller reserves a return byte and pushes the evaluated argument. The callee sees n at BP + 4; after return, the argument is discarded and the result remains.

COMPILER DECISIONS
  1. Reserve one byte because factorial returns [8].
  2. Evaluate arguments in reverse parameter order.
  3. CAL adds the two-byte return address; the callee adds saved BP.
STACK FRAMEhigh address ↑
return slot1 byte · caller allocatednBP + 4 · [8]return PC2 bytes · pushed by CALsaved BP2 byteslocalsSP moves downwardBPSP
ASSEMBLER OUTPUTfactorial.vtxselected emission
ENCODINGopcodeoperand / address
4821015E74017F7E057686FEF4

Labels are collected first, then replaced with final 16-bit addresses once the program is placed at the top of 64 KiB RAM.

github.com/CameronLCrawford/vertex ↗