Difference between revisions of "83Plus:BCALLs:4027"

From WikiTI
Jump to: navigation, search
m (formatting and punctuation)
(more info)
Line 9: Line 9:
 
'''BCALL Address:''' 4027
 
'''BCALL Address:''' 4027
  
Use "BJUMP", not "BCALL".
+
Exits the current application and returns to the homescreen.
 
+
Exits App and returns to OS.
+
  
 
=== Inputs ===
 
=== Inputs ===
Line 21: Line 19:
  
 
== Comments ==
 
== Comments ==
This is the proper way to exit an app
+
This routine is the standard way of exiting a Flash Application.  (Although there are other ways, in practice this is the only one you'll ever need.  Note that simply returning with the 'ret' statement does not work.)  In contrast, normal RAM assembly programs should '''never''' use this routine.  (In the middle somewhere are scripts and hooks; don't use this routine in a hook or script unless you really know what you're doing.)
 +
 
 +
TI suggests that this routine be called using B_JUMP rather than B_CALL.  In fact it doesn't matter; either way this routine never returns (and of course, using B_CALL saves you two bytes.)  This routine will reset the hardware stack, FPS, and OPS to their default states, so you can call it at any point in the middle of your app.
 +
 
 +
Note that this routine (like most OS routines that switch from one app to another) will call the current [[83Plus:RAM:858F|cxPPutAway]] routine, followed by the current [[83Plus:RAM:8591|cxPutAway]] routine.  If you install your own PutAway routine, it should do something like the following in order to call the standard cleanup code:
 +
 
 +
AppPutAway:
 +
    ; clean up temporary memory allocations, flags, etc.
 +
    B_CALL [[83Plus:BCALLs:4C36|ReloadAppEntryVecs]]
 +
    B_JUMP [[83Plus:BCALLs:403C|PutAway]]
 +
 
 +
(Note that PutAway, unlike JForceCmdNoChar, does need to be jumped to -- a B_CALL would not work in this case.)
  
 
== Example ==
 
== Example ==
 
  BJUMP JForceCmdNoChar
 
  BJUMP JForceCmdNoChar

Revision as of 22:14, 18 April 2008


Synopsis

Official Name: JForceCmdNoChar

BCALL Address: 4027

Exits the current application and returns to the homescreen.

Inputs

  • None

Outputs

  • None

Destroys

  • All (but it doesn't matter)

Comments

This routine is the standard way of exiting a Flash Application. (Although there are other ways, in practice this is the only one you'll ever need. Note that simply returning with the 'ret' statement does not work.) In contrast, normal RAM assembly programs should never use this routine. (In the middle somewhere are scripts and hooks; don't use this routine in a hook or script unless you really know what you're doing.)

TI suggests that this routine be called using B_JUMP rather than B_CALL. In fact it doesn't matter; either way this routine never returns (and of course, using B_CALL saves you two bytes.) This routine will reset the hardware stack, FPS, and OPS to their default states, so you can call it at any point in the middle of your app.

Note that this routine (like most OS routines that switch from one app to another) will call the current cxPPutAway routine, followed by the current cxPutAway routine. If you install your own PutAway routine, it should do something like the following in order to call the standard cleanup code:

AppPutAway:
    ; clean up temporary memory allocations, flags, etc.
    B_CALL ReloadAppEntryVecs
    B_JUMP PutAway

(Note that PutAway, unlike JForceCmdNoChar, does need to be jumped to -- a B_CALL would not work in this case.)

Example

BJUMP JForceCmdNoChar