How to run command before program (autoexec)

Override dosbox.conf file and write [autoexec] section, as explained in next section

Or you can simply pass additional command line arguments before you program, like:

main(["-c", "<command>", "-c", "DIGGER.COM"]);

How to override dosbox.conf

By default js-dos uses builtin dosbox config file.
However you can override it with your config file. To do this you can simply put file named dosbox.conf inside root of
program archive and then pass command line argument to read it -c dosbox.conf. Or you can write this file directly from
javascript with fs.createFile.

For example, you can add [autoexec] section to print dosbox.conf file:

Mouse locking

By default dosbox mouse will follow browser cursor. However you can change this behaviour by providing autolock=true in
dosbox.conf. Then mouse starts follow browser cursor after first click (lock), and you can unlock mouse by pressing CTRL+F10.

Building

Building process have two steps:

You need to build emulation layer (dosbox)

You need to build API

Dosbox

Project uses dosbox as emulation layer for running dos programs. You should build it before building javascript API. To do this you should have emscripten installed in your system and CMake. Build process should be easy if you familar with cmake, just run this commands:

mkdir build
cd build
emcmake cmake ..
make -j4

JavaScript API

You can build javascript API with gulp, just type gulp.

gulp

Output will be placed in dist folder. Also in dist folder you can find test page, you open it in browser. All test should pass.