[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Help with BASIC....
In article <4k283a$in4@wormer.fn.net> demstar@fn.net (Invalid Opcode) writes:
> I have a series of files that appear mostly AppleBASIC, with the
>exception of a very strange token. The token is interpreted as the &
>token by AppleBASIC, but it causes syntax errors the way it's used.
>Some examples of usage are:
>
>100 &B,1,38,1,23
>200 &5,253+DD
>300 &G,3-PEEK(32),21
>
> It seems to take an arbitrary number of parameters, can take variable
>names and numeric constants in any order, and can use the results of
>other tokens as parameters. However, all three of these examples
>cause syntax errors under AppleBASIC.
>
> So what I'm wondering is if this is from that "Integer BASIC" that
>I've seen mentioned once or twice. Or maybe something else. All
>other tokens in the program are straight AppleBASIC except these &
>things. Any useful help will be much appreciated.
What you have there is an example of Applesoft's "ampersand" command.
Ampersand, or "&", is actually a valid Applesoft command, intended to be
used for adding new commands to BASIC. When Applesoft sees the "&"
command, it calls a machine-language program in RAM. The machine-language
program can then take control of the BASIC interpreter briefly, recognize
whatever commands or expressions follow right after the "&", and generally
do whatever it wants with them.
The RENUMBER program on the DOS 3.3 System Master disk uses the "&" to add
a renumber command to BASIC. Typing "RUN RENUMBER" installs the renumber
command, and then you can load your own program, and type commands like
& F5, I5
to renumber your program starting at line 5 and increasing by 5.
RENUMBER isn't the only thing out there that uses "&" to extend Applesoft.
Over the years countless "&" packages have been written and published,
adding just about every conceivable new command to BASIC.
But before you can use "&" for anything at all, you must first load the
machine-language program the implements the new commands. This is usually
done by POKEing machine code into memory from BASIC (if it's not too long),
or BRUNning a file from disk.
Heaven only knows what the examples from your program were supposed to do.
The only way to get them to work would be to load the machine-language
program that they're intended to work with.
- Neil Parker
--
Neil Parker, nparker@{cie-2,cie}.uoregon.edu, http://cie-2.uoregon.edu/~nparker
"I was going to be a neo-deconstructivist but Mom wouldn't let me."
-- Calvin and Hobbes, 7/13/1995