# ne

> **Tool `tools/dos/ne.py`** (library, 16-bit DOS). Read MZ (DOS) and NE (16-bit protected mode, Windows 3.x) executables: the shared parser behind dosinfo.py and readseg.py.

A library: other tools and your own scripts import it. [Source on GitHub](https://github.com/tanepiper/game-frame/blob/main/tools/dos/ne.py).

## Its own help

This is the help text in the tool itself, as `./gameframe tool ne` prints it.

```text
Read MZ (DOS) and NE (16-bit protected mode, Windows 3.x) executables: the shared parser
behind dosinfo.py and readseg.py. Standard library only.

    from ne import load
    exe = load('game.exe')      # an MZ or NE object; exe.kind is 'MZ', 'NE', 'LE', 'LX' or 'PE'
    exe.segments                # NE: list of Segment (number, selector, file offset, length, flags)
    exe.file_offset(0x1008, 4)  # file offset of selector:offset (NE) or segment:offset (MZ)

Addresses follow Ghidra: NE segment N has selector 0x1000 + 8 * (N - 1); an MZ image is loaded
at segment 0x1000. It does not parse resources, LE/LX internals or overlays (it only reports
that they are there).
```
