PRL file format

A PRL file is a relocatable binary file, used by MP/M and CP/M Plus for various modules other than .COM files. The file format is also used for FID files on the Amstrad PCW.

There are several file formats which use versions of PRL: SPR (System PRL), RSP (Resident System Process). LINK-80 can also produce OVL (overlay) files, which have a PRL header but are not relocatable.

GSX drivers are in PRL format; so are Resident System Extensions (.RSX).

A PRL file comes in three parts:

PRL header

The PRL file starts with a 256-byte header:

	DB	0	;Always 0
	DW	bytes	;Number of bytes in program image. This includes the
			;code and initialised data groups.
	DB	0	;Always 0
	DW	bss	;Number of bytes reserved for uninitialised data. 
			;Always 0 in an OVL file.
	DB	0
	DW	loadadd	;Load address. Always 0 except in OVL files, because
			;the other files are relocatable.
	DB	0
	DW	csbase	;BIOS link. Always zero unless Link-80 was used with
			;the [B] option, in which case it is the base address
			;of the code group.
	DS	0F4h	;Unused

Code / data

The header is followed by bytes bytes of code and data. In PRL and RSP files, the code is assembled as if loaded at 0100h. In SPR files, it is assembled as if loaded at 0000h.

Relocation bitmap

Unless the file is an OVL file, there then follow ((bytes + 7) / 8) bytes of relocation bitmap (so one byte in the bitmap corresponds to 8 bytes in the file). Bit 7 corresponds to the lowest byte and bit 0 to the highest. So bit 7 of the first map byte corresponds to the first byte after the PRL header.

If a bit is set in the map, a byte in the file is relocatable. For a PRL file whose header was loaded at xx00 hex, relocatable bytes should have xx added to them. In practice, the header is discarded; so an alternative formula is that if the first byte of code/data is at xx00h, then xx-1 should be added to relocatable bytes.

For SPR files, which are based at 0 rather than 0100h, add xx + 1 and xx respectively.

Return to archive listing