The OS and the boot code do some interesting things when they start up. Most of it is not understood.
Unknown Port Outputs
Pretty much the entire first 1,000 bytes or so of the boot code falls under this category. TIOS outputs 3 to port $0E and 0 to port $0F during initialization. Leaving this out appears to have no effect. When the LCD is initialized, TIOS outputs $17 to port $10 (LCD Command Port), which sets up Op-amp control (OPA1) to the max, but strangely also sets DBA1. According to the datasheet, it should be using $13 instead, but the LCD does not work if $13 is used instead of $17.
When a battery is pulled and replaced, the boot code is started with the following values:
- When the boot code launches the OS for the first time after a transfer, port 7 reads 0. TIOS uses this to do some additional integrity checks on itself.
When the boot code gives control to the OS, the following values are set:
- SP: $FFC3 when an OS transfer fails, $FFC5 otherwise (tested with boot code 1.02 on a TI-84+ and TI-84+ SE). This a pretty reliable means of discovering if you're starting up after a crash, or of the boot code is launching your OS.