83Plus:OS:How BCALLs work

From WikiTI
Revision as of 01:03, 10 September 2005 by 84plusfreak (Talk | contribs)

Jump to: navigation, search

Sorry, this article isn't very well written. It would be good if someone else could maybe look at the TI-OS code a bit and explain this better.

BCALLs are the way to call TI-OS ROM routines, and also the way that the branch table works in multi-page apps. A BCALL is the RST 28h instruction, with a 16-bit number after it which is used to identify which routine it is calling.

If the first bit (bit 15) of the number is set, this is what the OS does:

  • It resets bit 15
  • It adds 0x4000 to the number
  • It maps page 1F/3F/7F* into memory space 4000-7FFF

Otherwise, if bit 15 is reset and bit 14 is set, this is what the OS does:

  • It resets bit 14
  • It adds 0x4000 to the number
  • It maps page 1B/3B/7B** into memory space 4000-7FFF

Otherwise, if bit 15 and 14 are both reset, it is treated as a multipage app branch, which is explained in the TI developer's guide.

Once the OS has mapped the appropriate page into 4000-7FFF, it uses the number in memory as a pointer into this page. In page 1B and 1F there are lists of vectors for the actual ROM routines. The vectors are 3 bytes, the first two bytes are a memory address and the next byte is the page that the routine is on.


*1F for the TI-83 Plus, 3F for the TI-84 Plus and 7F for the TI-83 Plus Silver Edition & the TI-84 Plus Silver Edition.
**1B for the TI-83 Plus, 3B for the TI-84 Plus and 7B for the TI-83 Plus Silver Edition & the TI-84 Plus Silver Edition.