DOjS
A downloadable tool for Windows and Linux
DOjS is a JavaScript programming environment for systems running MS-DOS, FreeDOS or any DOS based Windows (like 95, 98, ME). 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 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 and PNG image reading and writing
- 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)
- 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
Download
Install instructions
Installation
just unzip the archive for your platform to a directory (DOS, Win32, Linux).
Please note:
- The Linux binaries were compiled on Ubuntu 20.04, they might not work on other distributions/versions.
- The Windows binaries need at least Windows 98
- The primary project site with the source is at https://github.com/SuperIlu/DOjS
A minimal script
You can find the following example in examples/exampl.js
:
/* ** 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 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
:
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 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.
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.
Usage
Command line
Usage: DOjS.EXE [-r] [-l] [-s] [-f] [-a] <script> [script parameters] -r : Do not invoke the editor, just run the script. -l : Use 50-line mode in the editor. -w <width> : Screen width: 320 or 640, Default: 640. -b <bpp> : Bit per pixel:8, 16, 24, 32. Default: 32. -s : No wave sound. -f : No FM sound. -a : Disable alpha (speeds up rendering). -x : Allow raw disk write (CAUTION!)
Editor keys
F1 : Open/Close help SHIFT-F1 : Function context help F3 : Save script F4 : Run script F7 : Find text F9 : Show/Close logfile F10 : Quit Shift-F4 : Truncate logfile and run script Shift-F7 : Find again CTRL-D : Delete current line SHIFT+Movement : Select text, releasing SHIFT deselects CTRL-C : Copy selection CTRL-X : Cut selection CTRL-V : Paste CTRL-LEFT : Previous word CTRL-RIGHT : Next word CTRL/PAGE-UP : One page up CTRL/PAGE-DOWN : One page down HOME : Go to start of line END : Go to end of line CTRL-HOME : Go to start of line CTRL-END : Go to end of line TAB : Insert spaces until next TAB-stop at cursor SHIFT-TAB : Reduce indentation of line TAB size is 4. The help viewer will remember the current position. The logfile can be truncated by pressing DEL in the log viewer.
Scripts and resources
Scripts, as well as resources can either be stored in the file system or in ZIP files. To load data from a zip file the format is <ZIP filename>=<ZIP entry name>
(e.g. data.zip=mypic.bmp
). DOjS can be started with a script, a script in a ZIP file or no parameters. If the script was loaded from a ZIP file the running script can obtain resources from the same ZIP file by using ZipPrefix()
to obtain paths refering to that ZIP. If the script was not started from a ZIP ZipPrefix()
just passes through the file name (thus loading the file from HDD). If no arameters are supplied DOjS will first try to load <name of the EXE>.ZIP=MAIN.JS
and then JSBOOT.ZIP=MAIN.JS
.
Examples:
DOJS.EXE -r script.js
will startscript.js
from the HDD,ZipPrefix("pic.bmp")
will yieldpic.bmp
.DOJS.EXE -r data.zip=script.js
will startscript.js
from the ZIP filedata.zip
,ZipPrefix("pic.bmp")
will yielddata.zip=pic.bmp
.HURTZ.EXE
DOjS was renamed toHURTZ.EXE
. It will startMAIN.JS
from the ZIP fileHURTZ.ZIP
,ZipPrefix("pic.bmp")
will yieldHURTZ.ZIP=pic.bmp
.DOJS.EXE
The script was added toJSBOOT.ZIP
. DOjS will startMAIN.JS
from the ZIP fileJSBOOT.ZIP
,ZipPrefix("pic.bmp")
will yieldJSBOOT.ZIP=pic.bmp
.
API documentation
You can find the full API doc in the doc/html/ directory. Go to the p5.js hompage for p5.js reference.
Leave a comment
Log in with itch.io to leave a comment.