IBM PC (x86) emulator

If you’re looking for a small, simple, light-weight x86 emulator, 8086tiny might be a good call.

The main problem with it is that it was written by a dude who writes code for the Obfuscated C Contest (as a matter of fact, the obfuscated version of 8086tiny won in 2013*) — and it shows. The “documented, commented, maintainable version” (his words) is written in a way… let’s just say that if you were a programme manager and one of the team members wrote code like this you would be a very worried person. Like DJ Bernstein’s daemontools or qmail, it’s clearly written by someone who Has Clue, but should not be approached by someone who doesn’t.

For example, the code comes with a BIOS. The BIOS also includes the instruction lookup table, which is obviously a critical part of the code, and has nothing to do with the BIOS…

Anyway, I managed to import the BIOS for the NEC APC into the memory space (the standard BIOS lives at 0xF0100 (F000:0100)  – 0xF1Ef2 while the NEC BIOS lives at 0xFE000 (FE00:0000) – 0xFFFFF).  There are clashes, the 8086tiny BIOS actually writes its own reset vectors to what would normally be part of the BIOS EPROM at 0xFFFF0, overwriting the NEC vectors, and it puts the stack at 0xFF000 (F000:F000) which is in the middle of the NEC BIOS — but I can fire up the emulator and use debug to look at the NEC BIOS so I guess it’s a matter of time before I maybe modify this thing to emulate the APC and not a PC XT.

Or not. Round ‘tuits are scare sometimes.

* Look, I’ll give him a lot of points for style, but I feel making the BIOS blob a critical part of your code and then not counting its size is kind of… cheating. But hey. It _is_ beautiful to look at.