FreeDOS Blog

❮ Back

May, 2020

Using FreeDOS - Freemacs

You probably know the history that before I started FreeDOS, I was a longtime DOS user. When I went to university in 1990, I quickly discovered the Unix systems in our campus computer labs. I wasn't a Computer Science student (I was in Physics) but since I had an interest in computer programming, I was often in the labs anyway.

Like many university computer labs at the time, our sysop had installed GNU Emacs. I thought Emacs was really neat, and I quickly made Emacs my default editor on the Sun network.

In 1993, I discovered Linux, and I installed SLS Linux as dual-boot with MS-DOS on my '386 PC. I typically booted into Linux to do any computer programming, and booted into DOS to use my word processor to write class papers, or my spreadsheet to analyze my physics lab data. I had a DOS compiler too, so I would also do programming on DOS. But I found I missed the features of GNU Emacs when I used the standard MS-DOS Edit program.

So I installed Freemacs. Written by Russ Nelson, Freemacs is a free emacs-like editor for DOS. There have been other emacs-like editors for DOS, and they all have their differences. Freemacs tries very hard to be as close to GNU Emacs as possible.

The difference is in the details. GNU Emacs uses a variant of LISP as its extension language. Actually, you can view GNU Emacs as a giant LISP machine that happens to have an editor in it. (And I say that out of love, and as a current GNU Emacs user.) Every function and feature in GNU Emacs is defined by elisp code.

But you cannot fit a LISP system like this in a DOS program. You don't have the memory. So instead, Freemacs uses a different extension language called MINT. MINT is a macro language that looks very similar to TRAC. That's how MINT got it's name; MINT = MINT Is Not TRAC.

And a bit of trivia:
When I started the FreeDOS Project in 1994, I gathered a bunch of existing open source programming tools and DOS utilities and fit them into FreeDOS. Since I was a longtime fan of GNU Emacs, and loved using Freemacs on DOS, I naturally included Freemacs. So Freemacs has been part of FreeDOS since the beginning.

I took over the role of maintaining Freemacs when Russ decided he didn't have time to work on it anymore. But as it turns out, I didn't need to make any changes so this version (1.6G) is unchanged from those early days.

Like other programs that we include in FreeDOS, you can also download Freemacs from our FreeDOS Files archive at ibiblio. You can find Freemacs under /freedos/files/edit/emacs.

Using FreeDOS - BW-BASIC

I grew up in the 1970s and 1980s. Like many of my generation, our first home computer was an Apple II. Actually, ours was an early Apple clone, called the Franklin ACE 1000, but it was the same as an Apple II.

The Apple was a great home machine. The Apple included a BASIC interpreter, so you could write your own programs. This made the Apple II a popular system for all home hobbyists, and in schools. What a great platform to learn programming.

My brother and I taught ourselves how to program in AppleSoft BASIC. Our parents bought a few books about BASIC, and we went over them in great detail. My first games were simple math puzzles and quizzes, although I had plans to write a multi-function calculator so I could "cheat" on my math homework. But as it turns out, you need to learn a lot about math before you can write a calculator from scratch in BASIC - so by the time I was ready to write a calculator, I didn't need it.

But I wrote a lot of games in BASIC. As a hobby, I also created versions of computer programs that I saw in movies and on TV. If a TV program or movie included a computer display, I tried to make my own version. My favorite program was a version of global thermonuclear war, from WarGames (1983 movie). My version let you choose a few targets, then it would launch the missiles and tally a score.

We also had a floppy disk with some other BASIC games on it. I enjoyed the Lemonade Stand game, which is basically a finance simulation. You run a neighborhood lemonade stand, and you need to figure out how many glasses of lemonade to make every day, and at what cost, and the game figures out how many people bought your lemonade. The game included random weather.

I also played another game, which was a kind of simulation. You were the leader of a tiny ancient empire, and you had to decide how much to feed your people and how many crops to plant. It was an exercise to figure out the optimum balance of how much to keep aside for food versus how many acres you could plant.

BASIC was a great introduction to computer programming. I later learned other programming languages, but BASIC was my first language. Despite it being such a simple language compared to something like C, 12-year-old me really enjoyed writing BASIC programs on the Apple.

Later, our family upgraded to an IBM PC, and I learned BASICA and GW-BASIC - and much later, QBASIC. I wasn't a huge fan of BASICA and GW-BASIC, but I really loved QBASIC. It was a very nice BASIC programming environment. QBASIC saw me through much of university until I learned other programming languages.

When we first put together FreeDOS, I felt that FreeDOS needed a BASIC programming environment. I wanted parity with MS-DOS. The Bywater BASIC ("BW-BASIC") interpreter is a very nice BASIC programming environment that reminds me a lot of programming on the Apple:

