83Plus:OS:How BCALLs work

From WikiTI
Revision as of 14:51, 1 September 2006 by Burntfuse (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, followed by a 16-bit number which is used to identify the 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 as a pointer to a vector on this page. On pages 1B and 1F there are lists of vectors for the actual ROM routines. Each vector is 3 bytes - the first two bytes are a memory address and the third 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.

See Also