Skip to content
ksherlock edited this page Jan 12, 2017 · 3 revisions

$F7 SUPER - This is a supercompressed relocation-dictionary record, Each SUPER record is the equivalent of many cRELOC, cINTERSEG, and INTERSEG records. It contains a 4-byte length, a 1-byte record type, and one or more subrecords of variable size, as follows:

Opcode: $F7
Length: number of bytes in the rest of the record (4 bytes)
Type: 0-37 (1 byte)
subrecords: (variable size)

When SUPER records are used, some of the relocation information is stored in the LCONST record at the address to be patched.

The length field indicates the number of bytes in the rest of the SUPER record (that is, the number of bytes exclusive of the opcode and the length field).

The type byte indicates the type of SUPER record. There are 38 types of SUPER record:

Value Super Record Type
0 SUPER RELOC2
1 SUPER RELOC3
2-37 SUPER INTERSEG1-SUPER INTERSEG36

SUPER RELOC2: This record can be used instead of cRELOC records that have a bit-shift count of zero and that relocate two bytes.

SUPER RELOC3: This record can be used instead of cRELOC records that have a bit-shift count of zero and that relocate three bytes.

SUPER INTERSEG1: This record can be used instead of cINTERSEG records that have a bit-shift count of zero and that relocate three bytes.

SUPER INTERSEG2 through SUPER INTERSEG12: The number in the name of the record refers to the file number of the file in which the record is used. For example, to relocate an address in file 6, use a SUPER INTERSEG6 record. These records can be used instead of INTERSEG records that meet the following criteria:

  • Both offsets are less than $10000.
  • The segment number is less than 256.
  • The bit-shift count is 0.
  • The record relocates 3 bytes.
  • The file number is from 2 through 12.

SUPER INTERSEG13 through SUPER INTERSEG24: These records can be used instead of cINTERSEG records that have a bit-shift count of zero, that relocate two bytes, and that have a segment number of n minus 12, where n is a number from 13 to 24. For example, to replace a cINTERSEG record in segment 6, use a SUPER INTERSEG18 record.

SUPER INTERSEG25 through SUPER INTERSEG36: These records can be used instead of cINTERSEG records that have a bit-shift count of $F0 (-16), that relocate two bytes, and that have a segment number of n minus 24, where n is a number from 25 to 36. For example, to replace a cINTERSEG record in segment 6, use a SUPER INTERSEG30 record.

Each subrecord consists of either a 1-byte offset count followed by a list of 1-byte offsets, or a 1-byte skip count.

Each offset count indicates how many offsets are listed in this subrecord. The offsets are one byte each. Each offset corresponds to the low byte of the first (2-byte) offset in the equivalent INTERSEG, cRELOC, or cINTERSEG record. The high byte of the offset is indicated by the location of this offset count in the SUPER record: Each subsequent offset count indicates the next 256 bytes of the load segment. Each skip count indicates the number of 256-byte pages to skip; that is, a skip count indicates that there are no offsets within a certain number of 256-byte pages of the load segment.

For example, if patches must be made at offsets 0020, 0030, 0140, and 0550 in the load segment, the subrecords would include the following fields:

2 20 30 the first 256-byte page of the load segment has two patches: one at offset 20 and one at offset 30
1 40 the second 256-byte page has one patch at offset 40
skip-3 skip the next three 256-byte pages
1 50 the sixth 256-byte page has one patch at offset 50

In the actual SUPER record, the patch count byte is the number of offsets minus one, and the skip count byte has the high bit set. A SUPER INTERSEG1 record with the offsets in the preceding example would look like this:

$F7 opcode
$00000009 number of bytes in the rest of the record
$02 INTERSEGl-type SUPER record
$01 the first 256-byte page has two patches
$20 patch the load segment at offset $0020
$30 patch the segment at $0030
$00 the second page has one patch
$40 patch the segment at $0140
$83 skip the next three 256-byte pages
$00 the sixth page has one patch
$50 patch the segment at $0550

A comparison with the RELOC record shows that a SUPER RELOC record is missing the offset of the reference. Similarly, the SUPER INTERSEG1 through SUPER INTERSEG12 records are missing the segment number and offset of the subroutine referenced. The offsets (which are two bytes long) are stored in the LCONST record at the "to be patched" location. For the SUPER INTERSEG1 through SUPER INTERSEG12 records, the segment number is stored in the third byte of the "to be patched" location.

For example, if the example given in the discussion of the INTERSEG record were instead referenced through a SUPER INTERSEG1 record, the value $0345 (the offset of the subroutine referenced) would be stored at offset $0721 in the load segment (the offset of the instruction's operand). The segment number ($0A) would be stored at offset $0723, as follows:

45 03 0A
Clone this wiki locally