readseg
Tool
tools/dos/readseg.py(program, 16-bit DOS). Read typed values from a DOS (MZ) or 16-bit NE executable at Ghidra's seg:off addresses.
Run it with ./gameframe run readseg ARGS or python3 tools/dos/readseg.py. Source on GitHub.
Its own help
This is the help text in the tool itself, as ./gameframe tool readseg prints it.
text
Read typed values from a DOS (MZ) or 16-bit NE executable at Ghidra's seg:off addresses.
Usage: readseg.py BINARY TYPE ADDRESS [ADDRESS ...] [--count N]
The 16-bit counterpart of tools/pe/readdata.py, for the DAT_1008_0004 globals in pseudocode and
for Pascal "typed constants" (initialised variables in the data segment). TYPE is:
u8 i8 u16 i16 u32 i32 integers (Pascal byte, shortint, word, integer, longint)
ptr a far pointer, offset word then segment word, printed seg:off
real48 Turbo Pascal's 6-byte Real (not IEEE: exponent byte first)
f32 f64 f80 single, double, extended (x87 80-bit)
pstr a Pascal string: a length byte, then the text (string[N])
cstr a zero-terminated string
hex 16 * count raw bytes
ADDRESS is as Ghidra prints it: 1008:0004, DAT_1008_0004 or FUN_1000_0028 (NE selectors are
0x1000 + 8 * (segment - 1); MZ images are loaded at segment 0x1000). `--count N` reads N
consecutive values (a table). Values are as stored in the file, before the program runs:
relocated words (selectors, far pointers to segments) still hold the file's placeholder.
It does not read memory the program fills at run time (use dos_emu or DOSBox-X for that).Named by
Skills: re-ghidra.