CPCWiki forum

General Category => Programming => Topic started by: eto on 06:44, 06 April 22

Title: Exclamation mark in LOAD
Post by: eto on 06:44, 06 April 22
I was looking into many DSK images recently and for every BASIC loader that I found, they used something like this:

100 load "!game.bin",&8000
110 call &8980

First, I thought this might be a leftover as many of those game where cassette releases, but I found it in every single BASIC loader, even those of cracks. 

I thought that the ! does not have any impact on discs. But why is it then always used there too?
Title: Re: Exclamation mark in LOAD
Post by: roudoudou on 07:47, 06 April 22
the exclamation disable system messages (like load error on disc ;) )
Title: Re: Exclamation mark in LOAD
Post by: eto on 08:18, 06 April 22
Quote from: roudoudou on 07:47, 06 April 22the exclamation disable system messages (like load error on disc ;) )
OK, great to know that. Thanks.

Still not sure if that is useful on discs. I guess it would be always beneficial to know if there is a load error on a disc. Or can there be situations, where the system would output a message but still load a file successfully?
Title: Re: Exclamation mark in LOAD
Post by: roudoudou on 08:27, 06 April 22
Quote from: eto on 08:18, 06 April 22
Quote from: roudoudou on 07:47, 06 April 22the exclamation disable system messages (like load error on disc ;) )
OK, great to know that. Thanks.

Still not sure if that is useful on discs. I guess it would be always beneficial to know if there is a load error on a disc. Or can there be situations, where the system would output a message but still load a file successfully?

It's useful to know if a file exists (before writing it, before deleting it) without garbage messages on screen

Another example when you want to load a bunch of numeroted files and you dont know the last one :)
Title: Re: Exclamation mark in LOAD
Post by: Nworc on 10:02, 06 April 22
Quote from: eto
Quote from: roudoudouthe exclamation disable system messages (like load error on disc ;) )
OK, great to know that. Thanks.

Still not sure if that is useful on discs. I guess it would be always beneficial to know if there is a load error on a disc. Or can there be situations, where the system would output a message but still load a file successfully?

The good thing with Amsdos is, that it is agnostic to whether you load your data from Tape or Disc or whatever hardware is connected - the program using the load and save functions should not care. So, you should write your loader in a way to run on all media.

The disc functions keep quiet in all good cases, to my knowledge. And if there is a problem, it does not help suppressing messages.
However, if messages would be a cosmetic problem or a real problem (in case of loading data into the screen), then an exclamation mark does make sense.

I'm not sure, if this all is valid only for Basic, can be that you have to call CAS NOISY when doing a loader in MC to suppress messages.
Title: Re: Exclamation mark in LOAD
Post by: roudoudou on 11:51, 06 April 22
Quote from: Nworc on 10:02, 06 April 22The disc functions keep quiet in all good cases, to my knowledge. And if there is a problem, it does not help suppressing messages.
However, if messages would be a cosmetic problem or a real problem (in case of loading data into the screen), then an exclamation mark does make sense.

Sure it helps, because you've taken care to intercept error with an ON ERROR GOTO before ;D
Then you do what you want: stop trying to load missing file, display a proper error, ...
Title: Re: Exclamation mark in LOAD
Post by: Nworc on 14:10, 06 April 22
Dawn, you are right!  :)
Powered by SMFPacks Menu Editor Mod