In this video, I walk through an introduction to programming in BW-BASIC. And I introduce a set of sample BASIC programs that I wrote long ago. GUESS.BAS is a simple "guess the number" game. LEMON.BAS is a spin on the classic lemonade stand game. And TAZ.BAS is my own take on the "ruler of a tiny kingdom" game.

You can find these sample BASIC games on ibiblio:

Using FreeDOS - oZone GUI

FreeDOS is primarily a text-based command line interface. That means you type commands at a prompt, and FreeDOS runs those commands. Just like classic DOS.

But since PCs had graphics, people have created graphical user interfaces (GUIs) for DOS. Actually, Windows started as a graphical interface for MS-DOS.

FreeDOS includes a few GUIs, as well. You can find OpenGEM, oZone, and SEAL in FreeDOS - if you don't have them installed already, you can install them by running FDIMPLES and selecting the packages.

I wanted to show off one of the GUIs here. Let's take a look at oZone:

oZone has a very familiar look and feel. You may find the interface feels quite modern. Kudos to the developers who worked on oZone and created a very polished interface.

My video is a little squished here, sorry about that. I'm not sure what happened, but that's a problem on my end. I have my video system set up to record in 4:3 aspect ratio, but this looks to be a little narrower than that.

DOS games - Ford driving simulator

In the 1980s, if you couldn't visit your car dealer, how would you look at the new models and decide to buy a car? Not everyone had a local dealer. Ford decided they didn't want to limit customers that couldn't visit in person, so some forward-thinking person at Ford decided to create a driving simulator that let you try out different Ford models.

It was a great idea, especially for the time. Run the program, and you could select a car from the list, and drive it around on a virtual track. While not perfect, this gave you an idea of the car you were looking to buy. And you could dig further into statistics, and run cost scenarios to see what options you might include and what overall car you could afford.

Today, you'd do all of that from a website. And certainly many car manufacturers do exactly that. But in the 1980s, "websites" didn't exist yet. The only way to get that experience out there was to create a program and pass it around on a floppy disk.

I don't remember if you had to buy the demo floppy, or if Ford gave it away for free. But I do remember that my dad brought home the Ford driving simulator. My brother and I played it like a game. Since this was before sound cards, the simulator sounds came from the tinny internal PC speaker. The graphics weren't great, only 4-color CGA, but it was enough to play a game.

Programming in FreeDOS - reading the command line

I wanted to do a few videos about how to do programming in FreeDOS. Since my favorite DOS programming language is C, this video is about C. You can follow along with any of our C compilers. You can install them if you do a full install, or you can run FDIMPLES and install the compilers from there.

People sometimes ask, "How can I write a program in FreeDOS that reads the command line?" And that's an important question, because FreeDOS is primarily a command line operating system. In this video, I'll go over two simple methods to parse a command line in C.

Here's the basic method:

You want to write a program that loops over the command line arguments. The arguments are stored in a vector (an array of strings) called argv in this program. The number of the arguments is passed in an integer variable called argc. You could name these something else if that's better for you, such as arguments and argcount, but here I'm using argv and argc.

In the simplest example, we'll just read the command line options:

#include <stdio.h>
#include <stdlib.h>

main (int argc, char **argv)
  int i;

  for (i = 1; i < argc; i++)
      printf ("%d: %s\n", i, argv[i]);

  exit (0);
If you wanted to parse the command line for any options passed to your program, you would need to examine each argument in turn and evaluate it for a possible option.

Because parsing the command line is a common thing, you might not be surprised that there's a library to do that for you. getopt does the hard work of looking for options. You need to pass it the argument count argc and the argument vector argv, and a list of valid options that your program would accept. getopt returns any options it finds from that list. When it's done finding options, it returns a special code and sets optind to the next index in argv that doesn't contain an option (usually the start of a file list or other things you might put on a command line).

Modifying the above sample code:
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>

main (int argc, char **argv)
  int i;

  while ( (i = getopt(argc, argv, "hHQq") ) != EOF )
      switch (i)
case 'h':
case 'H':

case 'q':
case 'Q':

    puts("unknown command line option");

  for (i = optind; i < argc; i++)
      printf ("%d: %s\n", i, argv[i]);

  exit (0);
Note the switch statement inside the while block. That evaluates the return value from getopt. At each pass, getopt returns a command line option. If it's q or Q, then the program prints QUICK. If it's h or H, the program prints HELLO.

getopt is a standard Unix C library. Unix is case sensitive everywhere, including its command line options. But DOS is usually case insensitive, so here we had to define h and H (and q and Q) to do the same behavior, to make the command line options case insensitive.

