Sega Saturn Game BASIC Programming

This article has been re-published, with permission, from its original source.


Part 1: Introduction

Summary

Game BASIC for Sega Saturn is a homebrew development kit that allows you to program games for the Sega Saturn using the BASIC programming language.  If you’re familiar with the PlayStation’s Net Yaroze platform, think of this as the Saturn’s answer to it – just cheaper and easier to get started with.

Game BASIC’s use of the BASIC language makes for a very low barrier to entry in terms of programming skill.  Though the Saturn is notoriously difficult to program for, Game BASIC makes it easy to get started and is surprisingly powerful, allowing very easy sprite manipulation and straightforward 3D polygon implementation.  It even includes an adapter cable that allows you to communicate with the Saturn from your PC to transfer or save programs and streamline development. For example, here’s a Pilotwings-esque demo, but in Game BASIC:

“Jump” demo, provided with Game BASIC (video courtesy Satakore.com)

The caveat?  Game BASIC was released only in Japan, so this means a complete setup can be difficult to obtain and all documentation is in Japanese!  Moreover, the supporting software that allows you to use your PC for streamlined development was intended for the Windows 95 era and flat out does not install on modern systems. Oh, and the adapter cable that allows you to connect your Saturn to your PC is a 25-pin serial connection!

Who in the world still has both Game BASIC and a Windows 95 PC with a physical serial port? Nobody!  (Well, unless you’re Modern Vintage Gamer) But if you’re a brave experimenter who’s not afraid to tinker a bit, there are still multiple options to get everything working, even today!  You can even do a lot just via emulation.  So, let’s head to the Lab and get started…

What You’ll Need

There are several options for working with Game BASIC, ranging from quite simple but clunky to work with, to quite powerful and streamlined.  Here are the three options:

The Simple Saturn-only setup

Required Tools
  • A copy of the Game BASIC for Sega Saturn disc
  • The ability to play Japanese Saturn games (A Japanese or modded console, a Pro Action Replay/Pseudo Saturn Kai cartridge, or a Saturn emulator)
  • Any Saturn controller
  • Plenty of room in the Saturn’s internal memory (if you want to save your programs)

For this option, you’ll run Game BASIC on the Saturn with no PC connection, using only standard Saturn accessories.  This is a reasonable choice if you just want to write “Hello, World!”-style programs or play around with the neat games and demos that come with the kit.  Theoretically, you can write even the most complex programs this way, but you’ll run into limitations on the size of games you can save to the Saturn’s internal memory.  Plus, programming with a virtual keyboard is an absolute pain.  Start here if you don’t have the necessary hardware for the other options, or if you just want to poke around a bit and see what this is all about.

The Enhanced Saturn-only setup

Required Tools
  • All of the tools from Option 1, PLUS
  • Some kind of external expanded memory, such as:
    • A direct-save memory cartridge (e.g., the official Saturn Backup Memory)
    • A Sega Saturn Floppy Disk Drive and some 3.5″ floppy disks
  • A Sega Saturn keyboard OR the NetLink keyboard adapter with a PS/2 keyboard
  • Fun peripherals, like the Stunner light gun, 3D Control Pad, multi-tap, and Shuttle Mouse

One of the great things about Game BASIC is how easy it makes it to access the Saturn’s peripherals, including the internal backup RAM, external memory cartridges, and even the Saturn Floppy Disk Drive.  With a setup like this, you’ll have plenty of space to save your programs and you can use a real keyboard for text entry.  You can even start experimenting with different forms of input, like analog controls and light guns!  But without access to the tools a PC provides, it will be difficult to make nice-looking sprites, textures, and 3D models.  So, this will still limit what you’re capable of.  Regardless, this is a great option for the sheer fun factor of “Hey look! I’m programming with my Saturn!” or if you have no ability to connect your Saturn to a PC.

You can even go this route with a Saturn emulator, giving you easy access to improved keyboard, mouse, and storage options.  I’ve confirmed that Mednafen successfully emulates Game BASIC and allows for keyboard and mouse pass-through input, meaning you can do a whole lot of Saturn development with very little barrier to entry.

The Full Saturn plus PC Setup

Required Tools
  • A complete Game BASIC for Sega Saturn kit, including:
  • A modern PC with a USB port, capable of running a Virtual Machine (I use VirtualBox)
  • A copy of Windows XP SP3 32-bit to install on a VM
  • USB-to-Serial adapter (Must support RS232 with a DB25 connector)
  • The ability to play Japanese Saturn games on original hardware (Japanese or modded console, or a Pro Action Replay/Pseudo Saturn Kai cartridge)
  • A Saturn controller
  • Optionally, any fun Saturn accessories you may want to experiment with (I especially recommend a keyboard or keyboard adapter)

This is the Cadillac option!  This is the setup I use, is how Game BASIC was really intended to be used (well, except nobody expected it to be run on a VM, I suppose), and is what the rest of this guide will focus on.  With this setup, writing a game is as simple as writing BASIC in a text editor and hitting a couple of buttons to send it to your Saturn, where it immediately shows up on your TV and responds to controller and keyboard input!  Seriously, it’s super cool once you get it working…

