| Home | | Developer Releases | | Stable Releases | | Documentation |

Technical README
DANG  - 0.99
Next Previous Contents

2. The Main group of Modules

These files are used to start DOSEMU as well as hold globally called functions and global vars.

2.1 dos.c Information

Initial program executed to run DOSEMU. Gets access to libdosemu and sets international character parms. Finally calls entry point of DOSEMU emulate() function which is loaded above the usual DOS memory area from 0 - 1meg. Emulate() is in emu.c.

2.2 Functions in dos.c

These are the functions defined in dos.c.


Arguments are:

  • argc - Count of argumnents.
  • argc - Actual arguments.
Function created by entry point into libdosemu. Called to jump into the emulate function of DOSEMU.

2.3 emu.c Information

Here is where DOSEMU gets booted. From emu.c external calls are made to the specific I/O systems (video/keyboard/serial/etc...) to initialize them. Memory is cleared/set up and the boot sector is read from the boot drive. Many SIGNALS are set so that DOSEMU can exploit things like timers, I/O signals, illegal instructions, etc... When every system gives the green light, vm86() is called to switch into vm86 mode and start executing i86 code.

The vm86() function will return to DOSEMU when certain `exceptions` occur as when some interrupt instructions occur (0xcd).

The top level function emulate() is called from dos.c by way of a dll entry point.

2.4 Functions in emu.c

These are the functions defined in emu.c.


call the emulate function by way of the dll headers. Always make sure that this line is the first of emu.c and link emu.o as the first object file to the lib


The IRQ numbers to monitor are taken from config.sillyint, each bit corresponding to one IRQ. The higher 16 bit are defining the use of SIGIO


Arguments are:

  • argc - Argument count.
  • argv - Arguments.
Emulate gets called from dos.c. It initializes DOSEMU to prepare it for running in vm86 mode. This involves catching signals, preparing memory, calling all the initialization functions for the I/O subsystems (video/serial/etc...), getting the boot sector instructions and calling vm86().

2.5 Remarks in emu.c

DOSEMU must not work within the 1 meg DOS limit, so start of code is loaded at a higher address, at some time this could conflict with other shared libs. If DOSEMU is compiled statically (without shared libs), and org instruction is used to provide the jump above 1 meg.

2.6 include/emu.h Information

2.7 Functions in include/emu.h

These are the functions defined in include/emu.h.


Arguments are:

  • sig - the signal to have a handler installed to.
  • fun - the signal handler function to install
All signals that wish to be handled properly in context with the execution of vm86() mode, and signals that wish to use non-reentrant functions should add themselves to the ADDSET_SIGNALS_THAT_QUEUE define and use SETQSIG(). To that end they will also need to be set up in an order such as SIGIO.

2.8 Remarks in include/emu.h

The `vm86_struct` is used to pass all the necessary status/registers to DOSEMU when running in vm86 mode.


We assume system call restarting... under linux 0.99pl8 and earlier, this was the default. SA_RESTART was defined in 0.99pl8 to explicitly request restarting (and thus does nothing). However, if this ever changes, I want to be safe


DOSEMU keeps system wide configuration status in a structure called config.


The var `fatalerr` can be given a true value at any time to have DOSEMU exit on the next return from vm86 mode.

Next Previous Contents
The DOSEMU team