This is the distribution site for the XPL0 language. It's also the place to get examples, utilities, and games written in XPL0. (Please note that "0" is a zero rather than an "oh".)
XPL0 is similar to Pascal and C. It was created in the mid 1970s by Peter J. R. Boyle and the 6502 Group. Over the years, versions of XPL0 have been made for many different kinds of computers. The information provided here is mostly for running on IBM-compatible PCs. These programs run under DOS and, to a limited extent, under Windows.
Unfortunately Microsoft seems determined to exterminate DOS programs because each successive version of Windows does a poorer and poorer job of supporting them. Windows 98 had the ability to restart in MS-DOS mode. Windows XP went to "heroic lengths" to support DOS applications, but it still introduced many incompatibilities. Windows Vista and Win7 won't run any kind of DOS graphics program, not just XPL0's. Instead, they pop up the message "This system does not support fullscreen mode." Nothing in the Compatibility mode settings solves the problem. DOSBox and virtual machines (such as VMWare or Virtual PC) do provide a partial solution, but they run programs slowly and convulsively, and are certainly not as convenient as simply booting good-old-fashioned DOS.
Here's an example of a complete XPL0 program. It displays the (moving) image at the right, and runs on any 32-bit PC (such as a Pentium) under DOS or WinXP.
include c:\cxpl\codes;
int X, Y, Z;
begin
SetVid($111); \640x480x65536 colors
repeat for Y:= 0 to 479 do
for X:= 0 to 639 do
Point(X, Y, (X*X + Y*Y + Z)>>5);
Z:= Z - 127; \gently move ripples
until KeyHit;
SetVid(3); \restore text mode
end;
More examples of simple XPL0 programs are here.
If you like demo programs, Hugi Magazine has a couple articles showing how to make them with XPL0.
XPL0 is available under the terms of the Free Software Foundation's General Public License, Version 2. All downloads from this site include source code (are open-source) and are completely FREE!
28-Feb-2010: The compilers have been updated, mostly to fix a little bug introduced last month, but also to provide the new command words 'and', 'or' and 'xor' as alternatives for the traditional symbols "&", "!" and "|".
2-Feb-2010: Here's a selection of maze programs from simple to complex
- rectangular, hexagonal, and spherical - 2D and 3D - inside and out.
Perhaps one of these seven programs will strike your fancy.
Download MAZEMAD.ZIP (125k, 2-Feb-2010).
30-Jan-2010: New versions of the compilers are posted below. The main new feature is the decrementing 'for' loop that uses the new command word 'downto'. For symmetry, a normal incrementing 'for' loop can use the command word 'to' instead of the comma. For example:
for I:= 1, 10 do ... for I:= 1 to 10 do ... for I:= 10 downto 1 do ...20-Apr-2009: Time for another game! TeXtris is a cross between Tetris and Scrabble, and is one of the few games I still enjoy wasting time playing. Besides improving mental and manual dexterity, you'll learn lots of interesting 3-letter words such as qua, qat, and qis - which are great for casually dropping into conversations.
15-Jul-2008: A kind of Rosetta Stone that compares XPL0 to C, Pascal and FreeBASIC is available here.
18-Apr-2008: Thanks to Ed of DX-Forth fame ( http://dxforth.webhop.org/) an incompatibility between 32-bit XPL0 and some graphic display cards has been fixed. The problem was introduced with version 3.3.4. Only two programs were affected (XPLPX335 and BTC), and their updated versions are posted below. (Some BIOSes alter the contents of the AX register for *all* calls to interrupt 10h even though the documentation does not indicate they're returning a value in AX.)
28-Mar-2008: Updated versions of both the 16- and 32-bit compilers can be downloaded below. The major new feature is the ability to declare global variables after procedures, not just at the beginning of a program. This makes it easier to break programs up into separate files, making them more modular and easier to understand and manipulate.
Also new is binary notation. For example, hex $2E can now be written as %101110. There are new intrinsics in the 32-bit version; and the functions abs, sqrt, sq, swap, fix, and float can now be used on constants in 'define' declarations (not just in the main body of the code).
Also, thanks to reports from users like you, there are a few minor bug fixes.
If you're hooked on C, XPL0 might not appeal to you. It doesn't have all the features of other languages. Normally this is not a problem, and it makes the language easier to learn.
XPL0 is by no means crippled. It's a block-structured language that supports recursion. It has two data types: integer and double-precision floating point ('reals' - with and without a math coprocessor). Even the small 16-bit version allows both code and data spaces larger than 64K. It provides generalized device I/O for the console, printers, files, and serial ports. It allows unlimited-dimensional arrays and complex data structures using pointers. It allows up to 8 levels of procedure and function nesting (compare this to C which only has 2). It has conditional compile, include files, separately compiled modules, inline assembly code, built-in graphic and transcendental routines, peek, poke, and port I/O.
The intent of this webpage is not to persuade you to use XPL0, but merely to make the language available. XPL0 is a significant piece of work that continues to be useful despite massive support behind other languages.
If you're new to programming, you may find XPL0 easier to learn than the myriad of languages called BASIC. If your interest in programming is to make money, you're probably better off with Delphi or Visual C++. XPL0 does not support Windows applications, which are expected on today's PCs. However, if you think programming is fun and want a deep understanding of how programs and compilers work, XPL0 may be for you.
These examples will give you a quick idea of what XPL0 is like.
If you're familiar with C, Pascal or FreeBASIC; you might find this chart helpful to see how XPL0 compares.
The native and optimizing compilers require an assembler such as MASM or TASM. A free version of MASM can be downloaded from here: http://www.aurskogcity.8m.com/compilers/compilers.html. Version 5.10 is sufficient and recommended.
The optimizing compiler generates code that is about twice as fast and half the size as the non-optimizing native compiler. This shows how the Sieve of Eratosthenes benchmark gets compiled into assembly language.
Download XPL0-28.ZIP (299k, 21-Feb-2010).
Here is the source code for the compilers and run-time support routines.
Download XSRC-28.ZIP (250k, 21-Feb-2010).
These are screen shots of some of the example programs included in the zip file:
Requires:
TASMX and TLINK can be obtained from the file TasmIDE.zip from here: http://www.soem.ecu.edu.au/units/ens1242/workshops/tasm.htm
Even if you're not into programming, you might enjoy running some of these games. They're all written in XPL0, and they all include the source code. They make good examples for the more advanced programmer.
Textris is a cross between Tetris and Scrabble. The idea is to
form words from falling letter tiles. Crammed into the small exe file
are the 53,800 official Scrabble words between 3 and 7 letters long. Not
only is the source code included, but all the utilities that went into
making this game (so, for instance, you can easily make the French
version). Download TEXTRIS.ZIP (276k,
20-Apr-2009).
Challenge Matey to a game of chess - or play against
another person with Matey enforcing the rules. Move pieces with the
mouse, specify skill level, undo bad moves, view Matey's thinking. This
is more of an XPL0 programming example rather than a strong competitor.
It rates about 1100 at its level 4 (blitz). Included in the source code
is a Tic-Tac-Toe program that provides a simple example of recursive
tree search. Download MATEY.ZIP (56k,
10-Apr-2010).
Test your skill at solving peg solitaire. The challenge is to jump over
each peg (or man, like in checkers) and see how many you can clear from
the board. You win when there is a single peg left in the center.
Included is a simple version of the program and a deluxe version by Ed
DeWan, shown here. If the deluxe version is run under WinXP, it must be
started from a DOS prompt in full-screen mode (for some strange reason).
Download SOLO.ZIP (67k, 18-Jan-2007).
Thirty years ago Space Invaders took over the world. Here are two
versions of that historic game, one in QBASIC by James Eibisch and a
translation in XPL0. Both are faithful copies of the original Taito
version. You may have a problem getting the sound to work. That's
because the Sound Blaster's FM registers are used, and these have been
phased out on modern machines. Download INVADERS.ZIP (74k, 25-Mar-2008).
Yer basic shooter...with source of course. Have fun!
The code shows how to play digitized sounds
Similar to but different than Windows Solitaire.
Spoof on Windows. Make horizontal, vertical
Venerable Chinese tile game.
Arcade version of classic Star Trek game.
Solve it yourself or watch the computer do it.
Now it's your turn. Here's a simple program to launch your career
as a computer game programmer(!) The complete code is only 4.5 pages
long. Match pairs of cards by clicking on them with the mouse.
The code is purposely kept simple. You might want to convert the text
images to stunning graphics (see 8Across). You might want to add a timer
to see how fast you can match all the cards. Download CONGAME.ZIP (8k, 28-Apr-2006).
These animation players are courtesy of Mihai Ionascu of Romania. One
runs FLI files and the other ANI files. They both use 32-bit XPL0. Lots
of FLI files can be downloaded from here: http://cd.textfiles.com/tothemaxss/FLI/,
and the FLI format is explained here: http://www.fileformat.info/format/fli.
The ANI format was originally made for the Amiga computer. Examples
and further information are here: http://www.randelshofer.ch/animations/.
Watch the bee buzz and Juggette do her thing! Download ANIMPLAY.ZIP (145k, 18-Jan-2007).
Simulate basic logic circuits. Quickly "wire-up"
gates and flip-flops. Connect them to push buttons or clock generators,
and watch 'em run. Red and green signal lines show the logic levels (0 or
1). A group of gates can be selected then dragged, duplicated, deleted,
or deMorganized. Windows-like GUI runs under DOS, Win3.1, 95, 98, and XP
(even with nVidia), but not WinNT nor 2000. Source code included.
Download LOGICLAB.ZIP (69k, 13-Mar-2004).
As Doctor Who would be delighted to explain, block transfer computations
Here's a simple version of a raycaster like used in Wolfenstein 3-D.
Fit the 12 pentomino pieces into the box. Programs like Pents stop running after a few seconds under Windows XP unless the Idle Sensitivity lever is set all the way to the Low position. This setting is buried in a Shortcut under Properties -> Misc.
This waterwheel defies expectations by periodically
Stereo 3D plot of the Lorenz Attractor.
The Mandelbrot set is the set of points C that do not cause Z
4-Aug-2005: XPL0 Runs on Homebrew Machine: John Doran, a member of our local computer club (the 6502 Group), designed and built a computer based on 7400-series TTL. How it came to run XPL0 is described here.
13-May-2005: Another bug has been found and fixed. This time it was in Sokoban. Thanks goes to James Newton who reported it. (James BTW is the force behind PIC List . His main website is at: http://www.massmind.org ) Thanks also goes to Larry Fish, coauthor of XPL0, who pointed out that the problem was a bad intrinsic call when a digitized sound was about to be played. (Larry's Compass website is at: http://fountainware.com/compass/)
3-Oct-2001: The complete source code for the Apex operating system that runs on the Amiga A1000 and A2000 computers is available here: APEX-SRC.ZIP (339k).
Apex is roughly similar to Amiga's CLI (Command Line Interpreter) and MS-DOS. In addition to the Apex kernel, there is source for an XPL0 compiler, 68000 assembler, debugger, text editor, and numerous utilities.
The code is released "as is." It will take some effort to sort it out. I'll improve the documentation if interest warrants. Start with README.TXT.
Executable images of bootable diskettes are here: APEX-BIN.ZIP (207k). You will need to devise a way to copy these images onto an Amiga floppy (starting at the very beginning: track 0, sector 1). A1000.BIN boots in place of KickStart and occupies the KickStart RAM. A2000.BIN boots in place of AmigaDOS and requires a 68020 chip.
28-Jul-2001: If you've been looking for the version of XPL0 that runs on Ubicom (formerly Scenix) microcontrollers, it's here: Download SXPL.ZIP (131k).
26-Jul-2001:
Lenny Boreal releases his text scroller.
This elegant program with its "jumpin'
graphics" is a mere two pages of code!
Download SCROLLER.ZIP (6.8k).
22-Jul-2001: Archaeological dig unearths ancient XPL0 programs. Many are for old computers, such as the Apple II and Amiga, and will not run on a PC without modification. OLDXPL.ZIP (1158k)
9-Jun-2001: Example of a driver for a SanDisk MultiMediaCard. This is 8088 assembly language rather than XPL code, but I didn't know where else to put it. MMC Source Code
2-Jun-2001: CueCat barcode scanner example
This site is maintained by Loren Blaney. He'd very much enjoy hearing from someone other than spammers for a change. If you have any feedback, programs you'd like to see, or especially bug reports, please send him a note at: loren_blaney@idcomm.com. Thanks!
Last update: 10-Apr-2010