Assembler, Compiler and Emulator targeting the 8086 platform for use on x86 architecture. For BYU ECEn 425 - RTOS
Switch branches/tags
Nothing to show
Clone or download
joshuahaertel and plusk01 Fixing emulator for Ubuntu 17.04 and 17.10 (#5)
* Removing abs() calls for unsigned numbers

It's unnecessary and throws errors on
Ubuntu 17.04 and higher

* Updating readme to include xterm install

It appears xterm is no longer part of Ubuntu and
needs to be installed. A pointer to a common font
error has been included as well.

* Moving Ubuntu 17.04 fix to bottom
Latest commit f2b2fac Oct 30, 2017

8086 Toolchain

This project is for BYU ECEn 425, and was taken from the CAEDM servers (/ee2/ee425/src/dist). The purpose for posting on GitHub is to make the build process available for Ubuntu 12.04+ and Mac OS X, along with any minor modifications along the way.

Disclaimer: For ECEn 425 projects, this may or may not compile exactly the same as the CAEDM machines


You can either clone this repo, or on the side click 'Download ZIP'.

To clone:

$ git clone

Prerequisites for Linux:

There are a few dependencies needed for this toolchain to be built correctly.

On Debian based systems (Ubuntu, etc), run the following in your terminal:

sudo apt-get install gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev xterm

Tested on Ubuntu 16.04 x86_64, Ubuntu 17.04 x86_64 & Ubuntu 17.10

Prerequisites for Mac OS X:

Your system will depend on the X11 Window system, which is now called XQuartz. It can be found here. (Tested with version 3.7.7)

Tested on Mac OS X Yosemite.

Building on Linux/Mac:

Then, cd into the repo and run make:

$ cd 8086-toolchain/
$ make

If all goes as planned, you will have 5 binaries in your ./8086-toolchain/bin/ directory. If there are any problems, you can try cding into each of the tool directories and running make individually so you can see the warnings/errors more clearly.

To use the binaries from anywhere, see Setting Your Path below.

Setting Your Path

Put this at the bottom of your ~/.profile ~/.bashrc (Or whatever your shells startup script is).

# ECEn 425 binaries
export PATH="/Users/plusk01/Documents/8086-toolchain/bin":$PATH

Make sure to reload your shells startup by either closing your shell and reopening it, or using the source command:

source ~/.profile

This will actually add your toolchain bin to the path.

Common Problems


  • cdefs not defined: Make sure Linux prereqs are installed
  • Parsing errors with Perl generated headers/macros: At some point the files were saved with 'DOS' line endings instead of Unix, so if you see a ^M (Windows carriage return char) that is likely the issue and saving (or overwriting) the file correctly should fix it. Make sure to blow away any generated files.
  • If on Ubuntu 17.04 or higher, you may get the following error: xterm: cannot load font '-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1'. emu86 will still work fine. If you wish to fix the error, you can try following the steps in this form:


  • cpp does not remove // comments correctly: See Makefile example below, make sure to add -xc++ flag to cpp to remove c99 style comments.

Makefile Example

lab1.bin:       lab1final.s
                nasm lab1final.s -o lab1.bin -l lab1.lst  # Step 4, Assemble

lab1final.s:    clib.S lab1asm.S lab1.s
                cat clib.S lab1asm.S lab1.s > lab1final.s # Step 3, Concatenate

lab1.s:         lab1.c
                cpp -xc++ lab1.c lab1.i    # Step 1, Preprocess
                c86 -g lab1.i lab1.s       # Step 2, Compile

                rm lab1.bin lab1.lst lab1final.s lab1.s lab1.i

                emu86 lab1.bin

Makefile error: If you copy this directly and paste into a Makefile, the tabs will often be converted to spaces. You will get a "Missing separator" error from make. Just replace the indentions with two tabs and it should work.