The Simple and Enhanced Saturn-only setups are extremely straightforward.  You just boot Game BASIC like any other Saturn game and get started, so there’s not much configuration to discuss.  Regardless of the setup you choose, continue on to Part 2 for a few test programs.  But if you want the Full setup, it’s quite a project to get going, so read on to Part 3 for the complete How-To!


Part 2: Hello, Saturn!

Step 1: Our First Program

Let’s start our Game BASIC adventure in the same place as most programming tutorials: Hello, world!  But we’re doing this on Saturn, right?  So, let’s mix it up a bit…

Boot Game BASIC on your Saturn and you should see a screen like this:

Now type in the following, either with your connected keyboard or with your controller using the virtual keyboard (hit L+R+Start to bring it up).

10 PRINT "HELLO, SATURN!"
20 GOTO 10
RUN

Once you hit Enter after entering RUN, your Saturn should output something like this:

Congratulations, you’re now a Saturn programmer!  Hit Ctrl+C on your keyboard or A+Start on your controller to cancel the program and return to the prompt.

Step 2: Loading a Program from CD

Now here’s where things get more interesting.  Game BASIC makes it really easy to read from devices, such as the CD-ROM drive.  Type the following and hit Enter:

FILES "CD:"

You should see a whole list of files scroll by.  These are all the sample files available on the CD!  So, let’s explore one.  Type the following and hit Enter:

LOAD "CD:CLOCK.B"

You should hear the CD spin up momentarily, then you’ll be returned to the “Ready” prompt.  Type the following and hit Enter:

RUN

Cool, huh!?  Assuming you’ve set your Saturn’s internal clock correctly, you should see today’s date and time!  Hit Ctrl+C or A+Start to cancel the program and return to the prompt.

But… uh, oh.  Something doesn’t look right, does it?  Cancelling out of a program often leaves Game BASIC in a strange state, especially if the program you’re running messes with the various screen modes.  Bring everything back to normal with a simple press of “F12” and we’re good to go. (F12 is available via the virtual keyboard if you don’t have a physical one connected.)

Step 3: Editing a Program

Okay, the clock is pretty cool, but how does it work?  Well, you can review the code for any loaded program with the following command:

LIST

List out the clock program, and you can see it’s pretty simple.  It switches the Saturn to a display mode called SCREEN 0, zooms in a bit to make everything look bigger, retrieves the date from the Saturn and formats it to look nice, then loops forever to keep it updated to the second.

But what if you don’t like that and want it to work differently?  Cancel the program (you should know how to do that by now) and run the trusty LIST command again.  Now, you can use the Page Up (P.↑) and Page Down (P.↓) commands to navigate the code!  Change this line:

110 ZOOM 4,2,4

To this:

110 ZOOM 4,1,4

VERY IMPORTANT: Once you make the edit, you must hit Enter while on the line you’ve just edited!  If you don’t do this, your change won’t be saved to memory and you’ll have to do it over again.

Now use the arrow keys or A+D-pad to navigate the cursor to the start of a blank line and LIST your program again.  If all went well, you should see your edits and be able to RUN the program and see what changed!  This was a minor modification, but you get the idea.

Step 4: Saving a Program to BRAM

That was a lot of hard work, wasn’t it?  You wouldn’t want to lose such important stuff, would you?  So, let’s save it and make sure we can cherish it forever!  This is where the Saturn’s internal memory really comes in handy.  Back at the “Ready” prompt, type the following and hit Enter:

FILES "BRAM:"

You’ve already seen the FILES command, but this time, we’re telling it to look at the Saturn’s internal backup memory.  This command will list out any file in memory that ends with the “.B” extension.  Since this is your first time using Game BASIC, there won’t be any results.  Let’s change that.  Now type the following and hit Enter:

SAVE "BRAM:TEST.B"

Now run the FILES command again, and you should see your program listed!

FILES "BRAM:"

Your program can now be loaded back at any time.  In fact, let’s prove it.  If you want, you can turn your Saturn off and back on again and you’ll still see your program in the file listing (assuming you have a working battery in your system…).  You can even exit to the Saturn’s internal memory manager and your program will show up there, just like any other save file.

But let’s shortcut all that and run the following three commands:

LIST
NEW
LIST

This should demonstrate that your program is gone from the Work RAM and needs to be reloaded, just as if we had power-cycled the system. (The “NEW” command replaces the loaded program with a new, blank one.)  Enter the following commands:

LOAD "BRAM:TEST.B"
LIST

And there you have it; your program is back!  RUN it or edit it to your heart’s content.  If you ever get tired of the program or need to free up space, you can always delete it from the Saturn’s built-in memory manager, or just run the following:

KILL "BRAM:TEST.B"

Run our old friend the FILES command to verify that it is, in fact, gone.

