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

From WikiTI
Jump to: navigation, search
m (Cleaned up the wording a bit)
(Added speed information. It belongs SOMEWHERE.)
Line 19: Line 19:
  
 
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.
 
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.
 
 
  
 
<nowiki>*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.</nowiki><br>
 
<nowiki>*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.</nowiki><br>
 
<nowiki>**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.</nowiki>
 
<nowiki>**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.</nowiki>
 +
 +
 +
 +
FloppusMaximus provided the following table on UnitedTI, having worked it out out of bordem:
 +
                        T-states taken to perform a B_CALL to...
 +
Platform                  App      Page 0  Other OS    Boot
 +
--------------------------------------------------------------
 +
TI-83+, OS 1.12            570        541      542      532
 +
TI-83+, OS 1.18            879        819      820      810
 +
TI-83+ SE, OS 1.18      875/880(*)    815      816      806
 +
TI-84+, OS 2.41        1261/1248(**)  1045      1046      1036
 +
TI-84+ SE, OS 2.41    1257/1244(**)  1041      1042      1032
 +
(*) Slightly faster if the app is located in the first 32 pages of
 +
    Flash.
 +
(**) Slightly faster if interrupts are disabled.
  
 
== See Also ==
 
== See Also ==
 
* [[83Plus:OS:ROMPage1B|ROM Page 1B]]
 
* [[83Plus:OS:ROMPage1B|ROM Page 1B]]

Revision as of 13:20, 27 June 2009

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.


FloppusMaximus provided the following table on UnitedTI, having worked it out out of bordem:

                        T-states taken to perform a B_CALL to...
Platform                   App       Page 0   Other OS    Boot
--------------------------------------------------------------
TI-83+, OS 1.12            570         541       542       532
TI-83+, OS 1.18            879         819       820       810
TI-83+ SE, OS 1.18      875/880(*)     815       816       806
TI-84+, OS 2.41        1261/1248(**)  1045      1046      1036
TI-84+ SE, OS 2.41     1257/1244(**)  1041      1042      1032
(*) Slightly faster if the app is located in the first 32 pages of
    Flash.
(**) Slightly faster if interrupts are disabled.

See Also