I'm trying to emulate programs from the 80s, but with an accurate clock-speed (pretending its an 8086). Meaning that if a 8086 would take X ms/opcode, the emulator should take X ms (+- a bit of jitter as I'm not running a RTOS). If it should take Y ms to access RAM, the emulator should take Y ms to access RAM.
PCem aims to be an accurate emulator, and its 8086/8088 timings are accurate. It can emulate a wide variety of hardware, and can model specific PCs with their ROMs (such as the original IBM PC, the Amstrad 1640, and many others). It is available for Linux and Windows.
Not an emulator but the MicroCore Labs MCL86 is a 8086/8088 core which has the option to be "cycle-compatible" (accurate to within one or two clocks) with a 4.77 MHz 8088. I don't know if it accesses RAM cycle-accurately. A compatible board (Lattice MachXO2-7000HE) is about $30.
The i8086emu might be right for you. It emulates a rather straight foreward 8086 singleboard computer with the somewhat generic name SBC8086 :)) That machine runs on 5 MHz, and the emulator is suppoesed to be close. It's made to run under Linux, using GTK2 as frontend, but also compiles for 32 bit Windows.
UPDATE: I previously posted a way to print only a 16-bits number, but now I have found a way to print 32-bits number as well, so I decided to delete the previous solution. Here is the general idea:- Check if the number is negative or positive- If it's negative, negate it using two's complement. But we must take care of a corner case: a signed 32-bits number goes from -2^31 to 2^31-1 so we can see that there is no positive equivalent of -2^31. So we must single out this case and store the corresponding number (in string format) and print it- If it's positive, then we repeatedly divide by 10, take the remainder, push it onto the stack, afterwards pop back and print each number consecutively (this is easy since Assembly x8086 has provided the appropriate routines)By the way, in my code I also checked if the 16-bit upper part is zero, then go to the _16bits_routine, which is based on the same principle.However, dividing by 10 is not trivial in 32-bits since the div function does not support it, so here's what I do:
EMU8086 - MICROPROCESSOR EMULATOR is a free emulator for multiple platforms. It provides its user with the ability to emulate old 8086 processors, which were used in Macintosh and Windows computers from the 1980s and early 1990s. It can emulate a large amount of software that was used on these microprocessors, but a savvy user can also program their own assembly code to run on it.
EMU8086 - MICROPROCESSOR EMULATOR primarily emulates the processor, not the other functions that a microcomputer running a 8086 processor would have. However, it still serves many of the same functions that an emulator for a more specific microcomputer might have, and more besides. For example, both the NEC-P9801 and early IBM-compatible computers used the 8086. Using EMU8086, one might be able to write assembly software that can run on either of those devices. On the flip side, EMU8086 can't access some of the more advanced hardware functionality that you might find in the monitors or other components of those devices.
Overall, EMU8086 - MICROPROCESSOR EMULATOR will be useful to computing enthusiasts and gearheads, and anyone who happens to work with this legacy processor even today: some computers, particularly in business and industrial applications, still use the 8086. Whether it's to tinker or to work, if you think you might want to emulate the 8086, start here.
Finally, UniPCemu supports importing instruction output in the common emulator format for verification(It'll dump information when a mismatch occurs). You'll just have to redirect the output from your emulator to UniPCemu's input(using simple piping) and have UniPCemu start it's verification using the "debuggerin"(unquoted) command line parameter(debuggerout does the opposite, dumping it's own debugger output to stdout instead of reading from stdin). Said read data(line endings automatically converted) from stdin is compared with it's own. If a mismatch occurs, ""(without quotes) is logged after any mismatching line not matching UniPCemu's logging.
Thanks for replying to this thread. I am going to integrate the 186 tests into my WIP emulator as well and use the example from your code for how they are supposed to be run. It's really too bad that the tests don't have a license... If anyone knows the license please let us know. Does anyone know the original source of them before they made their way onto this forum?
The 80186 tests by Artlav were helpful to me, but unfortunately (unless I'm mistaken in my interpretation of them) they make a lot of poor assumptions. For example some of them assume flag results for instructions that set some of their flags to undefined. Others assume exact memory locations when the tests have been modified over time and those locations no longer hold. I still have CPU bugs and I am still looking for good 8086 CPU tests that can be loaded in place of a BIOS or run completely independently. To see how I'm using the Artlav CPU tests, you can find the tests in my repository here:
Yea, the 186 tests got me to a point where FreeDOS runs (seemingly flawless). So does most games that I have tested.
But I can still not boot any version of MS-DOS or Windows 3.0 yet. So there are obviously still issues with my emulator.
Hi, all. I've been writing an 8086 (actually 80186) PC emulator for the Arduino Due. You can interface with it via VNC using a Wiznet 5x00 Ethernet module/shield. I'm working on making it function on a Mega2560 as well, but that's not working quite right yet. Will update if I get that going.
There is a CPU emulation engine which steps through the memory the same way a real 8086 does, interpreting and executing x86 machine instructions how the original CPU does, but with equivalent C code and variables simulating the hardware logic and registers.
It uses an SD card in raw mode as a hard disk. You can either just start with my included disk image, or make your own and install DOS with another emulator like PCem/86Box/Fake86. The emulator expects 16 heads, 63 sector disk geometry. It can be up to a 500 MB image.
So, the speed. It's pretty slow. Quite a few times slower than a real 8086/8088. With a VNC client connected, it's much worse while video memory is being written to! Sending out all the screen updates in real time slows it way down. It's really bad. Don't expect to be be playing any games at usable speeds. I'm not sure how much this can be mitigated, but if anybody wants to have a go at optimization, have at it! Share your improvements if you want.
We made an Intel 8086 Emulator in Rust. The commandline version is at : -Emulator. Then we compiled it to WASM and integrated with React to make a front-end only 8086 Emulator website. Repository is -Emulator-Web/. It is hosted on GitHub pages at : -emulator-web/.
Please check it out, and let us know how it is. If you think it is interesting, please start the repos ?
In my recent semester we had Microprocessors as a subject, and more than half of it was based on Intel 8086 microprocessor. Now usually when the labs for this were taken, one would probably use some kind of kits or such to write programs of 8086 instruction set x86 assembly, and test it out. But... as this time it was conducted online, we had to use something else. Now the emulator we were supposed to use , in my opinion , had some issues.
While searching for some other 8086 emulator to use, I came across -simulator/, which is a 8085 emulator. This seemed a really cool thing, made in Angular and using JS to run the assembly. (Check it out as well, it is quite cool!)
But other than that, I couldn't find a 8086 emulator.
As I had seen the 8085 emulator, it seemed a pretty good idea to make mine also in web version, but I didn't want to write complete Lexer and parser part in JS. As I also wanted to make a commandline version as well, the best Option seemed to be making a core library in Rust and then make different interfaces for both version, compile Web version to WASM and integrate it with front-end. And (bad Rust pun ahead..) that turned to be Some(Emulator) ?
So, my friends and me went ahead, and made the core library, the 'drivers' (interfaces for both versions) and the React frontend, compiled Rust code to WASM, tries to integrate them, found bugs in code, fixed bugs in code ; Rinse and repeat few more times, and got ourselves an 8086 emulator ? ?
Both versions allow most of the instruction set of 8086 assembly, with exceptions of few instructions used to interface with external devices or so, and only allows selected few interrupts, as it does not store the instructions in memory which is required by Interrupt Service Routines. It gives complete 1 MB Memory to store data, and access to all registers which 8086 architecture has.
What's in: barely enough of the 8086 instruction set to run the example binary flawlessly. Self-modifying code is supported. (prefetch: zero bytes)
Ironically, the first sufficient iterations of the code were longer and supported less of the opcode span. Refactoring ended up beneficial both to code length and to opcode coverage.
I've written a full 80186/V20 PC emulator (with CGA/MCGA/VGA, sound blaster, adlib, mouse, etc), it's not a trivial thing to emulate an 8086 by any means. It took many months to get fully accurate. Here's the CPU module only out of my emulator.
I'll be the first to admit I use wayyy too many global variables in this emulator. I started writing this when I was still pretty new to C, and it shows. I need to clean some of it up one of these days. Most of the other source files in it don't look so ugly.
aa06259810