[Coco] questions about constants
William Astle
lost at l-w.ca
Mon Sep 14 16:58:43 EDT 2009
Wayne Campbell wrote:
> org 0
>
> T.GLOB rmb 1 Global (reserved) - set to $00, at location $00
> T.PRAM rmb 1 Param - set to $01, at location $01
> T.TYPE rmb 1 Type - set to $02, at location $02
> T.DIM rmb 1 Dim - set to $03, at location $03
>
> The disasm output starts out correctly, but begins to be different at u001C:
>
> u001C rmb 2
>
> The header, in that same position, shows:
>
> T.EEXT rmb 1 Endexit
> T.ON rmb 1 On
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.
More information about the Coco
mailing list