NOTE: The FILES, LOAD, SAVE, and KILL commands can all read from multiple devices.  If you have an external memory cartridge that supports direct-save, or even a Saturn Floppy Disk Drive, you can work directly with those!  Here are the different options:

  • BRAM – Internal, battery-backup RAM
  • CRAM – External, cartridge RAM
  • FD0 – Saturn Floppy Disk Drive, side 1
  • FD1 – Saturn Floppy Disk Drive, side 2
  • COM – Your PC’s temporary folder (if you have a serial connection set up)

Just substitute those in where we used “BRAM” in the examples, and you’re good to go.  For example, to save to cartridge RAM, use the following:

SAVE "CRAM:TEST.B"

Step 5: Explore the CD’s Demo Programs

Okay, yeah, nothing we’ve done so far is super impressive.  Let’s start exploring some cooler stuff!  Remember all those programs we saw when we used the FILES command on the CD drive?  Let’s do that again, but this time, we’ll add a wildcard to look at only executable programs:

FILES "CD:*.B"

See the one called “LAUNCH.B”?  That’s what we’re interested in.  You should know now how to load and run it, but if you need a refresher, here are the commands:

LOAD "CD:LAUNCH.B"
RUN

(Protip: If you have a keyboard attached, hitting Shift+F1 automatically launches the LAUNCH.B program without having to type any of the above!)

This program is a friendly browser that allows you to navigate all of the demo programs on the disc!  I recommend just exploring and having fun with what it provides.  Some of the programs are excellent examples of how powerful Game BASIC really is.  I recommend DEMO.B, G_JUMP.B, G_MAZE.B, G_THESEU.B, and G_MOBIL.B.

Many of the demos require peripherals, such as the multi-tap, light gun, 3D controller, Shuttle Mouse, or Mission Stick.  For example, G_JUMP_A.B is a version of G_JUMP.B that uses the analog pad of the 3D controller, and G_JUMP_M.B uses the Mission Stick.  If you don’t have the right peripheral attached when you launch a demo, you’ll usually get an error message in Japanese.  If you don’t speak any Japanese, you’ll just have to experiment.  But hey, that’s what the Lab is all about, right?

That’s it for Part 2!  Technically, you have everything you need to start writing Saturn games!  Between the tutorials in Part 5, additional documentation in Part 7, and LISTing the code from the demo programs on the CD, you can learn a lot and start programming your own Saturn applications.  But it’s kind of tedious working directly off of the Saturn, isn’t it?  If you’re lucky enough to own the Saturn-to-PC serial cable that comes with the complete kit, continue on to Part 3 to really level-up your Saturn development!


Part 3: Set up a Game BASIC Development VM

Summary

For this part of the project, I’ll assume you’ve acquired a complete Game BASIC kit, including the Saturn-to-PC hardware adapter.  You’ll notice that one end of the adapter plugs into the Serial port on your Saturn, while the other end has an old-fashioned female DB25 connector.  This may look similar to an old parallel port, but it’s not!  It’s actually serial.

You’ll also need to purchase a USB-to-Serial adapter.  Most adapters have a DB9 connector, so you’ll either need one with a DB25 connector or one that comes with a DB25-to-DB9 adapter of its own.  I’ve had a lot of success with the StarTech adapter available on Amazon.

This part of the project may vary, depending on what VM platform you prefer and what USB-to-Serial cable you purchased.  I will walk through how to get everything working with a VirtualBox VM and a StarTech USB-to-Serial adapter.  If you decide to use different tools, the theory will be the same, but individual steps will vary.  With that said, let’s get started…

Step 1: Set up your USB-to-Serial device

This step will vary depending on what adapter you purchase.  For my StarTech adapter, I was able to plug the cable in to my Windows 10 64-bit machine and install the driver software that came on CD in the box.  I noticed that Windows auto-recognized the cable and tried to install a driver of its own, but that driver did NOT work for me.  The one on the CD worked perfectly, so just follow the instructions that come with the cable.  Once setup is complete, you can verify that it worked correctly by going to the Device Manager in Windows (right-click the Start button).  In order for everything to work correctly, your device MUST be installed as a COM port.  Here, you can see mine is installed to COM3:

Device Manager

Step 2: Basic VM Creation and Setup

Start by installing VirtualBox on your PC if you haven’t already.  Create a new VM for Windows XP 32-bit (the 32-bit edition is important!) and follow standard install procedures that are well documented elsewhere, such as here or here.  I won’t go into detail because this isn’t a VirtualBox support article!  Use Google if you need more help.  Once your Windows XP VM is running, if you’re using VirtualBox, then I highly recommend installing the Guest Additions for major quality of life improvements (dynamic resolutions based on your window size, drag-and-drop and copy/paste to host machine, etc.).  To do that, boot your VM, then choose the Devices menu and the “Insert Guest Additions CD image…” option.  This should autorun a simple installer program.  If it doesn’t autorun, you can find the installer mounted as a CD drive in the VM.

Step 3: Set up Japanese Language Support

Remember, the software designed to communicate with your Saturn was developed for the Japanese market, for Japanese PCs and Japanese users… So, it’s all in Japanese!  If you don’t install Japanese language support, all of the text will show up as gibberish control characters.  While you can certainly get by without this step (especially if you don’t speak any Japanese), it will clean up all of the UI elements quite a bit and just make overall operation smoother.  Plus, with the proper text displayed, it’s easier to use tools like Google Translate to figure out what you’re looking at.

