[Coco] RMA file investigations

Jeff Teunissen deek at d2dc.net
Wed May 6 00:14:31 EDT 2020


After some investigations Walter Zambotti and I have found that the
extra two bytes (not 1) at the end of RMA-produced ROF files are not
extra, and are in fact related to RMA's version 1 ROF output. As it
turns out, there's an entire other output section that c.link (and
possibly many versions of rlink) can't process.

You probably know, from the output of rdump, about three of the four
symbol tables a Version 0 ROF file contains. They are, in order:

Global symbols defined
External references from other files
Local references internal to the file

Version 1 ROF files, however, contain a fourth: "common blocks", which
are apparently "owned" by one psect but can be used by any number of
them. That extra 2 bytes Bill Pierce thought were spurious are, in
fact, a 16-bit counter of the number of common blocks defined within
the assembly, and when defined are followed by the name of the block,
its size, and a second symbol table describing the format and offset
of those references.

I will describe the contents of a common block symbol table I have
gotten rma to construct for me.

The beginning of the symbol table sets up a counter: $0001 (1 block)

Immediately following the counter is its name, in a C string: $66 $6F
$6F $00 ("foo\0")

Immediately following the number is the size of the block: $0064 (100 bytes)

Immediately following the size, is another counter, this time for the
count of references to locations within the common block. In our case,
we have 1 reference: $0001

Immediately following the counter, we have a reference type/location
byte: $A7, which according to the description in rdump.c, means we
have a relative reference ($80) to a location in the data/code section
($20), and with "CODENT/DIRENT/INIENT" options all set. The native
rdump program describes this byte as referring to an object "in
code/word/pcr"

Following that attribute byte, we have a 16-bit offset: $0002, which
in this case I think describes a distance of two _words_ away, not
bytes.

The simple RMA source code used to create this file follows:

 psect joe,0,0,0,0,joe

foo common 100

joe:
 sta foo+r,pcr
 rts

 ends


More information about the Coco mailing list