First post, by GloriousCow
- Rank
- Member
I come seeking advice for how to implement what I thought should be a fairly straightforward emulator feature - I'd like to be able to set a breakpoint on DOS program start.
I know I can run a debugger under emulation, but it would be nice if I could just pause the emulator at the first instruction of a new program run from command.com. I can sort of do this knowing that the first program I run after boot will usually be loaded at a specific address assuming the machine parameters and DOS version are the same, but it's a hack and only works for the first program run. For DOS 3.3, for example, the first program will usually get loaded at 0CA2:0100. For DOS 5.0, it's 0F19:0100. I'd really like something that didn't rely on magic numbers.
int21h, 4b (https://stanislavs.org/helppc/int_21-4b.html) seemed like a promising place to start. But it doesn't seem to return while the process is running.
Stanislav's lists int21, 55h (https://stanislavs.org/helppc/int_21-55.html) as an undocumented interrupt that sets up a new PSP. It says it is valid from DOS 2.0 and on, but I don't actually see it called on either DOS 3.3 or 5 when logging all interrupt 21h calls.
All I really need is some reliable way to determine the code segment of the new process after int21h, 4bh is invoked. Any ideas?
MartyPC: A cycle-accurate IBM PC/XT emulator | https://github.com/dbalsom/martypc