There are two steps to proper Japanese language setup…

Step 3a: Enable the Japanese Text Service and IME

To enable general Japanese text support and the Language Bar with Japanese IME, complete the following steps:

  1. Go to Control Panel
  2. Open Regional and Language Options
  3. Go to the Languages Tab
  4. Click Details
  5. Click Add
  6. Select “Japanese” for both the Input Language and Keyboard layout/IME options

If you plan to use Japanese text input, make sure the Language Bar is working.  Once Japanese text support is enabled, click the Language Bar button on the “Text Services and Input Languages” window (Step 4 above) and ensure “Show the Language bar on the desktop” is checked.  You should see an “EN” icon in your taskbar.  Click it and choose “Show the language bar” to expand it to a floating toolbar.  Click where it says “English” and select “Japanese” to change your input language.  Use this to switch back and forth between English and Japanese text entry!

Enabling Japanese Text Service and IME

Step 3b: Expand Japanese Language Support to Additional Programs

The step above will enable support for any Unicode-based Japanese text.  The problem is, the programs we’re working with are ancient and pre-date widespread Unicode support!  Additionally, there are other useful programs (like Notepad) that don’t automatically support Japanese text.  So, we have to take a couple additional steps.

  1. Go to Control Panel
  2. Open Regional and Language Options
  3. Go to the Languages Tab
  4. Click Details
  5. Click the Advanced tab on the “Text Services and Input Languages” window
  6. Check “Extend support of advanced text services to all programs”
  7. Click OK
  8. Click the Advanced tab on the “Regional and Language Options” window
  9. Under “Language for non-Unicode programs,” select “Japanese” and click OK

If you anticipate doing lots of copy/pasting of Japanese text from the VM to your host machine (for instance, to use Google Translate for various documentation), then I recommend running similar steps on your Windows 10 instance.  Otherwise, Japanese text from your VM will often copy over as gibberish control characters in your host machine:

  1. In Windows 10, click Start, then Settings
  2. Click Time & Language
  3. Click Language
  4. Click Add a preferred language and choose Japanese
  5. Once enabled, return to the Time & Language window and choose Region
  6. Click Additional date, time, & regional settings
  7. Click the Administrative tab
  8. Under “Language for non-Unicode programs,” click Change system locale… and choose Japanese

Step 4: Enable the VM’s COM Port

Here’s the true secret sauce!  This is the step that will allow your Windows XP virtual machine to talk to your USB-to-Serial adapter, and anything it may be connected to (like, say, a Sega Saturn!).  To complete this step:

  1. Shut down your VM completely
  2. In VirtualBox, open your VM settings
  3. Click Serial Ports
  4. On the “Port 1” tab, check “Enable Serial Port”
  5. For Port Number, choose COM1
  6. Leave IRQ and I/O Port as they are
  7. For “Port Mode” choose Host Device
  8. “Connect to existing pipe/socket” should automatically be checked
  9. For “Path/Address,” enter the COM port your USB-to-Serial adapter installed to on the host machine (go back to Device Manager in Step 1 to confirm this value).  For me, it was COM3.  Here’s what my settings look like:
Configuring COM port emulation in VirtualBox

In short, our USB-to-Serial adapter is mapping the USB port to an old school COM port on our host machine.  We’re then mapping that faked COM port to COM1 on our virtual machine.  As far as Windows XP can tell, it’s communicating with an old school hardware serial port, but it’s really a USB device in Windows 10!

Now, start your Windows XP VM again and confirm that the COM1 port is enabled by going to Control Panel, Administrative Tools, and Computer Management.  Click Device Manager and look for COM1 under “Ports (COM & LPT).”  Here’s what mine looks like:

Verifying the COM port in Windows XP

Step 5: Install the Game BASIC Windows 95 Tools

Now that we’ve completed all the basic VM setup and configuration, it’s time to start working with the actual Game BASIC tools!  With the VM booted, insert your “Game BASIC for Sega Saturn for Windows 95” disc into your host machine and ensure the drive is made available in the XP VM (it should be by default, but Google is your friend if you have any trouble).  If it doesn’t autorun, launch “ToolLoad.exe” from the CD drive and install both BASTERM and DXF CONVERTER.  (ToolLoad.exe may be a hidden file, so either configure XP to show hidden files or manually launch Instbt10.exe to install BASTERM and Instdc10.exe to install DXF CONVERTER.)

Game BASIC for Sega Saturn Windows Tool Setup dialog

That’s it!  You can now launch BASTERM and DXFCONV from the Start menu.  If everything went well with the Japanese language support, you should have seen Japanese text during install and a fully Japanese interface in both programs.

What are these?  BASTERM is “BASic TERMinal” and allows you to communicate BASIC programs back and forth with the Saturn via the serial connection.  DXFCONV is a program that converts DXF format 3D models into BASIC code that you can then include in your programs.  Here’s what they each look like:

