Commit bb124e

2026-06-02 12:56:47 Bob Green: -/-
programming/runtime.md ..
@@ 14,11 14,12 @@
```
You can use this option as many times as needed.
- ## Heap
+ ## In Detail
+ ### Heap
`crt0` allocates all free memory from the end of the .bss area to the end of ram to the heap (malloc/free).
- ## Global Variables
+ ### Global Variables
crt0 sets the following global variables:
**uint8_t cpu_speed_mhz**. This uses the counter in the PI/T to figure out roughly how fast the CPU is being clocked at. Within a MHz or so.
@@ 27,5 28,12 @@
**uint8_t running_in_rom**. When non-zero, indicates that the code is running in ROM. 0 indicates it's running in RAM.
-
To access any of these variables, simply ```#include <machine.h.>```
+
+ ### On Exit
+ When `main()` returns or when `exit()` is called, a non-zero exit code will be printed as follows:
+ ```
+ exited with status: <value>
+ ```
+ No message is printed if the exit code was zero.
+ Control will then be passed back to the monitor
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9