shattered/macro11

error on relative addressing octal in .lst file?

Closed this issue · 5 comments

While trying to recreate an octal dump from a small memory test from a DEC document (http://bitsavers.trailing-edge.com/pdf/dec/pdp11/xxdp/diag_listings/memory/MAINDEC-11-D1AA_BASIC_ADDRESS_TEST_UP_Mar70.pdf) containing relative addressing, I found the .lst file represents this as absolute addressing but with a ' added.

	.ASECT
.=000200
START:	MOV	LOLMT,%0	;INITIALIZE LOW LIMIT
WRITE:	MOV	%0,@%0		;WRITE VALUE INTO ADDRESS
	TST	(0)+		;JUST INCREMENT
	CMP	%0,#17500	;TEST FOR DONE ALL MEMORY
	BLOS	WRITE		;NOT DONE
READ:	CMP	-(0),@%0	;READ VALUE BACK FROM ADDRESS
	BEQ	CKON		;WAS VALUE OK?
	HALT			;NO, HAVE ERROR-PRESS CONTINUE OR RESTART AT 200
CKON:	CMP 	LOLMT,%0	;TEST FOR DONE ALL MEMORY
	BLO	READ		;NOT DONE
	HALT			;STORE "HALT" HERE TO STOP AFTER A PASS COMPLETION
	BR	START		;REPEAT TEST
LOLMT:	.
	.END
       1                                	.ASECT
       2 000200                         .=000200
       3 000200 016700  000236'         START:	MOV	LOLMT,%0	;INITIALIZE LOW LIMIT
       4 000204 010010                  WRITE:	MOV	%0,@%0		;WRITE VALUE INTO ADDRESS
       5 000206 005720                  	TST	(0)+		;JUST INCREMENT
       6 000210 020027  017500          	CMP	%0,#17500	;TEST FOR DONE ALL MEMORY
       7 000214 101773                  	BLOS	WRITE		;NOT DONE
       8 000216 024010                  READ:	CMP	-(0),@%0	;READ VALUE BACK FROM ADDRESS
       9 000220 001401                  	BEQ	CKON		;WAS VALUE OK?
      10 000222 000000                  	HALT			;NO, HAVE ERROR-PRESS CONTINUE OR RESTART AT 200
      11 000224 026700  000236'         CKON:	CMP 	LOLMT,%0	;TEST FOR DONE ALL MEMORY
      12 000230 103772                  	BLO	READ		;NOT DONE
      13 000232 000000                  	HALT			;STORE "HALT" HERE TO STOP AFTER A PASS COMPLETION
      14 000234 000761                  	BR	START		;REPEAT TEST
      15 000236 000236                  LOLMT:	.
      15                                	.END

The original assembly listing had differences at two lines:

3  000200	016700	000032		START:	MOV	LOLMT,%0	;INITIALIZE LOW LIMIT

11 000224	026700	000006		CKON:	CMP	LOLMT,%0	;TEST FOR DONE ALL MEMORY

Hi @electrickery ... I have made some improvements to macro11 in my fork at https://github.com/rhialto/macro11 . You can try that version and see how it fares. Although I don't recall anything that might influence this.
The ' apostrophe in the listing indicates that that word is relocatable. With the dumpobj you can check what sort of relocation record is associated with it. It might be correct after all. Although I suspected you wanted pc-relative adressing such as the original listing seems to show (32(pc) and 6(pc), by the looks of it).
It has been a while since I worked on macro11, so I don't know what sort of addressing modes (if any) .ASECT is supposed to imply. But I think there are supposed to be directives that allow you to choose for some cases. But on the other hand, this macro11 doesn't implement them, I think.

Oh, and I have been trying to get the assembler to conform to the latest RSX version of macro11. Which may well have different defaults than anything from 1970... so maybe that can explain different adressing modes as well.

AK6DN commented

That diagnostic listing was assembled under PALX11, a PDP-11 cross-assembler running on a PDP-10, and following PAL-11 conventions used in the early 1970s.

This macro11 follows the later RT-11 MACRO11 and PDP-10 MACY11 (used by later diagnostics) convention of using the ' (apostrophe) to show a word will be relocated (depending on address mode) but the value indicated is the actual target memory address within the given program section (it could also be relocated if using the linker to combine multiple psects into a program).

So I would say the behavior is correct per late 1970s/early 1980s MACRO11 programming standards.

Don North, DEC PDP-11 Diagnostic Engineering, 1975-1978

Thanks for the responses. It is good to know the problem comes from my lack of knowledge and is not a bug in the code. Now I can concentrate on coercing macro11 to produce code I can spool into the Minc-23 via ODT. RTFM I suppose :-).
@Rhialto : I switched to your version of macro11 and it works ok, giving some more output.

Fred Jan

Closing, please follow Rhialto's fork as mentioned above.