BASTERM
DXFCONV

Step 6: Test (and Troubleshoot) Your Connection

Now that everything is installed, let’s connect our PC to the Saturn and make sure everything works the way it’s supposed to:

  1. Boot Game BASIC in your Saturn up to the “Ready” prompt
  2. Plug one end of your Saturn-to-PC serial cable into the Saturn’s serial port
  3. Plug the other of your Saturn-to-PC serial cable to the Serial end of your USB-to-Serial adapter. (NOTE: This can be a VERY tight fit!  Make sure you’re really inserting it all the way.  I didn’t have it pushed in all the way on my first try and wasted 20-30 minutes troubleshooting before I realized what the problem was.)
  4. Plug the USB end of your USB-to-Serial adapter into your PC
  5. Boot your Windows XP VM
  6. Launch BASTERM

Before we go any further, let’s familiarize ourselves with the BASTERM interface.  Yeah, the Menus and Tooltips are all in Japanese, but the main icons across the top of the window are most of what we need and are fairly self-explanatory.  From left to right, they are:

  1. New File
  2. Open
  3. Save
  4. Cut
  5. Copy
  6. Paste
  7. Connect to Saturn
  8. Run (on Saturn)
  9. Stop (on Saturn)
  10. Load Program from Saturn
  11. Send Program to Saturn
  12. Direct Keyboard Input

To test our connection, let’s start with the Direct Keyboard Input option.  Once you choose it, if all goes well, you’ll see the following image pop up:

Direct keyboard input window

While this window is open, all keypresses on your keyboard will be sent to the Saturn!  Try it out by entering the following:

LOAD "CD:LAUNCH.B",R

As you type this line out, you should see each character appearing on your TV screen, as it’s sent from your PC to your Saturn!  When you hit Enter, it will run the Launcher program we saw in Part 2.  If this is working, then you’re all set – you have a fully working connection!

However, if you received an error message when you clicked the keyboard icon in BASTERM, there’s a problem with the connection.  Here’s what that message looks like:

BASTERM connection error dialog

Basically, it says “the connection to the Saturn failed, please check your connection.”  If you’ve been following the instructions in this tutorial so far, there’s really not much that can go wrong.  Check the following:

  1. Check that the COM1 port is active in your Windows XP VM (see Step 4 above)
  2. Check that a COM# port is active in your host machine (see Step 1 above)
  3. Make sure that your VM’s COM port is properly mapped to the correct COM# port on your host machine (see Step 2 above)
  4. Make sure that all cables are securely and completely connected. (This was the step that got me on my first attempt.)

If you do make any changes, especially plugging/unplugging cables, reboot your VM to make sure it sees the changes.  I have the most success by fully shutting down the VM and powering it back on, rather than using the Windows Restart command.

Beyond that, it should Just Work™ so double and triple check all of these potential points of failure until you have a working connection.  Once everything is looking good, it’s time to get to work!

Step 7: Increase the Serial Connection Speed

Now that we have a working connection, you can start to use BASTERM to its full potential.  But first things first, let’s speed up our serial connection.  The default speed is okay for test programs, but once you start transferring larger files, it will be far too slow.  In BASTERM, do the following:

  1. Click the Settings menu (the fifth menu from the left, with an (S) next to it)
  2. Click the Communication Settings option (the second option, with a (P) next to it)
  3. Here, you can change the COM port and baud rate.  Click the radio button next to 19200 and click OK.
BASTERM communication settings

The Saturn and BASTERM need to be set to the same baud rate to properly communicate, so now do the following on the Saturn:

  1. Press L+R+Z on your controller
  2. Use the D-Pad to select the Baudrate option and switch it to 19200 BPS
  3. Select Exit with the C button to save and return to the “Ready” prompt

To test the new configuration, do the same thing we did in Step 6 and open the direct keyboard input window. If it connects, you’re all set!  If not, double check that your settings saved properly and that everything is still connected.  Power down and restart your VM for good measure.

PROTIP: For an unofficial way to increase the connection speed even further, see Part 8: Tips and Tricks!


Part 4: Run, Load, and Save Programs via Serial Connection

Instead of using the clunky text editor on the Saturn to write your programs, there are several ways to get BASIC programs into BASTERM for execution on the Saturn, including direct entry from BASTERM, loading a file from the Saturn to BASTERM, or loading a *.B file from your PC. You can even go the other way around by requesting files from the PC via the Saturn.

Option 1: Directly Run a Program from BASTERM

Let’s start with direct entry.  In the main BASTERM window, simply type out the “Hello, Saturn!” program from Part 2:

Typing a program directly into BASTERM

To transfer the program to the Saturn, just click the Send to Saturn button (second button from the right, next to the keyboard button).  This will load the program into the buffer on the Saturn itself.  You’ll see the LOAD command appear on the TV, followed by a line count.  When it’s complete, you’ll be returned to the Ready prompt.  Now click the RUN command in BASTERM (the button with the blue arrow).  This will execute the program on the Saturn, and you should see the beautiful results on your TV!  Click the STOP command (the button with the red, upside-down triangle) to end execution and return to the Ready prompt.

