84PCSE:BCALLs:5509

From WikiTI
Revision as of 20:03, 31 August 2013 by Dr. D'nar (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Synopsis

Unofficial Name: GetBatteryLevel

BCALL Address: 5509h

Measures the current battery level by writing and reading several ports and using lots of delay loops.

Inputs

None.

Outputs

  • A = 0 if the battery is fully dead. Do a hard power off fast or you risk damaging the lithium battery.
  • A = 4 if the battery is fully charged, or at least about 70 or 80 percent charged.
  • A = 1-3 for intermediate charge levels.

Destroys

  • AF, BC

Comments

There isn't any particular code in here to test whether the battery is currently charging as far as I can tell. Contains a delay loop that overwrites 9F02h. Screws with IY+16h. Uses ports 3A and 04.