Microsoft REL file format
The REL format is generated by Microsoft's M80 and Digital Research's RMAC. The following description is from the Digital Research Programmer's Utilities Guide for CP/M+; comments in brackets refer to RMAC syntax.
M80 is capable of generating some record types which DR's LINK-80 can't handle. I don't know if these are present in the list.
REL files contain information encoded in a bit stream, which LINK-80 interprets as follows:
- If the first bit is a 0, then the next 8 bits are loaded according to the value of the location counter.
- If the first bit is a 1, then the next 2 bits are interpreted as
- special link item, defined below.
- program relative. The next 16 bits are loaded after being offset by the program segment origin.
- data relative. The next 16 bits are loaded after being offset by the data segment origin.
- common relative. The next 16 bits are loaded after being offset by the origin of the currently selected common block.
Special link items
A special item consists of:
- A 4-bit control field that selects one of 16 special link items described below.
- An optional value field that consists of a 2-bit address [type]
field and a 16-bit address field. The address type field is
interpreted as follows:
- program relative
- data relative
- common relative
- An optional name field that consists of a 3-bit name count followed by the name in 8-bit ASCII characters.
The following special items are followed by a name field only:
- entry symbol. The symbol indicated in the name field is defined in this module, so the module should be linked if the current file is being searched, as indicated by the S switch. [PUBLIC declaration]
- select common block. Instructs LINK-80 to use the location counter associated with the common block indicated in the name field for subsequent common relative items.
- program name. The name of the relocatable module.
The following special items are followed by a value field and a name field.
- define common size. The value field determines the amount of memory reserved for the common block described in the name field. The first size allocated to a given block must be larger than or equal to any subsequent definitions for that block in other modules being linked.
- chain external. The value field contains the head of a chain that ends with an absolute 0. Each element of the chain is replaced with the value of the external symbol described in the name field. [used by EXTRN etc]
- define entry point. The value of the symbol in the name field is defined by the value field. [PUBLIC definition]
The following special items are followed by a value field only.
- external plus offset. The following two bytes in the current segment must be offset by the value of the value field after all chains have been processed.
- define data size. The value field contains the number of bytes in the data segment of the current module.
- set location counter. Set the location counter to the value determined by the value field.
- chain address. The value field contains the head of a chain that ends with an absolute 0. Each element of the chain is replaced with the current value of the location counter.
- define program size. The value field contains the number of bytes in the program segment of the current module.
- end module. Defines the end of the current module. If the value field contains a value other than absolute 0, it is used as the start address for the module being linked. That is, the current module is the main module. The next item in the file starts at the next byte boundary.
- end file; has no value field or name field. This item follows the end module item in the last module in the file.