Writing emulators (Was: SimH DECtape vs. Tops-10 [was RE: Writing emulators [Was: Re: VCF PNW 2018: Pictures!]]
Fred Cisin
cisin at xenosoft.com
Mon Feb 26 15:15:33 CST 2018
>> The purpose of an emulator is to accurately pretend to be the original
>> hardware. It doesn't matter that the original OS runs on a particular
>> emulator. If a program can be written that runs on the original hardware
>> but fails on the emulator then there is a flaw in that emulator.
On Mon, 26 Feb 2018, Paul Koning via cctalk wrote:
> That's true. But it is unfortunately also true that creating a bug for
> bug accurate model of an existing machine is extremely hard.
There is always a decision to be made, whether to mimic the behavior, or
mimic how it is supposed to behave. If you are aware of a bug in the
original, do you emulate that bug? There was once a New Yorker cartoon,
where a mechanic told a customer, "For $300 we can get it to run like new.
For $600 we can get it to run like it should."
Emulation of the bugs can not simply be ignored.
Surely, you could get away with not emulating the truncated mantissa FDIV
bug? Not necessarily.
Sometimes timing can be important. Using a do-nothing loop for a time
delay was never a good idea (and optimizers would remove it), but it did
happen, ranging from crude amateur programs, to crude copy protection.
I remember when it was sometimes necessary for MS-DOS code to determine
what processor it was running on. Since not all processors provided an
"Identify yourself" command, it was done through checking for bugs,
obscure differences, etc. Such as checking the size of the pre-fetch
buffer, or whether a double prefix was maintained after an interrupt (REP
ES:MOVSW). There was no offical method for identification. I remember
an article in Microcornucopia that mentioned an Intel sanctioned
set of methods; the author couldn't remember where he got it; I called
Intel, and after many transfers reached somebody who understood the
question; he had no idea, but asked me to forward him a copy if I did
ever find it.
So, it becomes necessary to have massive configuration settings, to be
able to emulate as spec'ed, or as which set of the variant bugs.
It's hard enough just getting it to work!
When the first software based PC emulator for the Amiga came out, it
worked [well enough to run XenoCopy on some formats]. But, people
griped because it wasn't faster than their current PC.
Geez! They got an elephant to fly, and people gripe about the speed and
payload capacity!
--
Grumpy Ol' Fred cisin at xenosoft.com
More information about the cctech
mailing list