How to build and run an Emu8086 ASM program on Linux

Emu8086 4.08 screenshot

Emu8086 is an 8086 microprocessor emulator and disassembler. It permit to assemble, emulate and debug 8086 programs (16bit/DOS). Although this program was made for Windows, it works fine on GNU/Linux (with the help of Wine).

The problems are that Emu8086 can opens only one file at time, and that I dislike its text editor… I used an other editor for writing my program and then I opened the main file of my project in Emu8086 every time I wanted to compile it. That's boring and repetitive, so I made a build environment that uses the standard make command for building my program. It is easy to use and efficient as we will see.

Dependencies

Build Dependencies

For building your program you will need:

On Debian and Ubuntu you can install those dependencies with the following command (as root):

apt-get install build-essential wine

Runtime Dependencies

For running your application, you will need to install:

On Debian and Ubuntu you can install DOSBox with the following command (as root):

apt-get install dosbox

Compiling your program with a Makefile

For compiling your program, the first step is to put the following makefile in your source directory. You can customize it a little, by changing the PROGRAM_NAME or the PROGRAM_EXT 2).

Makefile
#The program name (8 char max)
PROGRAM_NAME = myprog
#The program ext (com or exe, lowercase)
PROGRAM_EXT = com
 
 
all: clean program
 
program:
	./buildenv/build.sh $(PROGRAM_NAME) $(PROGRAM_EXT)
 
clean:
	rm -f $(PROGRAM_NAME).$(PROGRAM_EXT)
	rm -f $(PROGRAM_NAME).sh
 
buildenv:
	wget -c "http://download.flogisoft.com/files/various/emu8086/emu8086-buildenv_1.0.tar.gz"
	tar -xzf emu8086-buildenv_1.0.tar.gz
	rm -f emu8086-buildenv_1.0.tar.gz
	cd buildenv/ && ./makeenv.sh

Then, you have to make the build environment (only the first time). This can be done with the following command:

make buildenv

Finally, you can compile your program:

make

Running your program with DOSBox

If the build was successful, two files are created in your source folder:

  • myprog.com or myprog.exe - This is your application. It can be executed on *DOS or on a 32 bit Windows.
  • myprog.sh - This is a Bash shell script for GNU/Linux that launch your application in DOSBox.

So for launching your application you can type this command:

./myprog.sh

Debugging

FIXME

1)
for launching emu8086.exe and for making the buildenv
2)
The extension depend of your code. If your code is made for being a flat binary, you have to set this variable to com ; if you have different segments in your code, you have to set exe.
 
asm/emu8086_buildenv.txt · Last modified: 2019/01/15 08:38 by flozz