Documentation for AppleSoft & command hook?

From: Patrick Rigney <patrick_at_evocative.com>
Date: Sun Nov 30 20:55:11 2003

> Yep, it's a good start, but I'm interested in also learning how Applesoft
> parses text, tokens nad parameters so that I can make full featured add-on
> commands for a library I want to write. You gave me a good start though,
> and it's inline with what I remember way back in the day, but it's the
> other stuff I am trying to figure out, and I don't recall ever coming
> across any decent documentation for that.

Sellam,

There doesn't appear to be much if any special parsing. I could explain how
the parser tokenizes the program, and then how the runtime interpets the
tokens, but I think that's apparent.

For your purposes, from what I can see, you'd see nothing but straight text,
unless that text overlapped the keyword space, in which case you'd see
tokens to that degree.

For example, the following statements:

100 &PRINT "X"
110 &SPOOL "Y"

would appear to be tokenized as:

64 00 AF BA 22 58 22 00
6E 00 AF 53 50 4F 4F 4C 22 59 22 00

The parser recognizes "PRINT" as a keyword and tokenizes it, so the stored
representation is the token. In contrast, "SPOOL" isn't recognized as a
keyword, so it's stored as raw ASCII. Note that the first two bytes of each
line are the statement line number, which is stored in binary two-byte
representation. However, even for the noble GOTO command, the target line
number is NOT parsed. The statement "120 GOTO 100" is simply stored as:

78 00 AB 31 30 30 00

Which is the statement line number (in binary), the GOTO token $AB, and the
ASCII representation of "1" "0" "0" (NOT binary).

The parser would NOT, however, tokenize the word "PRINT" in the above
example had the text been entered thus:

100 &"PRINT" "X"

Quotes are special to the parser, as in many parsers, and their contents are
not subject to tokenization.

Patrick
Received on Sun Nov 30 2003 - 20:55:11 GMT

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:36:21 BST