From WikiTI
Jump to: navigation, search

Working Code

I know this is probably trivial, but I was wondering if someone could please post a simple working example of what this BCALL does (meaning, not exactly a disassembly of the original TIOS code, but an example nonetheless) for those of us who feel BCALLing TIOS routine should be avoided whenever possible. ;^) Saibot84 09:38, 6 November 2006 (PST)

Something like this:
  (on some versions, monkey with port 3A)
  (monkey with port 4)
  (delay a bit)
  in a,(2)
  and 1
  jr nz,BatteryGood
  res 5,(iy+$18)
  jr Done
  set 5,(iy+$18)
  (restore port 4 and/or 3A)
  bit 5,(iy+$18)
The different versions do different things to port 4; I have no idea what this means.
On another note: I think these routines should be split up into separate pages. As it is it's not clear that 50B3 is the one that's documented (and has the official name Chk_Batt_Low) and is thus presumably the one TI recommends programmers use. It also needs to be pointed out that the boot code versions are only available on HW version 2 and above!
FloppusMaximus 14:40, 6 November 2006 (PST)
I may have misunderstood what this BCALL actually does. I was under the impression that it might be possible to find the state of the batteries doing something other than "in a,(2) / and 1". Someone, please correct me if I'm wrong, but wouldn't it be possible (on any z80 calc) to compare the hardware interrupt speed with other things, such as maybe the link speed, the refresh counter, the LCD speed, LCD contrast, and or the Write-to-Flash speed to try to determine the state of the batteries? (such as if one were trying to determine the battery level more specifically than just Good/Bad) Saibot84 15:25, 6 November 2006 (PST)