Emulating The IBM PC On An ESP32

The IBM PC spawned the basic architecture that grew into the dominant Wintel platform we know today. Once heavy, cumbersome and power thirsty, it’s a machine that you can now emulate on a single board with a cheap commodity microcontroller. That’s thanks to work from [Fabrizio Di Vittorio], who has shared a how-to on Youtube. 

The full playlist is quite something to watch, showing off a huge number of old-school PC applications and games running on the platform. There’s QBASIC, FreeDOS, Windows 3.0, and yes, of course, Flight Simulator. The latter game was actually considered somewhat of a de facto standard for PC compatibility in the 1980s, so the fact that the ESP32 can run it with [Fabrizio’s] code suggests he’s done well.

It’s amazingly complete, with the ESP32 handling everything from audio and video to sound output and keyboard and mouse inputs. It’s a testament to the capability of modern microcontrollers that this is such a simple feat in 2021.

We’ve seen the ESP32 emulate 8-bit gaming systems before, too. If you remember [Fabrizio’s] name, it’s probably from his excellent FabGL library. Videos after the break.

60 thoughts on “Emulating The IBM PC On An ESP32

    1. Dos is not really an OS when compared to Linux, it’s more like bootloader for games :-D
      There are actualy a games which can be loaded directly from GRUB instead of Linux, so i guess comparing DOS to GRUB would be a better comparison…

        1. you forgot the “D”, which narrows the context for the “OS” part. DOS is a system only for operating your disks. It’s mostly a file system driver rather than a full blown machine abstraction that Unix or VMS offers.

          That said, DOS was more advanced than earlier environments that had to be recompiled depending on how much RAM a machine was configured with. Dynamic memory allocation really is more convenient than fixed memory maps.

          1. Your confusing Graphical User Interface (GUI) Operating System (OS). Linux / *nix is a classic example you can overlay a selection of GUis over the top of the OS.

          2. “Your confusing Graphical User Interface (GUI) Operating System (OS)”

            And YOU’RE confusing “you are” with “belonging to you.”

            Not to mention… no, he isn’t. He’s also right about the D. I always wondered why, when the IBM PC came out, “DOS” was suddenly a general environment and not a disk-operating system.

            Hyphens are important.

          3. @[OG]

            He is at least confused with what he “sees” with no regard to whats “happening under the hood”.

            All those here who have knowledge of what happens under the hood agree with me.

            For me personally, I worked with many DOSs that came long before Microsoft or the Personal Computer existed. I programmed with these DOSs and just about every CPU or micro-controller that existed prior to about 8 years ago (retired now).

            I have programmed with every version of MS DOS and all Windows versions up to Window 7.

            I have programmed using many flavors of *nix / BSD, Apache, PHP, MySQL, JavaScript, HTML, XML, CSS as well when I did a stint in web development.

            So I believe I’m somewhat of an authority when it comes to knowing what is or is not an Operating System.

          4. I’ve written embedded RTOSes and released them in professional products. And have worked extensively on *nix kernels and device drivers for 20+ years. (mostly Linux, some Solaris and AIX).

            An appeal to authority won’t win this discussion.

          5. @[jonmayo]

            20+ years … so back to the very late 1990s or early 2000s … such a long time.

            What about before that like TRSDOS and NEWDOS in the late 1970s or the earlier systems at the very start of the microcomputer era.

            Your 20+ years is not comparable to my 50+ years

          6. “Your 20+ years is not comparable to my 50+ years”

            You struggle with that fallacy don’t you? I tried to show you and have failed to educate you in the matter.

            “What about before that like TRSDOS and NEWDOS”

            I’ve used NewDOS the most, but not professionally. I was just a punk kid playing around with coding (and games). It’s more of a fond memory than of any relevance to what the definition of Operating System might be. Especially considering back in the early microcomputer era there was not a lot of consistency in design or definition. Those 8-bit systems were control processors with a display and keyboard tacked onto them. The processors themselves weren’t designed with computing in mind, but minis were so expensive what choice did we have?

      1. What?!? DOS is the real OS (wanna burn all the cycles (almost) uniterrupted? write directly to ports? run 9-bit RS232 comm as god intended? … it’s all yours). Linux, Windows, … just bloatware.

        1. I am just saying that GRUB can perhaps do more stuff than DOS. Neither have multitasking, both can load and execute binaries from disk and GRUB even have software RAID and supports several filesystems which is something you don’t have on DOS. But yes, there is even way to chainload Linux from DOS. So DOS is about as complex as bootloader of Linux :-)

          1. I think we’re missing a big part of the definition of “operating system”, in that an operating system runs its applications while also staying loaded, and that it provides some core functionality and services to those applications.

            An application that needs to open a file or terminate itself or lots of other “system” things, will make a “system call”. This is a call that is usually mediated by a system runtime library which calls into the operating system kernel, and the operating system code runs to perform some privileged or system action on behalf of the application. MS-DOS, classic MacOS, macOS, Linux, Windows NT, and yes even Windows 3.1, all do this and that’s why they are operating systems. Grub can do a lot of things, but it doesn’t provide any system services to applications or even run at the same time applications are running, and that’s why it’s not an operating system.

            There’s lots of variations in the functionality operating systems can provide to applications written to run on them. For example, there are DOS kernel functions available by system call for character mode input and output… but if you want to do anything graphical, you have to go straight to the hardware from your application. Classic MacOS included in its kernel graphical functions and even the GUI toolkit and widgets.

          2. @samrolken

            Having SYSCALLs isn’t what defines an operating system. GRUB is still technically an OS. It’s just a highly monolithic one. Ironically Win3.x wouldn’t pass your test though because 3.x’s ABIs were DOS calls. Sure, there were APIs like GDI but they were slow user space libraries that wrapped around Windows internal APIs that wrapped around DOS ABIs. In some ways it was like a hypervisor running atop DOS. But crucially Win 3.x didn’t directly manage the hardware itself. So it’s an operating system in the same way that Chrome or Firefox is an operating system. Though I’m fairness for the 3.x era, Intel CPUs didn’t yet support the right instructions to create protected memory and the other advancements in rings that we come to describe kernel development. (Not that a lack of such tech held Apple, Acorn, Atari, nor Amiga back….)

      2. DOS has ABIs and an executable file format (ie a DOS executable isn’t automatically executable on bare metal). Though I will grant you that the machine code in DOS executables were damn close to raw machine code.

        It’s a dumb argument comparing an 80s operating system derived from a 70s operating system designed for mini computers with a 90s operating system derived from 70s multi user mainframes. It’s like comparing a push bike to a sports car and declaring the former isn’t a vehicle will missing scale of systems that falls under that heading.

        Likewise, GRUB is also an operating system. As is uEFI. Some even argue that Windows 3.x is an operating system too, though that’s stretching the term to its limits.

        1. It remains true that DOS is more like a program loader than what we usually think of as an operating system these days. Even though it’s technically an operating system, too. Just as a bicycle has more in common with a push cart than it does with a modern automobile. Even though it’s technically a vehicle, too.

          1. The whole point of an operating system is being a program loader. You look at what Linux, NT and Darwin are, how they work, etc. It’s literally just about creating an abstraction to safely run programs.

            Eg in Windows calc.exe and notepad.exe are not part of the operating system, it’s part of the user land programs that are shipped with the OS. Same goes for half the software on macOS.

            If you’re counting those components as an OS then it’s your interpretation that’s at fault, not the gulf that’s drifted between DOS and modern operating systems. Literally all an operating system does is create hardware abstractions to launch programs. POSIX might have an extensive array of ABIs that DOS lacked but ultimately that’s just a result of one having its heritage in multiuser mainframes and the other in single user micro computers.

      3. What do you mean? Obviously it is an operating system. It has a kernel and drivers and system calls, and provides many of the same things any other operating system provides, including handling input and output operations, doing things with files, handling date and time, managing process lifecycle… even networking functions and internationalization concerns.

        Sure, it might not be the most sophisticated or capable operating system, but it’s undoubtedly an operating system.

      4. PC-MOS/386 was a real operating system, though.
        And it had a DOS compatible ABI. Early versions ran on 16-Bit systems, too.

        Reducing DOS to MS-DOS only is very nearsighted, I belive.
        “DOS” became a whole family of operating systems.

        Real/32, Wendin DOS, Concurrent DOS, Multitasking MS-DOS 4.00, FlexOS etc just to name a few.

        Or let’s just think of Digital Research’s MPM which did run CP/M applications, but was a real OS.

        PS: Linux is no real OS either, it’s a bloated terminal emulator that pretends to be a kernal. ;)

    1. Maybe exactly because of the technology limitations. Whenever I wrote something for DOS, it became clean and simple because making complex stuff was so much effort. Now just a few quick library imports get millions of lines of complex code :)

      1. But you can literally see the menus being redrawn, because the graphic cards is so slow, and yet not a single bit of user input is lost. Compare with Mozilla Thunderbird, which freezes for minutes every time you tell it to do anything.

        1. The first thing wrong with that statement is ‘Mozilla Thunderbird’. I ditched Mozilla long ago because of the huge pile of bloat it became. When it first came out, it was great, you could install it by unzipping some files, but over the years, it has become a huge pile of bloat. I guess, on that note, what piece of modern software hasent? Oh well. Sometimes I find myself longing for a simpler time…

  1. Really great.
    Since I do not have an VGA Monitor anymore, i have to use an SPI Display. Since I am not a really friend of Arduino, i have to learn a lot before i can change the video output.

    1. Yes you can when when QBasic is running in a DOS environment of Windows XP or earlier. There are some limitations in XP but there are no limitation in WIN 98 / ME or earlier.

  2. I ordered one of the common LiliGo FAB-GL boards to do this with (it made economic sense not to DIY it), and I THINK that the boards for sale don’t have PSRAM, which this particular emulation needs. So, I THINK that I will have to desolder the ESP32 and put a PSRAM-equipped ESP32 on it. Does anyone know if the LiliGo board stock has PSRAM? I don’t think so…in any event I ordered an ESP32 with PSRAM.

  3. Anybody know the performance of this thing? Is it at least equivalent to a 4.77 MHz IBM PC XT?
    It would be great if it ran at least as fast as a 10 MHz 8086. Anybody have the answer?
    Thanks in advance.

  4. Windows 3.0 should have been the product that ended MS. It was that bad. IBM’s OS/2 was so much better at the time, they should make it a point to execute the people that managed to mis-market it so poorly.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.