Created by Andrew Hazelden
Based upon uBASIC by Adam Dunkels
IRIXBASIC is a simple BASIC interpreter that was developed for the 2012 Summer RetroChallenge. IRIXBASIC is designed for the Silicon Graphics O2 system and provides a graphical basic interpreter. It supports the standard basic language drawing commands like plot, move to, line to, and circle. The program uses SDL for graphics along with the SDL_ttf and SDL_gfx libraries.
I was inspired to create this project for the retro challenge because my earliest childhood memories of computers is from the evenings I spent writing small BASIC programs on an Atari 400. It also seems appropriate that IRIXBASIC was launched on July 31, 2012. That is exactly 30 years to the day the Commodore 64 computer hit the market.
Here are a few screenshots of IRIXBASIC running on IRIX 6.5 on my Silicon Graphics O2 system.
IRIXBASIC version 1.0 alpha now available for download. The download includes precompiled versions of IRIXBASIC for Silicon Graphics IRIX 6.5 and Mac OS X 10.6. The download includes example .bas scripts that are stored in the scripts folder. The source_code folder also has an untested Linux makefile for the adventurous types.
irixbasic-v1-alpha.zip (1.2 MB)
You can also explore the IRIXBASIC source code on GitHub.
You need to launch IRIXBASIC from the command line so it knows the path to the IRIXBASIC font, default script, and the program icon.
When you run IRIXBASIC from the command line you have the following options:
Usage: irixbasic <script.bas> [options]
–window <width> <height> [-fullscreen]
Set the size of the main window
Here are several command line options you can explore:
You can start IRIXBASIC and it will launch the default program (scripts/default.bas):
You can start IRIXBASIC and launch a specific .bas file:
You can start IRIXBASIC and launch the program in a resized window:
./irixbasic scripts/waves.bas –window 800 600
You can start IRIXBASIC and launch the program in fullscreen mode:
./irixbasic scripts/waves.bas –window 1280 720 -fullscreen
Once you start IRIXBASIC you will see a blue console window that lists the current script. To start running the script click in the blue console window. You can quit a script at any time by bringing the blue console window to the foreground and pressing the ESC (escape) key on your keyboard.
IRIXBASIC works with a subset of the standard BASIC syntax. Here are a few examples to show what is possible.
Here is an example of a random number generator and the print command:
20 n = random
30 print “Your lucky number is: “, n
40 sleep 1000
The print command writes text on the screen. You can use words in quotes, numbers, and integer variables. You can add a comma to insert a space between each item or a semicolon to keep the text together.
Here is an example that shows a for / next loop:
10 for x = 0 to 100 step 10
20 print “loop: “, x
30 next x
The step command is optional and can be used to increment the for / next loop faster.
Here is an example of an if / then comparison:
20 c = 5
30 if c<10 then print “c is less than 10”
40 sleep 1000
Here is an example of a goto command:
10 print “Hello World!”
20 goto 10
IRIXBASIC Syntax Highlighting
I have created an IRIXBASIC Syntax highlighting module for TextWrangler and BBEdit. This module makes it easy to edit your IRIXBASIC .bas programs using the best text editors on the Mac. The irixbasic.plist codeless language module is based upon the uBASIC.plist created by John Bussjaeger.
The IRIXBASIC scripts have to end with the .bas file extension.
The scripts need to use line numbers and the last line of every program should finish with a line number and the “end” command.
Variables in IRIXBASIC are the lowercase letters a-z.
The IRIXBASIC program works with integer based math.
If no script name is provided from the command line the default script will be run. The default script is called “default.bas” and is located in the relative file path:
Note: The REM command doesn’t work at the moment so you can’t have comments in the file.
The following graphics commands are supported by IRIXBASIC:
cls / clear
Clear the screen using the current backcolor.
forecolor 255, 255, 255
Set the foreground drawing color using r g b values (0-255)
backcolor 255, 255, 255
Set the background drawing color using r g b values (0-255)
plot x, y
Draw a colored point using the current foreground color value.
line x1, y1, x2, y2
Draw a line onscreen using the current foreground color value.
moveto x1, y1
Move the position of the next graphics drawing command.
lineto x1, y1
Draw a line from the last drawing position to the current x / y position using the current foreground color value.
circle x1, y1, radius
Draws a circle using the current foreground color.
fcircle x1, y1, radius
Draw a filled circle using the current foreground color.
Add a delay in milliseconds. ( 1000 ms = 1 second )
Elapsed program runtime counter in seconds. ( The timer output may reset after running for a while. )
Generate a random number from 0 to 127.
Use a random seed value to randomize the number generator.
Returns a 7-bit integer cos value. An output of -127=-1, 0=0, and 127=1
Returns a 7-bit integer sin value. An output of -127=-1, 0=0, and 127=1
Returns 1 if the mouse button is pressed and 0 if it is released.
Example IRIXBASIC Scripts
The following examples are included with IRIXBASIC to get you up and running:
Draws an ASCII art boat onscreen using the print command.
Draws random circles onscreen.
This demonstrates the mouse “button” command. The script shows a green circle when you click the mouse button and a red circle when the mouse button is up.
This is a countdown to launch example that uses the sleep command.
This is the default program that is run if you don’t type in the name of a script.
Prints the words “Hello World” onscreen until you press the escape key to quit.
Draws colored lines onscreen using the forecolor, moveto, and lineto commands.
Draws even more random circles onscreen.
Prints off 10 random numbers. This demo doesn’t use the srand function so it has the same number sequence every time.
Draws colored text using the forecolor command.
This script starts a 15 second countdown using the timer command.
This shows an integer based wave drawn using cosine.
Sept 9, 2012 – IRIXBASIC now works on Sun Solaris!
I have good news for Sun Solaris retro-computing fans. Mark Wickens has kindly provided a Solaris UNIX makefile for IRIXBASIC. You can now compile & run IRIXBASIC on your favorite Sun computer systems. Mark compiled and tested IRIXBASIC on a Sun Ultra 5 using the opencsw binary packages repository for Solaris 9.
Note: The SDL graphics library “SDL_GFX” isn’t in the opencsw repository and has to be compiled separately to use IRIXBASIC.
You can download the official IRIXBASIC for Sun Solaris makefile here: