LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

Running LowEnd on HighEnd: Running FreeDOS on a MacBook M1 (Apple Silicon) with QEMU

FreeDOS on Apple SiliconI have fond memories of the MS-DOS era.  Of course I’m not saying I want to go back to it, but for me it’s like when you find your old NES system in the basement closet or watch TV Land: a fun jaunt down memory lane.

Back when system memory was measured in kilobytes, MS-DOS was king, though Microsoft did have a long-forgotten but in its day very successful UNIX clone called Xenix.  Although it’s not hard to find MS-DOS media (in fact, you can still download it on an MSDN subscription), FreeDOS is the modern replacement.  It has everything you’d want from MS-DOS plus tons of creature comforts and available apps, games, and utilities.

You can run FreeDOS on vintage hardware, or on modern hardware due to legacy support for real mode in x86-64, though you’ll struggle with drivers.  And who wants to dedicated a modern i9 (or even an i3) to 16-bit computing?

Obviously, a better solution is to run it in a VM.  Heck, you could run a dozen FreeDOS VMs on a typical consumer PC, maybe a hundred.  Popular solutions are Virtualbox, VMware’s free Player, or qemu/UTM.  There’s also bochs which is more of a research platform.

However, if your daily driver is macOS and you’re on Apple Silicon, your options are a lot more limited.  Virtualbox and VMware Player do not support running x86 emulation on Apple Silicon.  You could setup Virtualbox or VMware on a Windows system and remote-desktop to it, but I found a lot of display problems with both if you’re RDPing from macOS.  I don’t have a physical Linux box at home (everything is VMs) and that might be better option.

But there is one option to run natively on Apple Silicon: QEMU.

It took me a bit of work to find the right options and get networking going, so I’m sharing my recipe here.  I’m not going to walk step-by-step through installation because once you’ve got it up and running, it’s identical to any other FreeDOS setup, but there are some tips and tricks.

UTM is a graphical front-end to QEMU and if you’re allergic to the command-line you could try that but I won’t be covering it.

Installing FreeDOS

Step One: Download FreeDOS.  Go the FreeDOS home page.  You’ll need the Live CD.  You might as well grab the Bonus CD as well.  Create a directory and put these two .ISO files in it.

Step Two: Install qemu.  I’m assuming you already have Homebrew setup because, well, you read LowEndBox and we’re that kind of people.  If not, go here and copy the command to install it.  Then open Terminal and paste it in.

Once Homebrew is installed:

brew install qemu

Step Three: Create a Hard Drive.  Or rather, a QEMU image file that will act as a hard drive.  You can make it 2GB because that’s the max that DOS is going to be able to see.  You can put this image file in the same directory as your .ISO files.

$ qemu-img create c.img 2G
Formatting 'c.img', fmt=raw size=2147483648

C in this case is for C: drive, but you can call it anything you like.

Step Four: Create a QEMU Script.

There are a ton of options for QEMU.  Here is what I use, after a lot of experimentation:

qemu-system-i386 -cpu 486 -boot order=dc -m 16M \
-k en-us -name FreeDOS1 \
-cdrom FD13LIVE.iso \
-drive file=c.img,format=raw,media=disk \
-rtc base=localtime \
-nic user,model=pcnet,mac=10:20:30:40:50:60

Let’s break that down:

qemu-system-i386: We’re running an i386 system, which is period appropriate.  BTW, if you ever have a hankering, you can run all kinds of systems under QEMU emulation: HP PA-RISC, S390, DEC Alpha, and many more.

-cpu 486: You could run a 286, 386, etc. here if you wanted.

-boot order=dc: This means “try booting CD-ROM first, then boot hard drive”.  Once you have FreeDOS installed, you will want to either switch these or change what’s loaded in the CD-ROM (perhaps to the Bonus CD).

-m 16M: Use 16MB of RAM.  Modify to your needs, but keep in mind that memory in DOS is more complicated than in Linux, Windows, or Mac.  Unless your app is running a DOS memory extender, you’re likely limited to 1MB and not even all of that.

-k en-us: en-us keyboard

-name FreeDOS1: pick any name you like.

-cdrom FD13LIVE.iso: This will appear as the D: drive.  The Live CD is what you want to boot in order to install FreeDOS.

-drive file=c.img,format=raw,media=disk: This is the hard drive that we just created.

-rtc base=localtime: Set the system clock to the host’s localtime.

-nic user,model=pcnet,mac=10:20:30:40:50:60: Create a network interface card using pcnet, and set the MAC to 10:20:30:40:50:60.

Put that in a file called something like qemu_freedos.sh.  Then:

$ chmod 755 qemu_freedos.sh
$ ./qemu_freedos.sh

QEMU will start and you’ll get a Window with the LiveCD booting.  Select “Install to system hard disk” and you’re off and running.

Full Screen Mode

For maximum DOS enjoyment, I recommend going full-screen.  Hit Command-F and you’ll enjoy a character-based world.  You can still use Control-Arrow to change to different virtual desktops.

To exit full screen mode, you need to break input capture.  Do this by hitting:

  • Control-Option-G
  • Then Command-F to toggle out of fullscreen mode

Networking

This is a bit of a puzzler which I haven’t entirely figured out.  When you boot FreeDOS, you get these messages:

QEMU network detected.

Physical hardware networking is not supported at this time.

If you follow the program logic in FDAUTO.BAT and FDNET.BAT, it seems that startup will always come to this conclusion and exit with this error message.

However, networking does work.  Try this:

C:\NET\FDNET\pcntpk int=0x60
dhcp

This will setup networking and DHCP an IP address.  From there (with appropriate packages installed) you can wget, ftp, ssh, etc.

Next Steps

At this point you may want to install some more software.  Check out these resources:

  • FDIMPLES – the FreeDOS package manager
  • WinWorld – a trove of vintage softare including Lotus 1-2-3, WordPerfect, dBase, and much moe

At some point, you’ll need to come back to the 21st century.  You can simply quit your window, but to do it properly, issue the SHUTDOWN command (does not need to be in caps) and wait for the VM to close itself.

raindog308

No Comments

    Leave a Reply

    Some notes on commenting on LowEndBox:

    • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
    • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
    • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

    Your email address will not be published. Required fields are marked *