I wrote a thing or two about it here:
Runtime error 200 at 26A0:01C4
Oh, that's bad. Maybe there's some command line option I can set? Run TOPBENCH -h, and
Runtime error 200 at 26A0:01C4
Oh fsck. It crashes even before parsing the command line!
- ao486 is not fast enough to trigger the issue
- @MobyGamer knows about that issue and wouldn't ship a program where this is still present
- the various tools that patch Turbo Pascal executables to fix this didn't find anything
But wait ... didn't I get some meaningful output from the program when running under EMM386?
Booted again (this time with EMM386), and sure enough, the program *just works*. I could actually do some benchmarks with it:
- works perfectly fine when EMM386 and its EMS emulation are active
- crashes with a mysterious "runtime error 200" (which translates to "division by zero", by the way) during early initialization when EMM386 is *not* active
I could also confirm that it's really during early initialization, as the TP IDE wouldn't let me step a single line of code before hitting the crash - not good, but expected.
But I got an idea this way: [>>]
That worked perfectly, and I quickly found a unit that crashed.
function GetMode: byte;
var regs: registers;
begin
with regs do begin
ax := $0F00;
intr($10, regs);
GetMode := al;
end;
end;
function GetMode: byte;
var res: byte;
begin
asm
mov ax, 0F00h
int 10h
mov res, al
end;
GetMode := res;
end;
In practice, however, there was: The original code that uses the Intr() library function crashes, while the inline assembly version works just fine!
But before fixing those, I got this nagging feeling: WHY does it crash?
Meanwhile, @MobyGamer sent me the assembly source of Turbo Pascal's standard library's Intr function, I looked at it ... and then it hit me.
Mystery solved, bug filed! github.com/MiSTer-devel/a…
(I bet there's a good reason to do it this way, but I don't want to investigate. If you know it, please respond!)