Page 1 of 1
Automatic re-start on error message.
Posted: Tue Dec 03, 2019 9:01 pm
by Chr$
Is there a way (I'm sure there probably is) that I can get a SuperBasic prog to restart if it fails during the program? It's just a silly thing I'm doing to format Microdrive cartridges. I know that it's good, supposedly, to format them a number of times to stretch the tape, so I have a simple For/Next loop for that, but it's no good if a format procedure fails and I'm not sitting there to re-start it.
Yes, I also know that microdrives are probably best forgotten and not relied upon in any way for data, but I still find myself strangely drawn to them.
Re: Automatic re-start on error message.
Posted: Tue Dec 03, 2019 9:54 pm
by tofro
Depending on your ROM version, it might be enough to do a simple
Code: Select all
100 WHEN ERRor
110 CONTINUE
120 END WHEN
somewhere in the program flow. Replace line 110 with whatever you want to have done in case of an error
Tobias
Re: Automatic re-start on error message.
Posted: Tue Dec 03, 2019 11:00 pm
by Derek_Stewart
Hi,
If you use Toolkit 2, the error number is returned in tthe funnction, ERNUM and there are error functions defined, relating the the supplied error number.
The definition of the function relstes to a negative ineger.
For a failed format the TK2 function is: ERR_FF, which has a value of -14.
Using Tofro's example:
Code: Select all
100 WHEN ERRor
110 IF ERNUM=ERR_FF : restart_programme
120 END WHEN
Where "restart_porgramme" is a PROCedure to restrt the programme.
You coukd always use a SELect structure as well.
See Toolkit 2 manual and QL Technical manual or SMSQ/E Reference manual for more information.
Re: Automatic re-start on error message.
Posted: Wed Dec 04, 2019 8:27 am
by Chr$
Many thanks, I'll try those.