83Plus:Ports:02
From WikiTI
Contents
Synopsis
Port Number: 02h
Function: Calculator Status Information
This port reports various status information, including battery strength, LCD driver status, and calculator type.
Read Values
- Bit 0: Set if the batteries are good. Reset if the batteries are low. The calculator will refuse to Garbage Collect or receive a FLASH App or OS when the batteries are low.
- Bit 1: Set if the LCD Driver can receive a command. Reset otherwise. This is basically the inverse of bit 7 from Port 10h.
- Bit 5: Set for TI-84+ and TI-84+ SE calculators. Reset for TI-83+ and TI-83+ SE calculators.
- Bit 7: Reset for a TI-83+ Basic. Set for everything else.
Write Values
- No useful effect.
Comments
See Port 21h for how to distinguish the 84+ Basic from the 84+ SE.
Example
Battery checking
push af in a, (2) and 01h call nz, BatteriesGood call z, BatteriesLow pop af
LCD Testing
push af WaitLoop: in a, (2) and 02h jr z, WaitLoop ;Send a command, like 03 (LCD "On"). call LCDIsReady pop af
Device checking
This example also uses Port 21h.
in a, (2) rlca ;Roll bit 7 into carry. jp c, Regular83Plus rlca rlca ;Roll bit 5 into carry. jp nc, Silver83Plus in a, (21h) and 01h jp z, Regular84Plus jp nz, Silver84Plus
Credits and Contributions
- Michael Vincent: Documentation of port 2 located here.