Automatic re-start on error message.

Anything QL Software or Programming Related.
Post Reply
User avatar
Chr$
QL Wafer Drive
Posts: 1306
Joined: Mon May 27, 2019 10:03 am
Location: Sachsen, Germany
Contact:

Automatic re-start on error message.

Post 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.


https://QXL.WIN
Collector of QL related computers, accessories and QL games/software.
Ask me about felt pads - I can cut them to size and they have proved excellent for mdv data recovery.
User avatar
tofro
Font of All Knowledge
Posts: 2700
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Automatic re-start on error message.

Post 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


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Derek_Stewart
Font of All Knowledge
Posts: 3957
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: Automatic re-start on error message.

Post 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.


Regards,

Derek
User avatar
Chr$
QL Wafer Drive
Posts: 1306
Joined: Mon May 27, 2019 10:03 am
Location: Sachsen, Germany
Contact:

Re: Automatic re-start on error message.

Post by Chr$ »

Many thanks, I'll try those.


https://QXL.WIN
Collector of QL related computers, accessories and QL games/software.
Ask me about felt pads - I can cut them to size and they have proved excellent for mdv data recovery.
Post Reply