83Plus:BCALLs:4027

From WikiTI
Revision as of 22:14, 18 April 2008 by FloppusMaximus (Talk | contribs)

Jump to: navigation, search


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