Feel free to play around with things like the LIST command and using direct keyboard input to explore exactly what’s being sent to the Saturn and saved into its memory.  In short, BASTERM is not a live terminal application where what you type is what ends up in the Saturn.  Instead, you type out the program you want, then send the entirety of it to the Saturn for execution.

Option 2: Load a Program from Saturn to BASTERM

Next, let’s load a program from the Saturn to BASTERM.  Using your input method of choice, type the following on the Saturn:

LOAD "CD:P_CLOCK.B"
LIST

This will load and display the “P_CLOCK.B” program. Now that it’s in the Saturn’s memory buffer, all you have to do is click the Send to PC button (third from the left, next to the STOP button).  BASTERM will pop up a dialog asking if you’re sure you want to close the program that’s currently open.  Click OK.  After the dialog, the main BASTERM window will update to contain the program you loaded from the Saturn CD!  You can load a program from any form of Saturn storage, be it CD, BRAM, CRAM, etc., and this will work exactly the same way.

Now, you can use BASTERM to edit the program, then send the updated version back to the Saturn and run it, just like the steps in Option 1.

Let’s save this file to our PC for safe-keeping and later reference.  In BASTERM, click the Save command (the third from the left, looks like a floppy disk).  This is just a normal Windows save dialog, so name the file MY_CLOCK.B and click Save.

Option 3: Load a *.B File from PC

This one is dead simple.  In BASTERM, click the Load command (second button from the left, looks like a folder).  Select a *.B file, such as the one we just created in Option 2, and click Open.  You should see your program in the main terminal screen, and now you can use all the same commands as we learned in Option 1.

A .B file loaded into BASTERM

Option 4: Request a *.B from PC via Saturn

This last two options are a little convoluted, but worth mentioning.  Mostly because it’s fun to tinker with!  With an open serial connection, Game BASIC is capable of seeing your Windows XP VM as an external storage device.  This works by designating a temporary directory to read from.  To check what the current directory is set to, click the Settings menu in BASTERM (the fifth menu, with the (S) next to it), and the Current Directory option (the first option, with the (D) next to it).  This will pop up a menu with the directory (on the VM) that Game BASIC has access to.

Locate that directory in Windows Explorer (it helps to enable display of hidden files and folders in Windows), and place any *.B file into it (for instance, our MY_CLOCK.B program from Option 2).  Now, in BASTERM, open a connection to the Saturn with the Connect to Saturn command (seventh button from the left, to the left of the blue arrow).  Then, from the Saturn itself, type the following:

FILES "COM:"

This will list out all of the available *.B files in your BASTERM temp directory.  You should see MY_CLOCK.B listed.  Now let’s actually load it:

LOAD "COM:MY_CLOCK.B"
LIST

This will load MY_CLOCK.B from BASTERM’s temp directory, then LIST the contents on your Saturn.  Edit it and run it as you see fit!

Option 5: Save a *.B File Directly from Saturn to PC

Finally, now that we have our program loaded on the Saturn, we can save it directly back to the BASTERM temp directory over the COM connection.  Like above, make sure the Connect to Saturn button is clicked in BASTERM.  Then, from the Saturn, run the following:

SAVE "COM:CLOCK_2.B"

You’ll now see the file created in your BASTERM temp directory!  You can then load it like any other file, as we did in Option 3.

And there you have it!  That’s all the Save/Load/Run functionality you need to really get going with BASTERM.  If you want more information on how to use BASTERM, like what all those Japanese options mean, you can find an English translation of the BASTERM README file in the Documentation section of this series.


Part 5: Tutorial Programs

This section will be a living document, slowly growing over time to cover the tutorial programs documented in the “Tutorial Manual” that comes with the complete Game BASIC package.  They’ll be organized into four sections: Basic Programming, 2D Graphics, 3D Graphics, and Sound.  If you haven’t already, start with Part 2 for several simple example programs.  These tutorials will not repeat some of the basic file operation commands that are covered there.

Section 1: Basic Programming

First, let’s start with some very simple output examples.  These commands should all be entered directly on the Saturn at the Ready prompt, rather than via BASTERM.  Type each in and hit Enter to see the results!

Text output

PRINT "HELLO!"

Numeric output

PRINT 1+2

Clear the screen

CLS

Assign numeric variables with LET

LET A=1
PRINT A

Assign numeric variables without LET and use arithmetic operations

X=2
Y=3
Z=X+Y
PRINT Z

Assign string (text) variables

A$="HELLO!"
PRINT A$

Assign string (text) variables and concatenate

A$="HELLO, "
B$="WORLD!"
PRINT A$+B$

Use line numbers to write and store a program into Work RAM

10 PRINT "HELLO!"
20 END
LIST
RUN
CLS
LIST

(See Part 2, Step 3 for more on editing programs in Work RAM.)

Clear the Work RAM and start a new program

NEW

From here on out, programs will have line numbers.  This means you can either enter them directly into the Saturn or use the techniques from Part 4, Option 1 to execute them from BASTERM.

