Multi-format linker producing flat binaries (COM), MZ executables (EXE), and REX relocatable format. Supports automatic object reordering and dead code elimination.
| Binary | Format | Use Case |
| hclink-bin | Flat binary | CP/M .COM, ROM images, raw memory |
| hclink-mz | MZ EXE | MS-DOS .EXE with independent segments |
| hclink-rex | REX relocatable | Relocatable executables with relocation table |
Flat Binary
hclink-bin -text 0x100 -o program.com start.obj main.obj lib.lib
hclink-bin -o firmware.bin code.obj data.obj
hclink-bin -text 0x4000 -bss 0xC000 -o game.rom game.obj
MZ EXE (MS-DOS)
hclink-mz -stack 1024 -o program.exe start.obj main.obj lib.lib
Segment deltas automatically computed:
| Constant | Value |
| __data_seg_delta__ | Paragraphs from TEXT to DATA |
| __bss_seg_delta__ | Paragraphs from TEXT to BSS |
| __stack_top__ | Top of stack (BSS + stack size) |
REX Relocatable
hclink-rex -o program.rex main.obj lib.obj
hclink-rex -sym symbols.txt -o program.rex main.obj
Produces an REX-format relocatable executable with a 18-byte header, sections, and a word-based relocation table. Ideal for custom operating systems and embedded environments where the loader needs to place code at arbitrary addresses.
Options
| Option | Description | Applies to |
| -o <file> | Output file (default: a.bin) | All |
| -sym <file> | Symbol table output | All |
| -multicpu | Ignore mismatched CPU types in objects | All |
| -v | Verbose output | All |
| -text <offset> | Text section start address | BIN |
| -data <offset> | Data section start address (default: after text) | BIN |
| -bss <offset> | BSS section start address (default: after data) | BIN |
| -align <size> | Section alignment in bytes (default: 16) | BIN, REX |
| -stack <size> | Stack size in bytes (BIN default: 1024, MZ default: 4096) | BIN, MZ, REX |
| -max-mem <size> | Max memory available (default: 61440) | BIN, REX |
Features
- Object Reordering: _start object automatically placed first
- Dead Code Elimination: Unreferenced objects excluded
- Symbol Table: -sym symbols.txt exports all labels with addresses