Also note that getopt acts like a standard Unix command line parser, so these command line options are set off with a hyphen. For example, use -q or -Q to print QUICK. On a typical DOS program, you would use the slash as the option character, so /s or /S.

Let's play - Dr Mind

Dr Mind is a fun puzzle game. You may recognize it as a variation on another more popular board game, although Dr Mind has a few differences in gameplay.

In Dr Mind, the computer guesses a secret color combination, and you (the player) need to figure out the combination within 8 turns. After each guess, the computer indicates how many colors matched the correct combination, and how many of those colors are in the correct positions.

If you manage to guess the correct combination, the game rewards you by unlocking a picture.

Dr Mind is published under the CC BY-ND 4.0 license, which is roughly equivalent to "freeware with source code". You can find it at SourceForge: Dr Mind

Let's play - Number Munchers

If you're of a certain age, you may remember a game on the Apple II. My class had Number Munchers, and we loved it. Number Munchers was a fun math game where you selected numbers that matched certain criteria. If the criteria was "multiples of 5" then you had to select all the numbers like 5, 10, 15, 20, and so on.

Because it was a game, we kids wanted to play it rather than do homework. And our clever teachers figured that if we finished our math homework, then we could play Number Munchers. And by playing Number Munchers, you got better at math. So it was a win-win, but we didn't realize it.

Number Munchers was eventually ported to DOS. And that means you can play it on FreeDOS:

Unfortunately, Number Munchers is not open source software. I'd love for someone to make a version of this for FreeDOS, as open source software. The game would need to use different graphics, but I think it's fair to use the same game concept (multiples of, divisible by, less than, greater than, etc)

If you want to write such a game, let me know!

DOS applications - Ability

This video was suggested by a fan.

You know that I love spreadsheets, and DOS word processors. My favorite spreadsheet is As-Easy-As, and my standard word processor from the 1990s was Galaxy.

Peter K suggested the Ability office suite for DOS. I'd never heard of Ability, but it turns out to be an outstanding DOS office suite. Featuring a word processor, spreadsheet, graphics, and database, Ability hits all of the marks.

In this video, I walk through the Ability Spreadsheet, and Ability Word Processor. Both are great, and provide an easy to use DOS office environment. The spreadsheet seems to be command-compatible to other DOS spreadsheets of the era, which means you need to start functions with the @ sign, such as @SUM to do a sum of a range.

Ability has released the DOS version for free, without support. You can download it from their website at Ability Plus 3.0.

I wish other software manufacturers would do this. While I prefer that these programs from their back-catalog be released as open source software, I recognize that this is not always possible. (The code may no longer exist, or there may be legal issues in opening the code.) If you can't release a DOS program as open source, I am glad that these software companies release them as free (gratis) software.

We only include open source programs in the FreeDOS distribution, so we can't include Ability in the FreeDOS distribution. But at least you can download Ability and use it on your own.

Retiring the FreeDOS blog

Hi everyone! I've been sharing updates on the FreeDOS blog since at least 2006. (I know I have been writing here since 2006, but we had another kind of blog elsewhere before that.)

We don't get a lot of visitors here. And it would be nice to consolidate the web traffic for FreeDOS to a single place. So I'm planning to retire this FreeDOS blog from the Blogger platform.

I have a few more items queued up through the end of the month. I'll plan to retire this blog effective June 1.

However, we will still have a FreeDOS blog! Look for more updates from the FreeDOS website at including an archive of this blog. I'll share an update around June 1, as a news item on the main website.

Thanks for visiting the FreeDOS blog! And be sure to follow us at

Programming in FreeDOS - using getopt_long()

In an earlier video, I showed how you can parse a command line using the getopt function. getopt makes it really easy to examine the command line and pull out options. This means your program can respond to the user in different ways, depending on the options that were passed to your program.

But getopt is limited in a few ways. It only accepts single-letter options, and each option must be set off with a hyphen (-) instead of a slash (/).

If you want to parse long DOS-style options, you need a different library. The getopt_long function is a variant of getopt that deals with these longer options, and uses a slash to start the option.

This video shows how to use getopt_long to parse a command line from a C program:

I originally produced this video as a bonus for my Patreon supporters. I have a Patreon to help me set aside time to work on FreeDOS. I've used Patreon to make YouTube videos about FreeDOS, completely update the FreeDOS website, and start updating the FreeDOS wiki. With more support, I'm planning to dedicate more time to fix bugs, port programs to FreeDOS, and write new FreeDOS programs and games.

If you'd like to support me on Patreon, click the "Become a Patron" link below. There's no obligation to support me on Patreon, but it really does help. Thanks!