A simple clock and loop

100 SCREEN 0
110 ZOOM 4,2,4
120 *LOOP
130 LOCATE 0,2:PRINT RIGHT$(DATE$,18)
140 GOTO *LOOP

IF/THEN logic

10 A=0
20 A=A+1
30 PRINT A
40 IF A=500 THEN GOTO 60
50 GOTO 20
60 END

Reformat and renumber programs

LIST
RENUM
LIST

(Run the above directly from the Saturn)

FOR/NEXT loops

10 A=0
20 FOR I=1 to 10
30 A=A+I
40 NEXT I
50 PRINT A
60 END

Nested FOR/NEXT loops

10 FOR I=0 to 10
20   FOR J=0 to 10
30         PRINT STR$(I)+","+STR$(J)
40   NEXT J
50 NEXT I
60 END

Using SUBs

100 GOSUB 200
110 FOR I=1 to 4
120 GOSUB 210:GOSUB 220
130 NEXT
140 GOSUB 210:GOSUB 200
150 END
200 PRINT "-----------------":RETURN
210 PRINT "|   |   |   |   |":RETURN
220 PRINT "|---|---|---|---|":RETURN

Using arrays

100 DIM BOX$(4)
110 BOX$(0)="CANDY"
120 BOX$(1)="MANJYU"
130 BOX$(2)="CHOCO"
140 BOX$(3)="SENBEI"
150 BOX$(4)="JERRY"
160 FOR I=0 TO 4
170 PRINT BOX$(I)
180 NEXT
190 END

READ/DATA commands

100 DIM BOX$(4)
110 FOR I=0 TO 4
120 READ BOX$(I)
130 PRINT BOX$(I)
140 NEXT
150 END
160 DATA CANDY,MANJYU,CHOCO,SENBEI,JERRY

Part 6: Sample Homebrew Programs, Tools, and Documents

It’s hard to tell how popular Game BASIC was upon its initial release, other than to say that finding a physical copy outside of Japanese eBay sellers is pretty difficult these days.  But if you plumb the depths of the internet, there are actually some interesting relics of the time available.  Game BASIC was originally released in 1998, an age where the internet was just starting to catch on in the mainstream.  Consequently, there was a small but dedicated group of Japanese fan sites that were focused on it, with documentation, tools, demos, and even a handful of small playable games.  And the best part is, many of those sites have been saved by the Internet Archive Wayback Machine!

English Resources

The best place to start exploring, especially if you’re an English speaker, is at Satakore.  They’ve built a wonderful collection of homebrew Game BASIC programs, seemingly sourced straight from these old Japanese archives.  Definitely check them out first, along with these homebrew highlights I recommend:

After exploring what’s available at Satakore, I suggest checking SegaXtreme, which has a collection of tools that would be helpful to any Game BASIC developer, including 3D modeling tools that can create models suitable for DXFCONV, or even save directly as a BASIC file. They also have a handful of random 3D models and sample programs hidden away in their web server (with some overlap with what’s available at other sites):

And finally, there are two other old English-based Game BASIC fan sites that I’ve been able to find:

Japanese Resources

And that’s about it for Game BASIC info in English.  From here on out, you’re going to need your browser’s translate function to learn much.  But it’s also where you’re going to find the most information — if you have the patience and curiosity to work your way through it!  Many of the file download links on these archived pages are even still working.  Here’s what I’ve managed to track down:

Share at Flyback Labs

If you are aware of (or manage to find) any other useful sites, please share a link in the comments.  I’ll happily add it to the list and credit you for the help!  In the meantime, what’s your favorite homebrew you’ve found?

I have also set up a dedicated thread here at the Flyback Labs forums to share homebrew, or just chat about Game BASIC in general. Drop by if you have anything to share or have questions on your mind. This is where I’ll be posting my own work-in-progress programs and experiments (starting with a simple spaceship 3D model):


Part 7: Documentation

Game BASIC came with several pieces of documentation, including two physical books and several electronic documents on the Windows 95 Tools CD.  Due to the fact that Game BASIC was only released in Japan, most of its documentation is Japanese-only.  Thankfully, modern tools like Google Translate do a reasonable job when translating bits and pieces, so you can find a lot of valuable information with a bit of patience.  And since this is just an implementation of the widespread BASIC language, resources that document other flavors of the language generally match well to this one.

Here’s a summary of what’s available:

Physical Documentation

  • Tutorial Manual – A 176-page manual with basic tutorials to get you started with Game BASIC.  There is no electronic version of this manual available, but most of it is covered in the tutorials in Part 5 of this series.  The official manual covers:
    • Basic operations
    • Programming tutorials covering text, graphics, and sound
    • Setting up and using BASTERM
  • Reference Manual – A 421-page manual with detailed explanations of every command available in the Game BASIC language, including names, descriptions, parameters, and usage tips.  There is an electronic version of this manual, available below.

Electronic Documentation

