Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

DOjS

> 开发工具
Open source

A MS-DOS Creative Coding IDE/platform based on JavaScript

955 stars0 likes1 views
WebsiteGitHub

About

A MS-DOS Creative Coding IDE/platform based on JavaScript

DOjS

A DOS JavaScript Canvas with sound.

DOjS is a JavaScript programming environment for systems running MS-DOS, FreeDOS or any DOS based Windows (like 95, 98, ME). There are experimental ports for Linux and Win32 (Windows 98 or never) as well. It features an integrated editor, graphics & sound output, mouse/keyboard/joystick input and more (see below). It was inspired by Processing which is described on Wikipedia as:

Processing is an open-source graphical library and integrated development environment (IDE) / playground built for the electronic arts, new media art, and visual design communities with the purpose of teaching non-programmers the fundamentals of computer programming in a visual context.

It also has a p5js compatibility mode where some of the functions of p5js are available and scripts can have a similar structure to Processing sketches.

You can type in a script with the builtin or your favorite text editor and then run it on a DOS command prompt.

DOjS is pronounces like doge, but ending with an "s".

DOjS was only possible due to the work of these people/projects:

  • MuJS JavaScript interpreter
  • The Allegro library and Allegro XC
  • DJGPP from DJ Delorie and the Linux compile scripts by jwt27.
  • The people that contributed to p5js.
  • The Glide source cleanup of Ozkan Sezer.
  • AllegroPNG PNG loader for Allegro
  • DZCOMM COM port library
  • libcpuid for cpuid module
  • curl and mbedTLS for curl module
  • cylindrix for IPX module
  • nanosvg for SVG loading
  • noise for perlin noise generation
  • genann for neural network engine
  • SQLite for sqlite module
  • Watt32 for TCP/IP networking
  • zip for ZIP file access
  • zlib for compression
  • libjpeg for JPEG loading
  • AnimatedGIF for rendering GIF animations.
  • PL_MPEG for mpeg1 decoding
  • pdfgen for PDF rendering.
  • micromod for MOD playback.
  • ibxm for MOD, S3M and XM playback.
  • ini for INI file reading.
  • Mesa for OpenGL
  • libwebp for WebP decoding/encoding
  • libtiff for TIFF decoding/encoding
  • jasper for Jpeg 2000 and Sun Raster decoding/encoding
  • NOISE.SYS for a better entropy source for TLS.
  • libsmacker for SMK file playback.
  • libexif for EXIF tag reading.
  • cRSID for C64 SID playback

Contact

You can find me on Mastodon in DOjS Matrix or in the DOjS Discord if you want...

Download and quick start

You can find binary releases on the GitHub release page. Just extract the contents of the archive and run DOjS.exe.

DOjS runs in Dosbox and on real hardware or a virtual machine with MS-DOS, FreeDOS or any DOS based Windows like Windows 95/98/ME. To use 3Dfx/Glide support you need a Voodoo card or DOSBox-X (see below).

If you run it on real hardware you need at least a 80386 with 4MB. I recommend a Pentium class machine (>= 100MHz) with at least 32MB RAM. The example files run fine on an Athlon 1GHz and with 256MB RAM.

The following hardware/functions are available:

  • 8/16/24 and 32 bit 2D graphics. On 24/32bit display modes alpha channel transparency is available.
  • BMP, PCX, TGA, QOI and PNG image reading and writing, JPEG and SVG loading
  • GRX font loading and rendering
  • Keyboard input
  • Mouse input
  • Joystick/Joyport input
  • File IO
  • MIDI output
  • WAV output
  • Audio input/sampling
  • Allegro 3D rendering (software)
  • 3dfx/Glide3 3D rendering output (hardware)
  • Mesa/OpenGL wrapper with 3dfx based hardware acceleration
  • p5js compatibility
  • direct io-port access (inb, outb, etc)
  • LPT or parallel port access (bi-directional)
  • COM or serial port access
  • IPX and TCP/IP networking
  • ZIP file access
  • GIF-Animation, FLC/FLI, MPEG1 or OggVorbis playback
  • HTTPS support through libcurl and mbedTLS
  • PDF generation

Examples

See DOStodon for an complex examples. It is a full Mastodon client implemented using DOjS.

A minimal script

You can find the following example in examples/exampl.js:

javascript
/*
** This function is called once when the script is started.
*/
function Setup() {
    pink = new Color(241, 66, 244, 255); // define the color pink
}

/*
** This function is called repeatedly until ESC is pressed or Stop() is called.
*/
function Loop() {
    ClearScreen(EGA.BLACK);
    TextXY(SizeX() / 2, SizeY() / 2, "Hello World!", pink, NO_COLOR);

    TextXY(10, 10, "rate=" + GetFramerate(), EGA.BLACK, EGA.LIGHT_BLUE);
}

/*
** This function is called on any input.
*/
function Input(event) {
    str = JSON.stringify(event);
}

Open this script with DOjS.EXE examples\exampl.js or use DOjS.EXE -r examples\exampl.js to run it without starting the integrated editor first. If the script does not exist the editor loads the template for a new script.

p5js compatibility

