This project has been an adventure of the most ridiculous sort...

At the time I started this project-page I planned on emulating an 8088 in an AVR, so the AVR could be a drop-in replacement for the original CPU in an IBM PC/XT clone. The discovery that the original 8086 ran at something like 0.3MIPS, and the knowledge that AVRs can run at 20MIPS gave me the idea that maybe it would be possible to emulate an (even slower) 8088 in an AVR at usable-speeds, and maybe even run faster than the original.

I spent quite a bit of the lead-up time learning the (then, to me) "black-box" that x86-architecture has been to me for decades. This was aided by the fact that the original technical references for the 8088/8086 go into quite a bit of detail explaining *why* they made decisions they made in this (then new) design, in comparison to Intel's earlier processors, like the 8085, which are much more similar to the Atmel AVRs I'm so familiar with. E.G. Why do they use "segments" in the x86 architecture? And what the heck does 33:4567 mean, as an address, anyhow? (One of the many things I couldn't wrap my head around in previous endeavors trying to understand the x86 architecture).

From there, I went on to [re]assemble my PC/XT clone from parts that'd been poorly-stored for years in various boxes with other scrap PCBs and no anti-static bags. That endeavor, alone, was utterly ridiculous; leading me to sleep upright on a tiny spot on my couch for days, if not weeks; home filled with open boxes, cat sleeping angrily under the TV. And some completely unexpected, and amazing, results in the process. Including meeting someone who emailed to me exactly the (very rare) information I needed within 3 hours of my contacting an email address found in a forum post written 17 years earlier. (whoa!). Also, the surprising discovery that PNPs' emitters can be connected to the ground-rail and make for a [only slightly-differently]-functional circuit than the NPN I'd intended. Also, some "fun" with computers that seemingly-consciously refused to be of assistance (one, quite literally, glaring back at me in contempt).

As it stands, I've finally got the PC/XT clone assembled and running in an ATX case, and, with the help of a fellow HaDer, even installed my very first x86-Assembly program as a BIOS-Extension ROM, that it boots straight into!

---------

Still, at this point in the story, I'd been planning to emulate the 8088/86 instruction-set within my AVR... And I'd done quite a bit learning about the instruction-set...

"That's a pretty big lookup-table, nevermind all the code. But I have *some* ideas about how to shrink it... maybe at the cost of execution-speed."

Also, at this point in the story, I started considering other ideas, such as emulating *hardware* within the AVR... Thanks to some other projects 'round HaD. E.G. Why use the 8250 UART, on an ISA card, when the AVR has a USART built-in? I did the math, and discovered that writing a byte to the AVR's USART transmit-register would take ~3AVR instruction-cycles, whereas doing the same with the 8250 could take more than ten times as long! Similarly, if the 8088's 8KB BIOS ROM was stored within the AVR, rather than on the 8088's "bus-interface", execution of the BIOS (the Basic Input/Output System, used for *way* more than just POST!) could be *significantly* faster.

------------

This is the point in the story where I take a step back and start thinking about what led me here in the first place... not only in terms of what I'd discovered *during* the project, but what led me to start this project...? And I realized, the goal from the beginning, from *years* before starting this "project," was to use an otherwise now-outdated (some might say "useless") system's motherboard and peripherals with the processor-architecture I'm already familiar (AVRs).

So, emulation of the x86 instruction-set/architecture was never really in the original goals... I got sidetracked (what? Me?!). But it has been a useful learning-experience.

For instance, the PC/XT's BIOS Assembly-listing is available and well-commented... This resource, with a little understanding of x86 assembly, is more than enough information to recreate the hardware/peripheral interfaces (aka "drivers") for any architecture.

It's very likely feasible, from the information there alone, to program my AVR to draw graphics using the CGA card in the near future.

-----------

So, I've been spending some time focusing on the 8088's "bus interface."

The 8088's bus-interface is... a bottleneck. In fact, if you do the math as I did, then you'll find that the bus-interface maxes-out at ~1MB/s. If you consider that the 8088-instructions average roughly 3 instruction-bytes apiece, then consider that many instructions also have to access external memory-locations (such as RAM or I/O), you might come to the same conclusion as I, that the processor's speed is less-limited by its execution-time than it is by its bus-interface. In fact, look at those numbers again... Say 3 instruction-bytes and, say, 0.3 memory-accesses, on average, per instruction... then we're right at the 0.3MIPs alleged about the 8086.

So, no matter how fast the AVR (or any processor, maybe even the 8088) may be, if it interfaces via the 8088-bus to get its instructions, it will be limited to something like 0.3MIPS.

I've little doubt that, even emulating 16-bit x86 instructions, a 20MHz=~20MIPS 8-bit AVR could execute numerous x86 instructions in the time it takes to retrieve one via the bus!

BUT: This project didn't start as an emulation-project... Or, rather, it did, but it wasn't conceived of that... It was conceived from the idea of being able to make use of the various peripherals available to x86 (rather 8-bit ISA) systems; CGA cards, Soundblasters, SCSI, maybe... HPIB? Who Knows!

In that regard: Accessing the 8088 bus is essential. But, not for *everything* like it would be for the 8088. Also, instruction-set emulation isn't really a concern, though it may make things easier (certainly it'd be easier to use already-existent x86-compiled drivers, than to write new ones!).

Anyways, this is where we're at, now... in the story.

If I wanted to make an AVR-based Personal Computer, there'd be *much smarter* (and much faster!) ways to go about it; using SD-Cards, PS/2 keyboards, SPI-based LCDs, etc. Even byte-banged SRAMs would be significantly faster than the same SRAM accessed via the 8088-bus. And, indeed, many really smart folk 'round HaD have done-so.

Realistically, there's no reason to do this project.

But, this is where I'm at... Emulating not the instruction-set, but the *interface* of the 8088 CPU... [apparently] the biggest bottleneck in the system. Don't ask me why.

------------------

Status 3-24-17:

I have managed to access the full 640KB of DRAM reliably, can read/write through the ISA-bus-interfaced Parallel-port, and can load colors/characters to the CGA card, reliably.

At this point, it seems pretty functional. And I've looked into the programming-specs for the Sound Blaster card... Seems doable.

I have been avoiding learning about the DMA controller and Interrupt system. They're not necessary for basic functionality, so far.

(TODO: Links, links, links!)