Game BASIC also has several electronic documents available, either included on the Windows 95 Tools CD or distributed online after release.  This documentation includes:

  • GAMEBASIC.CHM – A Windows CHM version of the physical Reference Manual.  So far as I can tell, this was provided online by a fan after release, as it is not available on the Tools CD. (Japanese)
    • English GAMEBASIC.CHM from SegaXtreme (very rough machine translation)
    • The above translation is not especially helpful, but I find that Google Translate works quite well for short segments, if you copy/paste sections from the original CHM.
    • To get this file to display properly, you will need to enable Japanese support for non-Unicode programs in Windows (see Part 3, Step 3) and update the security for the file.  Right-click the file, choose Properties, and check “Unblock” in the security section of the window that appears:
Unblocking a .chm file in Windows 10
  • BASTERM readme.txt – A simple README text file with BASTERM release notes (Japanese)
  • BASTERM.HLP – A Windows Help file, accessible from the BASTERM Help menu (Japanese)
    • English BASTERM.RTF: An RTF version of the HLP file (Coming soon…)
  • DXFCONV README.TXT – A README text file with DXFCONV operating instructions and release notes (Japanese)
  • Game BASIC FAQ – An online FAQ from Bits Laboratory with basic technical information and corrections/errata from the Tutorial and Reference manuals

Part 8: Tips and Tricks

This section covers small tips and tricks that can improve your experience working with Game BASIC, be it a way to better use your tools, improve your setup configuration, or work with the BASIC language itself.

Tip 1: “Overclock” for improved CPU speed, higher resolution, and higher baud rate

Often referred to as “HD352 mode” in old online posts, this is an unofficial way to essentially overclock the Saturn.  This mode will increase the CPU speed by about 10%, increase horizontal resolution to 352 pixels instead of 320, and allow much higher baud rates for serial communication – roughly 5-6x the normal top speed.  To enable this mode, enter the following command directly from the Saturn and hit Enter:

OPTION HD352

After you hit enter, Game BASIC will automatically trigger a “HOT START.”  Once the Ready prompt reappears, you’re all set!

If you also want to increase the serial communication speed, follow these additional steps to set the baud rate to 115200 (or 57600 for greater stability):

  1. Update the Saturn’s baud rate:
    1. Press L+R+Z on your controller to open the Options screen (the background should now be red)
    2. Adjust the Baudrate option to your preferred speed (115200 being the highest)
    3. Choose Exit to save and return to the Ready prompt.
  2. Update BASTERM’s baud rate:
    1. Make sure BASTERM is completely closed.  (Since the BASTERM UI doesn’t allow us to choose a baud rate higher than 19200, we have to directly edit the Windows registry to increase the speed.)
    2. In your VM, click Start –> Run, then type in “regedit” and hit Enter
    3. Navigate to My Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Bits Laboratory\BASTERM\1.0
    4. Double-click “Baudrate,” enter 115200 under “Value data” and hit OK
    5. Launch BASTERM and connect to the Saturn
    6. Send a large program and you should see blazing fast speeds compared to before!

NOTE: You may experience some instability in communications or graphical artifacts with this setting in place.  If you ever want to return Game BASIC to the original configuration, use the following command (and be sure to revert your registry’s Baudrate value to match the one set on your Saturn):

OPTION HD320

Tip 2: Speed up BASTERM transfers by sending changed lines only

If you frequently work with BASTERM and want to be able to edit large programs without constantly re-sending the entire thing over a relatively slow serial connection, use this option to send changed lines only.  With it set, a program will be loaded in its entirety the first time you send it.  From there on out, using the Send to Saturn command will send ONLY the lines you have changed.

  1. In BASTERM, choose the Settings menu (fifth menu, with an S)
  2. Choose the Transmission Settings option (fourth option, with an S)
  3. Check the “Send difference” option (third checkbox)
Enabling “Send Difference” option in BASTERM Transmission Settings

Tip 3: Have BASTERM automatically assign line numbers at time of transfer

Constantly starting every line you type in a BASIC program with a line number is obnoxious.  The problem is, Game BASIC requires line numbers from programs being sent via BASTERM.  So why not let BASTERM do the dirty work for you?  Write your program without line numbers (you can always use *LABELS instead of line numbers for GOTOs), then follow these steps:

  1. In BASTERM, choose the Settings menu (fifth menu, with an S)
  2. Choose the Transmission Settings option (fourth option, with an S)
  3. Check the “Send with line number added” option (fourth checkbox)
  4. Adjust the options as you see fit, though the defaults should generally work fine:
    1. Starting number: 1
    2. Increment by: 1
    3. Increment by (for Label lines): 10
Enabling automatic line numbering in BASTERM Transmission Settings
About the author

Dr. Tim (aka Therr)

Retro tech enthusiast and tinkerer. Occasional blogger. flybacklabs.com

Readers Comments (2)

  1. Is it possible to use otvdm instead of virtual machine?

  2. Hello,
    You mentioned that special Sega Saturn to PC hw adapter that comes with the kit, but I cldn’t find anywhere either in ebay etc. Where can I get it
    My 2nd question is that, where is DB25 serial connector in Sage saturn, I cldn’t find it
    Thank you

Leave a comment

Your email address will not be published.


*