Currently the core files make use of the Watchdog timer's scratch register, to store and transfer data between soft-resets.
This allows `menu.py` to launch a game by soft-reseting back to `main.py` with a True `1` flag set in the first scratch register (0), address `0x40058000+0x0C`.
(More info:
https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf - Section 4.7.6)
My proposal:
I'd like to store 3 other settings in this semi-persistent storage:
`0x40058010` (scratch1) - Hardware ID / HWID (0–15)
`0x40058014` (scratch2) - Brightness level (1–127)
`0x40058018` (scratch3) - Intro /skip scrolling indicator (0,1)
Although these values require less than a byte each, I don't feel it's worth the code overhead to pack them into one 4 byte long register, since we have 8 registers available in total. Update: Cannot use `mem8()` to address each of the four bytes separately, as byte access is aligned to the start address block AFAIK (tested 28-Dec).
Motivation:
- We only need to evaluate the HWID once per session (on hard reset), not on every soft-reset (faster load times).
- We only need to read Contrast once and on change (faster load times).
- Additionally, I'd like to add a 'fast boot' option that skips scrolling and uses the 'scroll indicator', after the first boot.
Would welcome any feedback from TC staff (@Jason) and the community...?
Note: I'm posting here (vs Discord) for visibility and future search/ knowledge repository.