Re: A86: Error checking


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

Re: A86: Error checking




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.


>
>Ok,  let me elaborate. Some one wrote to me saying:
>
>
>I think the problem was that (game X)  overwrote some
>system variables.  (Game Y and Game Z) both use a lot of high level rom
>calls, and so probably accessed some of the overwritten data.
Specifically,
>I
>think it was the call _RANDOM that messed things up.  On my 86, it caused a
>crash maybe 1 in 100 times, but I imagine they introduced some ERROR
>CHECKING
>in rom 1.5, though that's just a guess.  Anyway, I altered (game X)  to use
>the
>ram at the end of _asm_exec_ram instead of the system vars, so everything
>should be OK (I hope).
>
>Now, to the point. Was there any error checking introduced in rom 1.5?
>Please forgive me if I am not making any sense, but I have clarified it as
>much as possible.
>
>Jean Vásquez
>
>--
>              Jean Vásquez
>       ,;;    vasquezjara@earthlink.net
>      ,;;'    Dark Horizon Studios
> ,  ,;;'      http://www.afterlyfe.com/darkhorizon
>  ';;'        AIM SN: Leon Pierr
> .' ',        ICQ#:  14164471
>
>
>
>Cassady Roop wrote:
>
>> I don't know if this is anything similar to what you wanted to know, but
>> all of the user routines use error checking.  They only execute if a
>> checksum matches the sum of the first, 40th, 80th, 120th, 160th, and
>> 200th bytes of the user routine.  What exactly did you mean?
>>
>> VasquezJara wrote:
>> >
>> > I have a quick question that might be a dumb one. Is there
>> > any form of error checking in any versions of the rom? I
>> > have no idea, and this is why I ask. Forgive me if its a
>> > dumb question.
>> >
>> > Jean Vásquez
>> >
>> > --
>> >               Jean Vásquez
>> >        ,;;    vasquezjara@earthlink.net
>> >       ,;;'    Dark Horizon Studios
>> >  ,  ,;;'      http://www.afterlyfe.com/darkhorizon
>> >   ';;'        AIM SN: Leon Pierr
>> >  .' ',        ICQ#:  14164471
>
>
>
>


Follow-Ups: