mirror of
https://github.com/ksherlock/iigs.git
synced 2024-06-08 09:29:29 +00:00
notes
commit
d7b6a70539
50
Merlin-16-REL-Format.md
Normal file
50
Merlin-16-REL-Format.md
Normal file
|
@ -0,0 +1,50 @@
|
|||
* File Type: `$F8` (User #8)
|
||||
* Aux Type: (offset of relocation table)
|
||||
|
||||
Relocatable intermediate files are generated via the `REL` pseudo op. OMF object files may also be converted to REL format with the CON command (via the editor command box).
|
||||
|
||||
The file is assembled, and all expressions are evaluated, with an origin of `$8000`. External labels are given an address of `$8000`
|
||||
|
||||
Bytes 0 -- (aux type-1) are the assembled data.
|
||||
This is followed by 0 or more relation records, a 0 byte, 0 or more label entries, and a 0 byte.
|
||||
|
||||
## Relocation Records
|
||||
|
||||
Relocation records are 4 bytes long. The first bytes is a flag byte. This is followed by a 16-bit offset, and an 8-bit operand byte. For external references, the operand byte is the external symbol number. For local references, the operand byte is the low 8-bits of the assembled operand.
|
||||
|
||||
|
||||
### Shifting
|
||||
|
||||
Shifts (16 bit or 8 bit only) use two relocation records. The first record uses a flag byte of `$ff`. This is followed by the offset and operand/symbol number as above.
|
||||
|
||||
Following the `$ff` record is the shift record.
|
||||
|
||||
* `$d0` is the shift operand.
|
||||
* bit 2 is the external (`$04`) / internal flag.
|
||||
* `$d0` is a 16-bit, 1-byte shift (n.b. due to 24-bit address space, high byte of a 16-bit shift is always 0).
|
||||
* `$d1` is an 8-bit, 2-byte shift
|
||||
* `$d3` is an 8-bit, 1-byte shift
|
||||
|
||||
Other shift sizes are not supported.
|
||||
|
||||
This is followed by a 3-byte address of the value before shifting (as always, assuming an origin of `$8000`)
|
||||
|
||||
## Labels
|
||||
|
||||
The label type and length are encoded in the first byte.
|
||||
|
||||
* bit 5 (`$20`) indicates an absolute label (ie, exporting an `EQU`)
|
||||
* bit 6 (`$40`) indicates a local (ENTry) label.
|
||||
* bit 7 (`$80`) indicates an EXTernal label.
|
||||
|
||||
This is followed by the label and a 3-byte address.
|
||||
|
||||
For local and EQU labels, this is the label address (based on the `$8000` origin).
|
||||
|
||||
For external labels, this is the external label number + `$8000`.
|
||||
|
||||
## References
|
||||
* Merlin 816 Macro Assembler Manual
|
||||
* Merlin 16+ source code
|
||||
* Quick Asm source code
|
||||
* Empirical testing
|
Loading…
Reference in New Issue
Block a user