Difference between revisions of "83Plus:OS:How BCALLs work"

From WikiTI
Jump to: navigation, search
(link to page1b info)
m (Cleaned up the wording a bit)
Line 2: Line 2:
 
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.
 
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.
+
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:
 
If the first bit (bit 15) of the number is set, this is what the OS does:
Line 18: Line 18:
 
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.
 
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.
+
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.
  
  

Revision as of 13:51, 1 September 2006

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