Cancelling an error message

having trouble with an archived file or want to correct something? report it here!
Michael Brown
Posts: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Cancelling an error message

Postby Michael Brown » Mon Mar 13, 2017 2:54 pm

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: 1142
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Cancelling an error message

Postby lurkio » Mon Mar 13, 2017 7:32 pm

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: 2658
Joined: Thu Sep 24, 2009 11:22 am
Location: Whitby/Sheffield

Re: Cancelling an error message

Postby jgharston » Tue Mar 14, 2017 12:30 am

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.25
(C) Copyright J.G.Harston 1989,2005-2015
>_

Michael Brown
Posts: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: Cancelling an error message

Postby Michael Brown » Tue Mar 14, 2017 8:13 am

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: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: Cancelling an error message

Postby Michael Brown » Tue Mar 14, 2017 5:18 pm

Just tried a few pokes

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

Mick.

User avatar
lurkio
Posts: 1142
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Cancelling an error message

Postby lurkio » Tue Mar 14, 2017 5:27 pm

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: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: Cancelling an error message

Postby Michael Brown » Wed Mar 15, 2017 7:56 am

May stick with the routine I used above then.

Mick.

User avatar
MartinB
Posts: 4511
Joined: Mon Mar 31, 2008 9:04 pm
Location: Obscurity

Re: Cancelling an error message

Postby MartinB » Wed Mar 15, 2017 1:48 pm

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: 1860
Joined: Sat Apr 03, 2010 12:54 pm
Location: Nottingham

Re: Cancelling an error message

Postby Michael Brown » Wed Mar 15, 2017 4:43 pm

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.


Return to “archive issues”

Who is online

Users browsing this forum: No registered users and 1 guest