[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: running .system files from BASIC
Simon Williams (see_sig_for_valid_email@no.spam) wrote:
: "Bill Garber" <willy46pa@comcast DOT net> wrote:
: > You need the Semi-Colon after D$ otherwise
: > it'll think D$"-xxxxxxxx.SYSTEM" is all one
: > variable.
: Really? I thought that was just a convention to make reading the listing
: easier on humans. I could well be wrong, though...
In Applesoft you don't need the semicolon to separate a variable from a
literal. Applesoft is smarter than those modern languages that way. 8-)
There is an important restriction, though...
Many lazy programmers in DOS 3.3 would set...
D$=CHR$(13)+CHR$(4)
...and that won't work at all under ProDOS. The ^D has to be the first
character printed. Under DOS 3.3, it just had to be the first character
printed on the current line; under ProDOS it also has to be the first
character in the print instruction.
Personally, I don't use D$ for that purpose. Why waste a perfectly good
variable to store one byte? More important, why use a variable for a
constant? Instead, I use...
PRINT CHR$(4);"DOS COMMAND"
Hmmm...I'm curious...how does this work out memory-wise...?
METHOD A:
D$ = CHR$(4)
12 3 4 56
PRINT D$;"DOS COMMAND"
7 89AB
That's 11 bytes, plus another six or seven (IIRC) to store the string
variable...for one use, that's 18 bytes, 5 for subsequent uses.
METHOD B:
PRINT CHR$(4);"DOS COMMAND"
1 2 3456
That's only 6 bytes on each use. So if you use less than 11 DOS commands
in the program, you come out ahead. That's nothing compared to Method C:
METHOD C:
PRINT "^DDOS COMMAND"
1 23
That's only 3 bytes per use. Except that where you see that a lot is in
program listings, where it doesn't take 3 bytes, it takes 65 bytes because
instead of doing it 'right' with method A or B, they add a needless comment:
PRINT "^DDOS COMMAND":REM THERE IS AN INVISIBLE CONTROL-D AFTER THE FIRST
QUOTE MARK.
--Dave Althoff, ][.
--
/X\ _ _ *** Closed for the season. ***
/XXX\ /X\ /X\_ _ /X\__ _ _ _____
/XXXXX\ /XXX\ _/XXXX\_ /X\ /XXXXX\ /X\ /X\ /XXXXX
_/XXXXXXX\__/XXXXX\/XXXXXXXX\_/XXX\_/XXXXXXX\__/XXX\_/XXX\_/\_/XXXXXX