BASIC - detect the presence of a disk

صفحة 2/3
1 | | 3

بواسطة JohnHassink

Ambassador (5671)

صورة JohnHassink

07-01-2023, 09:56

PingPong wrote:

(Also called ON HORROR GOTO 10000 ;-) ) due to it unstructured/horrible mode of working

Hahaha, I like this. Big smile Indeed, I remember that it works quite below expectations.

بواسطة mars2000you

Enlighted (6481)

صورة mars2000you

07-01-2023, 10:08

mars2000you wrote:
gdx wrote:

I added the ON ERROR GOTO 0 in the wiki example here to stop error handling for others errors.

I can't see it in this example.

And in the other example, it will not work when it's not the last line of the program.

I repeat this message because often the 10th message of a page is not seen when a new message, starting a new page, has been posted.

At least this issue does not exist on MSX Village, as there the last message of a page is automatically repeated as first message of the next page.

بواسطة gdx

Enlighted (6213)

صورة gdx

07-01-2023, 12:27

mars2000you wrote:

I can't see it in this example.

Did you look too quickly?

mars2000you wrote:

And in the other example, it will not work when it's not the last line of the program.

Exact, I had forgotten a GOTO and I hadn't noticed that the RESUME was done in the wrong place. The example was not right before therefore. We must not use instruction to handle error after the execution of ON ERROR GOTO 0.

بواسطة mars2000you

Enlighted (6481)

صورة mars2000you

07-01-2023, 12:29

I have refreshed the page 5 times .... and no new line!

You can check many BASIC listings .... Most of them using ON ERROR GOTO 0 put it at the end of the program, not inside the program.

بواسطة gdx

Enlighted (6213)

صورة gdx

07-01-2023, 12:32

بواسطة mars2000you

Enlighted (6481)

صورة mars2000you

07-01-2023, 12:34

Not a new line as I was expecting!

You can check many BASIC listings .... Most of them using ON ERROR GOTO 0 put it at the end of the program, not inside the program.

بواسطة gdx

Enlighted (6213)

صورة gdx

07-01-2023, 12:39

I'm surprised. Do you know where I can find an explanation for this?

بواسطة mars2000you

Enlighted (6481)

صورة mars2000you

07-01-2023, 13:19

I guess it's the only way to make permanent the handling of errors, and in this case the RESUME instruction will not refer to the 1st line with ON ERROR GOTO (linenumber) but to the next line, exactly as it was before your changes that seem me wrong.

Maybe NYYRIKKI or someone else could explain that better than me?

بواسطة mars2000you

Enlighted (6481)

صورة mars2000you

07-01-2023, 13:25

See examples (with comments) in this book: https://books.google.be/books?id=Qo-GDAAAQBAJ&pg=PA168&lpg=P...

ON ERROR GOTO 0 is always the last line, because it means 'use normal error handling when a non-specific error happens'.

بواسطة gdx

Enlighted (6213)

صورة gdx

07-01-2023, 14:05

In most japanese documentations it is not indicated to put it at the end as this one.
https://github.com/fu-sen/MSX-BASIC/blob/master/ON%20ERROR%2...

http://ngs.no.coocan.jp/doc/wiki.cgi/datapack?page=2%C9%F4+3...
In the following example, it is put at the end of the program but the explanation says that it must be executed. It even says that we can put several ON ERROR GOTOs, when one is executed it replace the previous and if we specify the ligne 0 it is canceled as with the VBA BASIC on PC.

صفحة 2/3
1 | | 3