Re: A86: Error checking


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

Re: A86: Error checking




OK, thanx. That more than what I needed to know.

Jean Vásquez

              Jean Vásquez
       ,;;    vasquezjara@earthlink.net
      ,;;'    Dark Horizon Studios
 ,  ,;;'      http://www.afterlyfe.com/darkhorizon
  ';;'        AIM SN: Leon Pierr
 .' ',        ICQ#:  14164471

Dux Gregis wrote:

> You can install error handlers to override the default os error handlers so
> that if you call, say, _CREATESTRNG and there isn't enough memory, your
> handler will execute rather than the default: ERROR 15 MEMORY.  This holds
> true in all ROM versions.  The call to install an error handler is $41a1
> (input = hl points to error handler) and the call to remove an error handler
> is $41a4.  Within the handler you can check which error was thrown by
> comparing the error # and $7f to ($c381).  For example, to install a
> handler:
>
>  ld hl,error_handler
>  call $41a1                ;install error_handler
>
>  ***
>
> error_handler:
>  ld a,($c381)
>  and $7f
>  cp 7                        ;check for syntax error
>  jp nz,_jforce            ;force out if some other kind of error
>  ld hl,syntax
>  call _puts                ;display your message
>  jp start                    ;go back to start of program, just watch the
> stack
>
> syntax:
>  "Unacceptable Input",0
>
> Be sure to uninstall your handler.
>


References: