79783137

Date: 2025-10-05 18:44:41
Score: 1
Natty:
Report link

In 16-bit NE (the “New Executable” used by Win 3.x / OS/2 1.x), you can’t practically use segment indices above 255 for code or data that needs fixups or exported entry points. The format does store the segment count as a 16-bit WORD, but all the places that refer to a segment inside the module (relocations, entry table) use an 8-bit segment number, which caps addressable segments at 255. That’s the real limit linkers/loaders work with.

Why the mismatch?

Segment table count (WORD): historical/structural choice. It doesn’t imply you can actually address >255 segments from within the module; it’s just how the header field was defined.

Relocation records: when the target is an internal segment, the relocation encodes the segment number in a BYTE, so only 1..255 can be referenced.

Entry table: exported entry descriptors also carry the segment number in a BYTE, so exports can only point into segments 1..255.

What about segments >255?

They are not usable for anything that requires a relocation to point at them or for exported entry points—because there’s no way to encode “segment 256+” in those tables.

The only practical “beyond-255” content would be things not addressed by segment numbers at all, e.g., resources, which are located via the resource table (type/id/language) and loaded by the loader using those IDs rather than a segment index. But those aren’t general code/data you call or reference with fixups.

In practice, linkers for NE refuse to produce a module with >255 loadable segments, or they’ll fail at link/load time.

So, if you need more than 255 segments worth of code/data, the traditional 16-bit strategies were:

Use fewer, larger segments (each up to 64 KiB in NE).

Use overlays (classic DOS/16-bit technique) or movable segments that are swapped in as needed.

Split into multiple modules (DLLs) so each has its own ≤255 segment space.

Move to a linear (LE/LX) or PE format where this 8-bit limit doesn’t exist.

Bottom line: the BYTE-sized “segment number” fields in the relocation and entry tables define the real ceiling. Segments with indices >255 are, for all practical code/relocation/export purposes in NE, unusable. The 16-bit count in the header is just a quirk of the file format definition, not an invitation to exceed that limit.

Good Luck sir :)

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Fran lopez