If you want to write scripts using the syntax of p5js you need to use Include('p5'); as first line of your script. You can find the following example in examples/examplp5.js:

javascript
Include('p5');

/*
** This function is called once when the script is started.
*/
function setup() {
    pink = color(241, 66, 244); // define the color pink
}

/*
** This function is called repeatedly until ESC is pressed or Stop() is called.
*/
function draw() {
    background(EGA.BLACK);
    stroke(pink);
    fill(pink);
    text("Hello p5js World!", width / 2, height / 2);

    stroke(EGA.LIGHT_BLUE);
    fill(EGA.LIGHT_BLUE);
    text("rate=" + getFrameRate(), 10, 10);
}

More info can be found at the end of this README in the section Usage and in the API documentation. Take a look at the examples/ as well.

additional packages

DOjS has a very simple integrated package manager (DPM). It can be started with DPM.BAT. A working packet driver is needed to connect to the package index and download packages using HTTPS. Packages (and the package index) are fetched from the DOjS/jSH package repository. Downloaded packages are put into JSBOOT.ZIP in the PACKAGE/ directory. Feel free to submit any packages you want to include in that repository using a pull request. DPM commands:

  • installed - list installed packages.
  • remove - remove package.
  • fetch - fetch package index from server.
  • install - install a package (and its dependencies) from package index.
  • list - list available packages in index.
  • setindex - set index URL (HTTP or HTTPS).
  • help - this help.;
  • quit - exit dpm.

3dfx/Glide support

DOjS supports most of the Glide3 API that was used with 3dfx accelerator cards. The following hardware is supported:

  • Voodoo 1 [tested]
  • Voodoo 2 [tested]
  • Voodoo 3 [tested]
  • Voodoo 4 [tested by tunguska]
  • Voodoo 5 [tested by tunguska]
  • Voodoo Rush (all versions) [tested]
  • Voodoo Banshee (PCI and AGP) [tested]

Additionally you can use DOSBox-X which emulates a Voodoo 1 card. Glide functions can be found in the 3dfx-module in the documentation, Javascript support functions have a "FX" prefix, all native functions are prefixed with "fx". Detailed Glide3-API documentation can be found on the internet, e.g. on FalconFly Central. Make sure you grab the Glide3 SDK and not Glide2!

You can use the included DOS version of TEXUS.EXE to convert bitmaps to 3df texture files that can be loaded as textures.

!!! Attention !!! 3dfx/Glide3 support ONLY works in plain DOS, NOT in the DOS/command window of Windows 9x! Be sure to always boot into a pure DOS prompt before trying to use any of the fx-functions! Before using 3dfx/Glide3 support you need to copy the appropriate GLIDE3X.DXE into the same directory as DOJS.EXE. You can do so by using the V_XXX.BAT scripts in the distribution ZIP archive.

Software created with DOjS

  • DutchTux has created a GUI toolkit for DOjS: https://github.com/dutchtux3000/jiyuai
  • I created a Mastodon client for MS-DOS using DOjS: https://github.com/SuperIlu/DOStodon
  • I made a text adventure with DOjS: https://superilu.itch.io/spacebutton
  • And also a match-numbers-game: https://superilu.itch.io/numgam

Compilation

You can compile DOjS on any modern Linux (the instructions below are for Debian based distributions) or on Windows 10 using Windows Subsystem for Linux (WSL). Setup Windows Subsystem for Linux (WSL) according to this guide (I used Ubuntu 18.04 LTS).

Preparation

Build and install DJGPP 12.2.0 according to this guide. Install NVM. You also need a CMake >= 3.20. I used the following command lines to update/install my dependencies:

bash
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install bison flex curl gcc g++ make texinfo zlib1g-dev g++ unzip htop screen git bash-completion build-essential zip dos2unix python3 cmake
nvm install node
npm install -g jsdoc
npm install -g better-docs

And the following commands to build and install DJGPP to /home/ilu/cross.:

bash
$ sudo apt-get update
$ sudo apt-get install bison flex curl gcc g++ make texinfo zlib1g-dev tar bzip2 gzip xz-utils unzip python3-dev m4 dos2unix nasm
git clone https://github.com/jwt27/build-djgpp.git
cd build-djgpp
./build-djgpp.sh --target=i586-pc-msdosdjgpp --prefix=/home/ilu/cross binutils-2.43.1 djgpp-cvs gcc-12.2.0 watt32-git
cd download/djgpp-cvs/src/libemu
make ../../lib/libemu.a
cp ../../lib/libemu.a ~/cross/i586-pc-msdosdjgpp/lib

Getting & Compiling DOjS

Open a shell/command line in the directory where you want the source to reside.

Checkout DOjS from Github:

bash
git clone https://github.com/SuperIlu/DOjS.git

Make sure DJGPP is in your PATH and DJDIR is set (e.g. I have these lines in my ~/.profile):

bash
# DJGPP
export PATH=/home/ilu/djgpp/bin/:/home/ilu/djgpp/i586-pc-msdosdjgpp/bin/:$PATH
export DJDIR=/home/ilu/djgpp/

If you used Windows-Tools to check

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C3dfxallegrodjgppdos

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具