[Coco] CoCo BASIC Interpreter
Arthur Flexser
flexser at fiu.edu
Sat Feb 20 13:23:01 EST 2021
Actually, there are 3 different lookup tables, one each in the ROMs for
Color Basic, Extended Basic, and DIsk Basic. Plus a fourth one for Super
Extended Basic if we have a CoCo 3. The Unravelled disassembly series from
Spectral Associates (available online as pdf's) will show you where the
tables are and their contents.
For A=COS(B), it's not exactly "passing" of values. Rather, when the top
level of the interpreter hits the COS token, it jumps to the COS command
ROM location. There, the value of the expression within parentheses is
parsed for syntactic correctness (?SN ERROR if no good) and evaluated,
which involves looking up the current value of the variable B in Basic's
variable table that is stored in RAM at the end of the program as a 5-byte
floating point quantity. The evaluation of the cosine of B is then carried
out and the result stored in the "A" entry of the variable table, and then
control returns to the top level of the interpreter to enable it to process
subsequent byte(s) of the program, including spaces, line numbers,
comments, etc., until the next token (or the end of the program) is
encountered.
Art
On Sat, Feb 20, 2021 at 10:35 AM Steve Ostrom <smostrom7 at comcast.net> wrote:
> Art, so then each token is part of a look-up table. Maybe I just need to
> know the location of that look-up table. For example, if B is expressed in
> radians, and I have the BASIC line A=COS(B). The interpreter passes the
> value of B to the ROM routine for COS, and returns the value of A to the
> interpreter. Is there a published version of this look-up table that would
> identify each token and the ROM entry location?
>
> Thanks much for your help.
>
> --- Steve ---
>
>
> Sent from Mail for Windows 10
>
> From: Arthur Flexser
> Sent: Friday, February 19, 2021 9:58 PM
> To: CoCoList for Color Computer Enthusiasts
> Subject: Re: [Coco] CoCo BASIC Interpreter
>
> You have it slightly wrong, Steve, I'm afraid. Basic is interpreted, not
> compiled, so there is no translation of anything to machine code.
>
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>
More information about the Coco
mailing list