Cancelling an error message

having trouble with an archived file? post in here!
Post Reply
Michael Brown
Posts: 2608
Joined: Sat Apr 03, 2010 1:54 pm
Location: Nottingham
Contact:

Cancelling an error message

Post by Michael Brown »

Hi All,

Does anyone know how to clear the ERR value after performing a error.

IE if loading a file that doesn't exist ERR=222 but remains at 222 until another error occurs upon running the game again.
Is there some way of resetting the value of ERR to 0 upon re-starting a game?

regards,
Mick.
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Cancelling an error message

Post by lurkio »

Make the error pointer &FD/&FE (lo/hi) point to any byte that's guaranteed to be zero -- or to &800E in the BASIC ROM (if it's paged in), which is what's pointed to at startup.

Code: Select all

10 ON ERROR PRINT "Error trapped. ERR = ";ERR:GOTO 30
20 *FX125
30 ?&FD=&E:?&FE=&80
40 PRINT "Error cleared. ERR = ";ERR
50 END
:?:
Last edited by lurkio on Tue Mar 14, 2017 3:48 pm, edited 1 time in total.
User avatar
jgharston
Posts: 5315
Joined: Thu Sep 24, 2009 12:22 pm
Location: Whitby/Sheffield
Contact:

Re: Cancelling an error message

Post by jgharston »

Michael Brown wrote:Does anyone know how to clear the ERR value after performing a error.
ERR is not a variable, it is a function that returns the error number of the last generated error. It's like asking how to change what a thermometer says when you look at it. It's a readout, not an setting.

Code: Select all

$ bbcbasic
PDP11 BBC BASIC IV Version 0.45
(C) Copyright J.G.Harston 1989,2005-2024
>_
Michael Brown
Posts: 2608
Joined: Sat Apr 03, 2010 1:54 pm
Location: Nottingham
Contact:

Re: Cancelling an error message

Post by Michael Brown »

Perfect explanation - just what I thought.

There was a problem with a game by Visions called Warlord Of Doom where if you try to load a file that doesn't exist (even from tape if you don't enter a name), then that error remains with the game and comes back to interfere with the game when you decide to quit.
This is a error with the original game and not one caused by hacking.

However, the way I got around this a few weeks back was to alter line 4210 in ADV1 from IF ERR <>17 REPORT:ENDPROC to IF ERR<>17GOTO5200.
Then enter new text...
5200 ONERRORPRINT"ERROR":GOTO5220
5210 *FX125 (causes an escape condition - giving the game a new ERR code of 17)
5220 CLOSE#0:GOTO4250 (jumps back into the "WANT ANOTHER GAME" routine).

This works as if you try to load a file that doesn't exist then the ONERRORPROCQUIT routine is triggered, but because it is not an ERR 17 it jumps to line 5200 and prints "ERROR" letting you know an error has occured. Then ERR 17 is triggered and you can then start a new game (with ERR 17) which is ignored if you then type QUIT etc.

This is a bit long winded but works, but I was just wondering if there was a simpler way around this, but if not then I believe this will do.

Any suggestions?

Mick.
Michael Brown
Posts: 2608
Joined: Sat Apr 03, 2010 1:54 pm
Location: Nottingham
Contact:

Re: Cancelling an error message

Post by Michael Brown »

Just tried a few pokes

?&FD=-200 seems to return a ERR=0 result

Mick.
User avatar
lurkio
Posts: 4351
Joined: Wed Apr 10, 2013 12:30 am
Location: Doomawangara
Contact:

Re: Cancelling an error message

Post by lurkio »

Michael Brown wrote:Just tried a few pokes
?&FD=-200 seems to return a ERR=0 result
Not necessarily:
  • Untitled.jpg
Depends on what the value of ?&FE is.

:idea:
Michael Brown
Posts: 2608
Joined: Sat Apr 03, 2010 1:54 pm
Location: Nottingham
Contact:

Re: Cancelling an error message

Post by Michael Brown »

May stick with the routine I used above then.

Mick.
User avatar
MartinB
Posts: 5635
Joined: Mon Mar 31, 2008 10:04 pm
Location: Obscurity
Contact:

Re: Cancelling an error message

Post by MartinB »

If you don't mind another short file on disc, it can be done by creating our own error where ERR=0. If you *BUILD the following two-line ascii file - where "PROG" is the game you want to run or re-run after first setting ERR to 0 - and then *EXEC this file instead of RUN or CH."PROG", you'll have the state you're after....
Zero ERR.png
I've called it ERROR0 and if we wanted to run PROG but first set ERR to 0, we'd just use *EXEC ERROR0

(&900 is arbitrary, just need any 5 spare locations.)
Michael Brown
Posts: 2608
Joined: Sat Apr 03, 2010 1:54 pm
Location: Nottingham
Contact:

Re: Cancelling an error message

Post by Michael Brown »

thanks for the input!

It really is just the one game casuing this problem.
I don't really want to add any more files to the game and I am not sure what would happen if I did.

Also the ?&FD and ?&FE solutions may cause problems with Datacentre Beebs as well.

thanks again everyone for your help.

Mick.
Post Reply

Return to “archive issues”