IRL file format
An IRL file is an indexed REL file. The index is used to improve linker performance.
A file offset in an IRL is three bytes long:
DB high ;(File offset >> 14 ) & 0x7F
DB middle ;(File offset >> 7 ) & 0x7F
DB low ;(File offset 1 ) & 0x7F
The IRL file consists of three sections:
IRL header
This is 128 bytes long. Only the first three bytes are used; these contain the file offset of the REL image (see below). The other bytes are set to zero.
DB h,m,0 ;Offset to REL image. The "low" figure is always 0;
;the REL image will be aligned to 128 bytes.
DS 125 ;Unused, set to 0
Note that bit 7 of the first byte is always zero. In an orthodox non-indexed REL file, bit 7 of the first byte will always be 1 (the first bit of the Module Name record).
Symbol table
The symbol table is at offset 80h in the file, and contains a number of variable-length symbol records. Each record is formed:
DB h,m,l ;Offset to the REL module containing the symbol,
;from the start of the REL image.
DB 'SYMBOL' ;ASCII, 1-8 characters
DB 0FEh ;End of string
The end of the table is marked by a zero-length symbol:
DB h,m,0 ;Length of the REL image. Note that this does NOT
;give the offset of the "EOF" record in the REL image;
;it gives the number of bytes in the REL image
;including those that pack it out to a multiple of 128
;bytes in length.
DB 0FEh ;End of string
After this record, the table is then packed out (LIB uses 1Ah as the packing character) to the next 128-byte boundary.
REL image
The REL image then follows. This is in standard REL format. To convert an IRL library to a REL library, just remove the header and symbol table.
Last edited by Shaos on 03 Sep 2012 13:20, edited 1 time in total.
Я тут за главного - если что шлите мыло на me собака shaos точка net
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 follows:
00
special link item, defined below.
01
program relative. The next 16 bits are loaded after being offset by the program segment origin.
10
data relative. The next 16 bits are loaded after being offset by the data segment origin.
11
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:
00
absolute
01
program relative
10
data relative
11
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:
0000
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]
0001
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.
0010
program name. The name of the relocatable module.
0011
unused.
0100
unused.
The following special items are followed by a value field and a name field.
0101
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.
0110
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]
0111
define entry point. The value of the symbol in the name field is defined by the value field. [PUBLIC definition]
1000
unused.
The following special items are followed by a value field only.
1001
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.
1010
define data size. The value field contains the number of bytes in the data segment of the current module.
1011
set location counter. Set the location counter to the value determined by the value field.
1100
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.
1101
define program size. The value field contains the number of bytes in the program segment of the current module.
1110
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.
1111
end file; has no value field or name field. This item follows the end module item in the last module in the file.
Я тут за главного - если что шлите мыло на me собака shaos точка net