[Simh] macro11

Rhialto rhialto at falu.nl
Sat Mar 7 08:47:47 EST 2020


On Sat 07 Mar 2020 at 01:59:03 +0100, Johnny Billquist wrote:
> In the end, that is a different thing. Absolute addressing is not what Bob
> was thinking about here...
> 
> Here is what MACRO-11 does:
> 
>       1 000000                                  .ASECT
>       2         001000                          .=1000
>       3         001234                  X=1234
>       4
>       5 001000  005067  000230                  CLR     X
>       6
> 
> Note that the addressing is still relative. But the actual offset required
> can be computed by MACRO-11 at compile time.

This is the output of dumpobj for that code. It looks like indeed there
is an unneeded relocation record in there:

GSD:
        GLOBAL X     =1234 DEF ABS flags=110
        MODNAME TEST  =0 flags=0
        PSECT       =0  CON RW REL LCL I flags=40
        PSECT . ABS.=1004  OVR RW ABS GBL I flags=104
        XFER . ABS.=1 flags=10
ENDGSD
RLD
        Location counter definition . ABS.+1000
TEXT ADDR=1000 LEN=4
        001000: 005067 001234               7...
RLD
        Internal displaced 1002=1234
ENDMOD

It looks like the 2nd RLD record is generated by the code
text_displaced_word() in object.c. That in turn must be called from this
code in assemble_aux.c, since there are no other callers to
store_displaced_word():

void mode_extension(
...
    if (value->type == EX_LIT) {
        if (mode->rel)                 /* PC-relative? */
            store_displaced_word(str, tr, 2, value->data.lit);
        else
            store_word(str, tr, 2, value->data.lit);    /* Just a
                                                           known
                                                           value. */

My guess is that this could become something like

    if (value->type == EX_LIT) {
        if (mode->rel) {              /* PC-relative? */
	    if (current_pc->section->flags & PSECT_REL) {
		store_displaced_word(str, tr, 2, value->data.lit);
	    } else {
		/* I can compute this myself. */
		store_word(str, tr, 2, value->data.lit - DOT - 2);
	    }
	} else {
            store_word(str, tr, 2, value->data.lit);    /* Just a
                                                           known
                                                           value. */
	}

It seems like this case didn't come up in any previous tests; the
regression tests show no change at all. (I have tested somewhat strictly
by hand that various RSX-Kermit-11 source files generated the same
object files as on RSX and that the listings, including macro expansion,
didn't have any unexplained differences).

Any interesting test cases I can use with this, so see if it is correct
this way?

       1                                        .TITLE  TEST RELOCATABLE REFERENCES
       2 000000                                 .ASECT
       3        001000                          .=1000
       4        001234                  X == 1234
       5 001000 005067  000230                  CLR     X

.     =******           X     =001234 G         
. ABS.  001004    000   (RW,I,GBL,ABS,OVR,NOSAV)


>   Johnny
-Olaf.
-- 
Olaf 'Rhialto' Seibert -- rhialto at falu dot nl
___  Anyone who is capable of getting themselves made President should on
\X/  no account be allowed to do the job.       --Douglas Adams, "THGTTG"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: not available
URL: <http://mailman.trailing-edge.com/pipermail/simh/attachments/20200307/6e07057c/attachment.sig>


More information about the Simh mailing list