Texas Instruments Plugins

apponerr/appofferr

Syntax

AppOnError(handler)
AppOffError()

Example

Compute 1/X; carry flag is set on error.

/* Compute 1/X and return CA = 0 if no error, *
 * otherwise return CA = 1. This example has  *
 * been copied from the TI-83 Plus SDK.       *
 * Test by deleting the variable X or setting *
 * X to 0.                                    */

    AppOnErr(My_Err_Handle)
;
    .bcall _RclX    ; OP1 = (X)
    .bcall _FPRecip ; 1 / OP1
;
; If no error then returns from the call
;
    AppOffErr()     ; remove the error handler
    or a            ; CA = 0 for no error
    ret
;
; control comes here if X = 0 and generates
; an error
;
My_Err_Handle:
    scf             ; CA = 1 for error
    ret