I'm using IDA to disassemble Test Drive III. It's a 1990 DOS game. The *.EXE has MZ format.
The game uses a number of anti-reversing features such as copying its code to segment (PSPseg+2be7)
where PSPseg
is the initial value of ES
(i.e. the segment where PSP resides). As far as I know, COM executables are always loaded right after the end of Program Segment Prefix (PSP)
, so that both PSP and exe fit into one segment. What about MZ executables? Is there any fixed place where application's PSP is located relatively to the application itself?
In other words, is the base-PSPseg
offset always the same? On my DOSBox at the start of the program execution CS
is always 0x22CF
, ES=DS=0x01FE
, CS0
in the MZ header is 0x20C1
, yielding base-PSPseg
offset 0x0010
(16 segments, 256 bytes - exactly the size of PSP).
If this offset is not fixed and both PSP and the application are just loaded randomly in whatever memory location is big enough, then is there at least any guarantees about their addresses? Like that PSP address is always lower than the app's base address?