	Format of PDP11 binary files as stored on ITS

Output produced by PALX and :ABSDMP in 11simulator starts with is
PDP11 paper tape absolute loader format, stored 1 byte per pdp10 word.
The symbol table starts immediately after the end of pdp11 core.

The entire file is divided into blocks, usually the PDP11 core image
is a series of blocks, increasing in core address. Blocks are generally
less than 120 bytes in length, although the format theoretically can
allow nearly an entire address space (actually 65530 bytes) to
be stored as one block.

A typical block: (Note each PDP11 byte is stored right justified,
		  that is in the low-order end, of a PDP10 word)
 ------------------------
 |     000000000001	| always there, means absloader format block
 |     000000000000	| always there
 |   low  order byte	| of count of number of bytes in block
 |   high order byte	| includes the initial 1 and 0 but not checksum
 |   low  order byte	| of address of this data
 |   high order byte	| of address
 | _  _  _  _  _  _  _	|
 |/ \/ \/ \/ \/ \/ \/ \/
	.
	 . Byte count minus 6 bytes of data,
	  .  low order byte first then high order
	 .
 _/\_/\_/\_/\_/\_/\_/\_/|
 |			|
 |			|
 |	checksum	| of all bytes of block including the 1,0,count
 ------------------------ and the address. Sum of all bytes + checksum
			  should equal 0 modulo 256.

The last block of data to be loaded into the 11 is has a byte count
of 6. The load address of that block is the starting address for the
program, unless it is odd in which case the processor is supposed to halt.

The symbol table block always seems to be after the PDP11 core image
data and looks like:

 ------------------------
 |    000000000002	|
 |    sixbit symbol	| 
 |    flags,,value	|
 |    sixbit symbol	| 
 |    flags,,value	|
 | _  _  _  _  _  _  _  |
 |/ \/ \/ \/ \/ \/ \/ \/ 
     .
       . any number of symbols followed by value cells...
      .
 _/\_/\_/\_/\_/\_/\_/\_/|
 |			|
 |    000000000000	| apparently ended just by a word of zero
 ------------------------ in the word the symbol is usually in.

The flags appear in the left half, I've only found the first 4 useful
but just in case PALX's internal definitions for the rest of the bits is
given.

HKLSYM==020000		;HALF KILLED SYMBOL
UNDSYM==010000		;UNDEFINED SYMBOL FLAG
REGSYM==004000		;REGISTER
LBLSYM==001000		;LABEL

INDSYM==000040		; VALUE OF SYMBOL DEPENDS ON ANOTHER SYMBOL
ENTSYM==000400		; SYMBOL IS AN ENTRY POINT
EXTSYM==000200		; SYMBOL IS EXTERNAL
RELSYM==000100		; SYMBOL HAS RELOCATABLE VALUE
MDLSYM==002000		;MULTIPLY DEFINED LABEL FLAG
SUPSYM==040000		;DON'T OUTPUT THIS SYMBOL.
NCRSYM==100000		;DON'T CREF THIS SYM.
INISYM==200000		;PDP-11 INSTRUCTION, ERROR IF REDEFINED (BUT OK TO EXPUNGE).

                    PALX "Newbin" format

The disk format used by the ITS and Sail version of Palx are rather
inefficient of disk space and take quite a bit of interpetation (e.g.
converting symbols from sixbit to rad50) in order to load into a pdp11
debugger such as Rug.  The "newbin" format is produced by a palx which has
been generated with the newbin flag on.  This is default for the Twenex
version.  There is an ITS version under the name NPALX that does this
also.  The newbin format is exactly the pdp11 loading format described
below stored with four 8 bit bytes high order justified in a pdp10 word
exactly as you would expect for use with pdp10 byte pointer instructions.

		   PDP11 Loading Protocol

The format of the data used when loading a PDP11, is essentially
the absloader format, except that the data path is only 7 bits wide.
The PDP11 must send a positive or negative acknowledge after each block.
If positive the next block is sent, if not the last block is repeated
until a postive acknowledge is recieved.
The stream of characters as it comes to a PDP11 looks like:

 ------------------------
 |	 001		| always there, the 1st 2 bytes are meant to cause the
 |	 002		| PDP11 Consol program to go into "load" mode.
 ------------------------

 ------------------------
 |	 001	        | \
 |	 000		| ]
 | _  _  _  _  _  _  _  | ]
 |/ \/ \/ \/ \/ \/ \/ \/  \
			   > absloader format blocks
 _/\_/\_/\_/\_/\_/\_/\_/| /
 |			| ]
 |	checksum	| /
 ------------------------

	If PDP11 sends back a 4, the next block is sent,
	if anything else (usually a 6) is recieved, the last
	block is re-sent.
	After the last abloader format block (indicated by
	a block with a byte count of 6) the PDP11 sends back
	a 5 if it wants symbols sent, or a 47 if it doesn't.

If symbols are to be sent they are sent as data to be loaded into
Rug's symbol table.  Symbol table entries consist of 2 rad50 words
for the symbol name followed by 1 word of symbol value.  After
16 symbols, two words containing bit flags specify which of the 16
symbols are half-killed and which are register symbols.  (Low-order
bit corresponds to the symbol entry stored at the highest end of
the 16 symbols.) Loder sends symbols in groups of 16 followed by
these flag words, each group of 16 loading below the previous group.
Thus, Rug's symbol table grows downward in chunks of 100 decimal bytes.
The load address used for each group of 16 symbols is a negative offset
from the top of the symbol table (i.e. the 1st group of symbols will
load from -100 to 0).  Rug will add the symbol-table top to this
offset while loading symbols.


 ------------------------
 |	 001	        | \
 |	 000		| ]
 | _  _  _  _  _  _  _  | ]
 |/ \/ \/ \/ \/ \/ \/ \/  \
			   > absloader format block, 106. byte count.
 _/\_/\_/\_/\_/\_/\_/\_/| /  Data is 100. bytes, 16 entries of 3 words
 |			| ]  each, plus two flag words.  Load address
 |	checksum	| /  is -100., -200., etc.
 ------------------------

Symbol table:
	(low address)
 _/\_/\_/\_/\_/\_/\_/\_/|
 |			|  (register flag word)
 |----------------------|
 |	rad50		|  1st 3 letters of 1st symbol name
 |----------------------|
 |	rad50		|  last 3 letters of 1st symbol name
 |----------------------|
 |	value		|  1st symbol value
 |----------------------|
 |/\_/\_/\_/\_/\_/\_/\_/|
			  (15 more symbol entries)
 _/\_/\_/\_/\_/\_/\_/\_/|
 |			| (16th symbol value)
 |----------------------|
 |	hk flag		|  half-kill flag (bit 0 => 16th symbol)
 |----------------------|
 |	reg flag	|  register flag
 |----------------------|
 |			|  (1st 3 letters of 1st symbol name for
 |/\_/\_/\_/\_/\_/\_/\_/|   next 16 symbols)


This file last updated 3:30pm  Sunday, 8 July 1984 by CBF.
