[Coco] questions about constants

Wayne Campbell asa.rand at yahoo.com
Mon Sep 14 20:29:15 EDT 2009


I understand. I had been thinking, for a while, that the rmb lists in the header were tables of values that Basic09 uses to identify the keywords and associate them with a token code. I haven't been sure of how that table is referenced in the object code. For example, in Basic09, if I wanted a table of references, I would establish DATA statements, like:

DATA $01,"PARAM",$02,"TYPE",$03,"DIM"

I have a variable, tokenCode. I use tokenCode to identify the byte read by comparing it to the first field of data ($01), then affixing a label to a different variable, tokenName, using the second DATA field ("PARAM"). The data statements are all in the I-Code, though they are not directly tied to any variable.

I thought that the first list of rmb's in the header were the assembly version of my data statements, and that the identifiers (like T.ON) would be used by Basic09 to determine which keyword was being used. I'm not sure how Basic09 does this, other than that there is a "list" of keyword names (in the fcb's), and each one has the token value included, like:

L0140    fcb   $01
         fcb   $01 
         fcb   $50 P
         fcb   $41 A
         fcb   $52 R
         fcb   $41 A
         fcb   $CD M

PARAM is token $01,and has a size of $01

         fcb   $02
         fcb   $01 
         fcb   $54 T
         fcb   $59 Y
         fcb   $50 P
         fcb   $C5 E

TYPE is token $02,and has a size of $01

I guess that the identifier labels (like T.ON) are not necessary after the initial setup.

Wayne




________________________________
From: William Astle <lost at l-w.ca>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Monday, September 14, 2009 1:58:43 PM
Subject: Re: [Coco] questions about constants

Okay, I think I understand where you're going wrong. You are assuming
that just because the header has T.ON defined, then the code must be
referring to it. That will not necessarily happen. I have written much
code over the years where I define two 8 bit values but I always read
them as a single 16 bit value. Labelling them as two 8 bit values is
usually just for clarity or completeness. Or perhaps they are only
accessed via an index register. Or the variable is not actually used.

Furthermore, any string of RMBs that is used to simply define the values
of constants will NEVER have any equivalent in the output file. Ever.
This is because those constants are never used as addresses so the
disassembler will not know there were symbols attached to them.

The same thing will often be the case for "structure offset" lists
(often defined as "ORG 0" followed by a bunch of RMBs) since they are
never accessed as addresses, just offsets from an index register.

Now, for actual variable (data memory) allocations, you should see at
least some correlation between the RMBs in the header and the result of
the disassembly. However, as stated, any variable in the header that is
not referenced independently anywhere in the program will not appear in
the disassembly.

Note that you are probably correct that writing some assembly code and
studying what is generated (and what a disassembler produces) will be
more helpful to you than any protracted discussion will be.

If you can find a copy of it, you might find Mr. Barden's book TRS-80
Color Computer Assembly Language Programming helpful though it is not
OS9 oriented.

--
Coco mailing list
Coco at maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco



      



More information about the Coco mailing list