Become a Patron!

Let's Play - Duke Nukem

In 1992, iD Software released Wolfenstein 3D, which set a new standard for DOS games. While primitive by today's standards, Wolfenstein 3D gave us the first popular first-person shooter. In 1993, DOOM set the bar again for DOS gaming. DOOM provided a first-person shooter experience that became the new standard for PC gaming.

Before DOOM and Wolfenstein 3D, sidescrollers were pretty popular. Think Super Mario Bros from the NES. And so games like 1990's Commander Keen: Invasion of the Vorticons became popular.

And a year later, Apogee Software released Duke Nukem. Set in the then-future 1997, Duke found himself opposite the eeevil Dr. Proton. Gameplay was pretty straightforward: make your way through each level to the exit door, and eventually you get an end-boss level.

Duke Nukem was a popular shareware game. You could play the first level as much as you wanted, but you had to pay a registration fee to get the rest of the game. Duke's registration fee was only $30 to get all 3 episodes mailed to you on floppy disks (each episode was a series of levels - the first episode took place in LA, the second on the Moon, the third in the future).

You may notice the game's startup screen says "Duke Nukum" instead of "Duke Nukem." That's because after the game's initial release, Apogee realized a cartoon already had a character called "Duke Nukem" so they hastily updated the name for version 2.0. Later, they realized the "Duke Nukem" name wasn't a registered trademark, so Apogee registered "Duke Nukem" and used that spelling for "Duke Nukem II" and "Duke Nukem 3D."

Let's play - Quake

DOS had a lot of great games, and a number of these were milestone games that defined "DOS gaming" in the 1980s and 1990s. Wolfenstein 3D by id Software brought us a smooth first-person shooter set during WWII. DOOM improved the first-person shooter by allowing non-orthogonal walls, and floors and ceilings of different heights. And in 1996, id Software brought the next generation of first-person shooters: Quake.

Quake introduced true 3D models. Where enemies in Wolfenstein 3D and DOOM were a series of 2D sprites, enemies and objects in Quake were rendered as a series of polygons. This added to the realism of the game - although it's somewhat primitive to today's games.

A quick note on this video: I run FreeDOS in a PC emulator called QEMU. This is a great lightweight virtual machine for running FreeDOS. Normally, that's a great setup for running DOS programs and games. When I run Quake in QEMU, it runs smooth even at higher game resolutions.

But when I record my videos using OBS Studio, I'm really pushing my hardware setup. I'm sure it would be better if I used a separate system for capture - a lot of YouTubers and professionals do it that way. But I am doing everything from my desktop, and running this combo just happens to push the limits.

So I've stepped down the game resolution to the default. It's a little blockier, but the game is much smoother. I hope you don't mind.

Using FreeDOS - listening to music

We include lots of different programs in FreeDOS so you can use FreeDOS the way you want. It's not always about games and office programs; you can relax by listening to music. So in this post, I'd like to share two programs that let you play music from FreeDOS.

  • OpenCP is a music file player for Linux, Unix, DOS and Windows
  • MPlayer is a movie player that also plays music files

You can find both of these in the FreeDOS distribution. I'm using FreeDOS 1.3RC2 to do my demo video:

A few notes about the sample audio files I used in this video:

In 1994, pretty much everyone disagreed about how to pronounce "Linux." Some people pronounced it "lih-nucks" and others (like me) pronounced it "lie-nucks" and some pronounced it "lih-nooks." Linus Torvalds decided to put the debate to rest, and included an AU file in the kernel source about how he pronounces "Linux."

In 1999, a friend convinced me to record a similar WAV file of me pronouncing "FreeDOS," as a joke. I grabbed a microphone and recorded a WAV, and put it on our file archive at ibiblio. You can find it in files/util/sillysounds. We also have a copy of Linus's AU files.
I like to listen to audiobooks, and I'm a huge fan of classic Doctor Who. Big Finish Productions makes great audio stories about classic and new Doctor Who (and a bunch of other stuff too). Most of their productions are full-cast stories, usually with the original cast, but they do standard audiobooks too. You can buy their stories on CD or as unencumbered MP3 files - and that's great, because you can play MP3 using open source software.

That's not an ad for Big Finish, and no one paid me to mention them here or in the video. I just happen to like them, and I buy a lot of their stuff.

Flashpoint is an audiobook from the 8th Doctor series, read by Sheridan Smith (who also plays the assistant, Lucie Miller). It's a fairly short audiobook, so the MP3 file wasn't very big. That's the file I grabbed for this demo.

I only play a small sample of the MP3 file for this demo, so I don't think anyone will mind.