CP/M pages
Home -> CP/M -> CP/M 3 COM file header

CP/M 3 COM file header

Under CP/M 3, COM files can have a 256-byte header (attached by GENCOM). Assuming the file is loaded at 0100h, then the format of the header is:

0100	DB	0C9h	;Magic number - "RET". This prevents the header
			;being executed on older systems which don't know
			;about this file format.
0101	DW	len	;Length of the original COM file (minus the header and
			;any RSXs that have been added to it). This will
			;be in memory at 0200h, and should be moved to 0100h
			;before it is executed.
0103	RET or JMP init	;Pre-initialisation code, which should return with a
			;RET. This will be called before the COM file is 
			;relocated, and is intended for SCBs: 
			;  GENCOM FILE [SCB=(x,y)]
010D	DB	l	;Loader flag. 0FFh = no RSX attached. Loader will 
			;remain active (called with GENCOM FILE [LOADER]).
010F	DB	n	;Number of valid RSX records, up to 15
0110	DS	10h	;1st RSX record
0120	DS	10h	;2nd RSX record, etc.

Each RSX record is:

01x0	DW	offset		;Offset of RSX image from file base (ie, add
				;100h to get RSX address)
01x2	DW	codelen		;Length of code and initialised data segment
01x4	DB	0		;Non-banked flag. 0FFh = load this RSX only in 
				;a non-banked system.
01x5	DB	0		;Unused
01x6	DB	'NAME    '	;8 bytes original RSX filename
01xE	DW	0		;Unused

Return to archive listing

John Elliott / Jim Lopushinsky 11 April 1998