Sega Saturn Homebrew with Game BASIC

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.

Leave a Reply

Your email address will not be published. Required fields are marked *