A83: Error Handlers (83+ Flash SDK)


[Prev][Next][Index][Thread]

A83: Error Handlers (83+ Flash SDK)



Hello, I'm Bob Maresh, main progammer for spleenworks.com.  I've been
working on a new program which runs basic programs from flash rom.  If
anyone can help me with this problem, I would very much appreciate it.  It
isn't completely essential, as my program will still work without this
solution, but it will run much better if anyone can help me.

Here is my problem:

I am installing an error handler to trap errors, such as err:memory,
err:break, etc, when my asm program executes BASIC programs. The problem is
that when the BASIC program encounters the 'Stop' command, the calc locks
up, and never even makes it to 'my_error_handler'. But if I don't use the
'APP_PUSH_ERRORH', the calc simply says 'ERR:INVALID' and quits without a
fight. However, if I don't use any kind of error handler at all, and leave
it to the TI-OS, I can't do what I want when an error occurrs.

Here is the source for my problem:

Before you could execute the following code, you need to load the name of a
BASIC PROGRAM which has the STOP command in it to op1, and then this code
follows.

  ld hl, my_error_handler
  call  APP_PUSH_ERRORH ; Initialize Error handler
  bit   ProgExecuting,(iy+newDispf)
  push  af  ; Save it.
  set   ProgExecuting,(iy+newDispf)
  bcall(_parseInp) ; Run program!
  pop   af  ; Restore state.
;not sure if this next line is needed, but it does NOT cause the problem.
  jr    nz,stateset ; Jump if on
  res   ProgExecuting,(iy+newDispf) ; reset
  call APP_POP_ERRORH  ;no error, then close error handler

my_error_handler:

;no matter what code I put here, the calc still locks up, and even when I do
a dispHL and try pausing the program at this point, the program execution
never makes it here.

  ;bcall(_dispHL)
  ld a,(iy+asm_Flag1)   ;restore a
  or 0                  ;is 'a' zero?
  ret z                 ;quit then.
  call copy             ;copy a prog name
  bcall(_chkfindsym)    ;look it up
  bcall(_DelVar)        ;delete it
  ret                   ;quit

;Remember: ALL these routines I have written work PERFECTLY for trapping the
errors my program encounters, EXCEPT when the BASIC program encounters STOP.

Does anyone have a remote idea of how to help me?

And, if it is helpful, this same problem existed in SOS: when you would quit
using Stop, ERR:LINK was displayed.  Of course, SOS didn't try trapping the
errors, or installing an error handler, so it had no problems.

Thank you for taking the time to read this long message.

Bob Maresh
Kevtiva Programmer
http://www.spleenworks.com/

Follow-Ups: