Retrochallenge, Retrochallenge 2016/10

Retrochallenge 2016/10 – Post 1

This is part one of my Retrochallenge 2016/10 journal, where I’m working towards loading ROM images to an Intellivision from an Atari 800. To jump to the very beginning, click here.

Getting Started


Here we are 13 days into this Retrochallenge. Traveling out-of-state to visit family in the first weekend and doing minor home renovations on the second weekend has my project started flat-footed. And the usual “I need to work on my Retrochallenge” is losing its Force-like magic of persuasion. On top of that, everything I’ve done so far seems tangential to the real goal of transferring Intv binary files from an Atari 800 to an Intellicart! cartridge emulator connected to a Mattel Intellivision.

But here’s what I’ve been up to:

  1. Evaluating which DOS to use on the Atari 800
  2. Solve a DRIVE NUMBER ERROR message
  3. Deciding which emulator to use on my Linux laptop for initial development
  4. Creating the most convoluted cross-compiling development system possible
  5. Learning a little about the Action! programming language
  6. Pulling together the required code for the Action! Window Gadget library

I’ll cover those first two items in this journal entry.

Pick a DOS

There’s no shortage of Disk Operating Systems for the Atari home computers. Even though I used Atari DOS 2.5 and MyDOS4 throughout my Atari 8-bit days, after a lifetime of using Unix and MS-DOS, I find the old menu-based operating systems painful. I’d prefer a command-line DOS.

The serious Atari hackers use SpartaDOS X, but I don’t think it’s a good fit for this project. One variation of it requires a cartridge, but I’ll be using the cartridge port for the Action! language supercart. And with all its features, I’m doubtful it works as well on the 48K Atari 800 as it does on, say, a 128k Atari 130XE.

For a previous project, I used SpartaDOS’s more 48K-friendly distant cousin, BeweDOS v1.30. This is what I had planned on using at the beginning of the month. However, it uses a SpartaDOS-compatible disk structure that departs from the standard Atari DOS 2.0s format expected by some disk image tools I may use. In the end, I did find it can access Atari DOS 2.0s files via its menu interface, but not the command line. I admit I am enamored by seeing its time-stamps applied to files. While I don’t have a physical R-Time 8 clock cartridge, emulators emulate it.

But, really, since I’m using Action!, a programming system published by Optimized System Software, it seems fitting that I should use one of the disk operating systems released by the same small company of brilliant developers. Besides the original menu-driven Atari DOS which they created on Atari’s behalf, they later released their own command-line operating systems OS/A+ ver 2, OS/A+ ver 4, and DOS XL. My heart was set on using OS/A+ ver 4, for which I have a bona fide physical floppy and user manual. Unlike DOS XL, it hails more from the 48k Atari 800-era and represents a courageous attempt to start with a clean slate and push the Atari platform forward. For example, the authors envisioned being able to exchange data files between Atari and Apple II computers from the same floppy disk. But I’ve been unable to successfully modify its drive table to enable multiple disk drives. (It’s supposed to be updated by running “CONFIG” and then “@WRITESYS” but this hasn’t worked for me).

So, with a mild bit of reluctance, I’ve opted to go with OSS’s Warp DOS XL ver 2.42w, for which I also have a physical copy and manual. In fact, I don’t think this version exists in the normal software archival sites. My documentation’s title page states it’s version 2.30 which *is* archived. I think this “Warp” version takes advantage of Atari 1050 floppy drives with the “Happy” ROM enhancement. (Hm. I see the Atarimax store still sells “Happy” upgrades and my 1050 is now unhappy).

Fix a DOS

My first RTFM moment has arrived

The Atari home computer supports up to 8 floppy drives (D1 thru D8 – which would be an awesome sight to behold). So when using DOS XL, I was perplexed why I was receiving a “DRIVE NUMBER ERROR” when trying to access any devices after D2 (as shown in the image above). I was getting the same error when experimenting with OS/A+ version 2 and 4. My first RTFM moment had arrived.

Turns out DOS XL and OS/A+ ver 2 have a system variable called DRVBYT at address $070A that enables or disables D1 through D8. (OS/A+ ver 4 has a more complex data structure.) DRVBYT is a bitfield with the least significant bit representing D1 and on up through the most significant bit representing D8. If a bit is set, then the corresponding floppy drive is enabled. The default is $03 (D1 & D2 enabled) and is set when the file DOS.SYS is loaded into memory. To change the default requires modifying DRVBYT in RAM and dumping a region of RAM back to the file DOS.SYS. This task sounded a bit more onerous than it turned out to be. But it gave me a chance to do a little Action! and DOS XL work.

Tasks to set DRVBYT in DOS XL:

  1. Write a short Action! program to modify the memory location and run it.
  2. Un-protect DOS.SYS so we can overwrite it.
  3. Run the DOS XL “Init” tool and write a DOS.SYS file only
  4. Protect DOS.SYS

Action! Program to Modify DRVBYT

Action!’s variable declaration is counter-intuitive to what I’m used to. In Action! you define the variable name on the left side of the assignment operator (okay, I’m good with that). On the right side, you define it’s storage address, not its value (okay, that’s weird – but cool). The same task could’ve been accomplished using Action!’s immediate mode, but this is more fun.

Here’s the code.

Action! Code to Modify DRVBYT ($070A)

And the results. Nothing surprising.action_drvbyt_results

Update DOS.SYS

Remove the write protection from DOS.SYS and run the DOS XL INIT tool.dosxl_unprotect

Write out a new DOS.SYS file from memory.dosxl_init_menu

Re-Protect DOS.SYS

Don’t forget to re-apply protection to DOS.SYS. Write protection is signified by the leading asterisk in a directory listing.dosxl_protect_dossys

Fixed DOS

And now I can access D3 (and D4).dosxl_d3_working

D3 (and D4) now are enabled – yea!

Up Next

I need to capture the serial output of the Intellicart! data transfer.

Retrochallenge, Retrochallenge 2016/10

Retrochallenge 2016/10: Prologue

Every ROM cartridge deserves an exclamation mark.

Goal: Atari 800 / Intellicart! Downloader

My Retrochallenge for 2016/10: use an Atari 800 to select & transfer Intv ROMs to an Intellivision via Chad Schell’s serial-based Intellicart! flash memory cart.


Chad Schell’s Intellicart!, an Intellivision cartridge emulator, was released around 2000 and was the first multicart-like device for the Mattel Intellivision video game console. It connected the Intellivision to a Windows PC via a 9-pin serial connector. On the Intellivision, the Intellicart! initially boots to a communications program awaiting the arrival of data from the serial cable. On the PC, the user would select an Intellivision binary ROM file and upload it to the Intellicart!. Once there, the Intellivision rebooted to the just-delivered executable.

The Intellicart! made it possible for developers to test their homebrew programs on real hardware. For others it made it possible to play unreleased and rare games that had somehow found their way onto the Internet.

I acquired my Intellicart! (#171) sometime around 2001. It is my first retrocomputer device. Since then I moved onto the micro-SD based Cuttlecart and (soon) the just-released LTO Flash. I’ve also migrated away from Windows computers and found the original Windows-side Intellicart! application doesn’t behave well under WINE. So the Intellicart! has been dormant for about 10 years. Wakey wakey, eggs and bakey.

During the month, I want to learn how to program using OSS’s Action! programming system for the Atari home computers. This is a language I never owned or used in my Atari 800XL days. The closest I ever got to it was through the advertisements, reviews, and tutorials that appeared in Antic and A.N.A.L.O.G. magazines. I purchased a copy a year or two ago but so far it’s been sitting on the book shelf. Rise and shine.


  • Mattel Intellivision Master Component
  • Chad Schell’s circa-2000 serial-based Intellicart! flash memory cartridge emulator
  • Atari 850 Interface Module
  • Atari 800 48k RAM
  • Rana 1000 double-density floppy disk drive
  • SDrive NUXX SD card Atari floppy drive emulator


  • The Action! System from Optimized System Software (OSS)
  • @InverseAtascii’s Window Gadget Library for Action!
  • Bewe DOS v1.30 for the Atari 800
  • Atari800 emulator for Linux
Retrochallenge, Retrochallenge 2016/01

Retrochallenge 2016/01: Final Post

(This is part six of the chronicle of my Retrochallenge 2016/01 submission, which is to port some classic Star Trek text games to the Mattel Aquarius. To jump to the beginning, go here.)


For the final week of this year’s Retrochallenge, I worked on creating STTR2. This is an embellished port of STTR1 taking some advantage of the modest capabilities of the Mattel/Radofin Aquarius.

To get to this point, I took the code for my “straight” port of STTR1 and completely re-factored the BASIC code to make it more structured. Next was to change any code that PRINTED to use relocatable, colored text and use the Aquarius’ graphic text characters to make grids, etc.

Sadly the project is incomplete for the purposes of challenge. There is no sound. It exceeds my target 16K RAM, and is slower than an ASR-33 teletype terminal. (The video above is running in an emulator with max speed enabled). But it was very fun to get this far.

Retrochallenge 2016/01 Epilogue

Well, I fell a little short for my challenge. I did not port Super Star Trek like I had originally planned and therefore ported STTR1 to the Aquarius instead of Super Star Trek. In retrospect I’m fine with it. I find STTR1 to be simple and enjoyable. The Trek games that followed added perhaps needless complexity.

What I was successful with was learning a ton about a game that I initially knew very little about. I have heard revering stories of the game from programmers who got an earlier start in computers than I did. I was also successful in learning more about the Aquarius and the great efforts of its enthusiasts.

Thanks, Retrochallenge!




Retrochallenge, Retrochallenge 2016/01

Retrochallenge 2016/01: Post 5

(This is part five of the chronicle of my Retrochallenge 2016/01 submission, which is to port some classic Star Trek text games to the Mattel Aquarius. To jump to the beginning, go here.)

Thank Heavens for the Internet Archive


Today I came across Mike Mayfield’s personal account of the history of STTR1. This information was rescued from a defunct website by the fabulous efforts of the Internet Archive:

That page was part of a more general survey of the early Star Trek text games. I noticed a Palm Pilot version. I’ll be trying that on the Palm III I use for weekend To Do lists.

Work Begins on STTR2

I’ve begun working on (or at least mulling over) an enhanced version of STTR1 for the Aquarius that will take advantage of the system’s modest graphics and sound capabilities.

The set of goals is not solidified but at a minimum:

  • Use a fixed display (not scrolling). Left half is Short Range Scan, right half is output of all other commands except the Galactic Record.
  • Change color palette to something more thematic
  • Add a title screen
  • Draw a grid for short and long-range scans


Never an endeavor so doomed.


Retrochallenge, Retrochallenge 2016/01

Retrochallenge 2016/01: Post 4

(This is part four of the chronicle of my Retrochallenge 2016/01 submission, which is to port some classic Star Trek text games to the Mattel Aquarius. To jump to the beginning, go here.)

STTR1’s Gone Gold

STTR1 cassette case

The straight port of STTR1 for the Aquarius is nearing completion. These were the tasks on my TODO list:

  1. Finalize the code
  2. Create a Git repository for the files that will be publicly shared
  3. Record STTR1 to a cassette tape
  4. (Finally) run STTR1 on a real Aquarius
  5. Create & print artwork for the cassette case

Finalize the Code

I’m trying to keep the target platform an Aquarius with a 16K RAM extension, even in emulation. One of the files I’ll be including in the distribution is a ROM (.bin file) image. This  will allow easier loading on emulators or perhaps one day the file can be included with a multi-cart. To accomplish this, I used the modern hack Bootloader BASIC v2.1 (or BLBasic) found on the Atariage forums. This is an enhanced version of Aquarius Extended BASIC that, among other things, will create a ready-to-run binary version of a BASIC program. The clever trick exploits the fact that Virtual Aquarius emulator redirects printer output to a text file on the host computer. BLBasic re-purposes the LDUMP command to instead export a binary version of a BASIC program to the host computer via the emulated Aquarius printer port.

However I was seeing some strange behavior emanating  from the .bin version of STTR1 while using MESS. It could be that MESS is not correctly emulating the Aquarius, or perhaps the STTR1 code along with whatever runtime is needed by BLBasic was hitting the upper bounds of the available memory.

So I’ve trimmed the memory footprint of the STTR1 code on the Aquarius by:

  1. Consolidating multiple lines of HP Time-Shared BASIC to a single line using the “:” command separator. HP must’ve allowed strictly one command per line number in its Time-Shared BASIC because the original code never strays from that.
  2. Trimming REM statements when HP added the program to their Contributed Program Library.

Consolidating commands introduced many new bugs because I inevitably removed a line number that was referenced somewhere else by a GOTO.  I became very familiar with the “UL” error.

ted branch to a line that is not in
memory, or deletion of a non-
existent line.

Create a Git Repository

Nothing too interesting . I’ve been using for no particular reason. I know all the cool kids are hanging out at github, but I’m too lazy to migrate. So far, I’ve uploaded:

  • the text of the BASIC source
  • a .CAQ file (cassette file format for Virtual Aquarius)
  • and the a .BIN file created by Bootloader BASIC.

The repository is here.

Record STTR1 to a Cassette Tape

Recording STTR1 WAV file to Cassette Tape using a GE 3-5015C Tape Recorder

In the Virtual Aquarius emulator, you can run the CSAVE command and it will export a .CAQ data file to your PC. Included in the tools sub-directory of the emulator is a program called CAQ2WAV.EXE. This Windows application will convert a .CAQ to a .WAV audio file.

I used Audacity to play the .WAV file to this gorgeous c.1986 General Electric 3-5015C tape recorder connected to the laptop’s audio output. Moved the tape over to the Aquarius’s Data Record and CLOAD’ed the muther in.

For all the stink eye that cassettes get, let me say that this all worked on the first try. Sure it takes 4m30s but that’s time to meditate – or run a very good mile.

Red DATA Light means life is good

(Finally) Play STTR1 on a Real Aquarius

STTR1 Instructions being printed to screen

The game plays well on the Aquarius. I even love the keyboard. The program includes an option to either print the instructions to screen or to the Aquarius’ thermal printer. I almost got weepy seeing that work on the first run.


Create & print artwork for the cassette case

I wanted a nice looking cassette case for STTR1. I looked at some examples of the third-party games sold in the eighties, for example “Chuckman“. And skimmed through episodes of Star Trek: The Only Series on Netflix to find some screen shots of space scenes to grab. After a long night of cutting, pasting, rotating, blurring, and undoing, I came up with something I like. Even has liner notes.

I’ll include this as a PDF or PNG in the repository.


Up Next

My original plan was to also port Super Star Trek. Alas that one may have to wait for a future Retrochallenge. Instead I want to add color, sound, and maybe even extremely crude graphics to STTR1, making it what? STTR2?


Retrochallenge, Retrochallenge 2016/01

Retrochallenge 2016/01: Post 3

(This is part three of the chronicle of my Retrochallenge 2016/01 submission, which is to port some classic Star Trek text games to the Mattel Aquarius. To jump to the beginning, go here.)


Mind Melding

In porting the 1972 version of STTR1 from HP Time-Shared BASIC to the Mattel Aquarius, I had to learn more about the code than I originally thought would be required. I imagined merely dealing with syntax differences which I could search and replace with ignorant bliss. However, the implementation of string variables differ so much between the two systems, I inevitably had to time-travel, get into the head of the high school student who authored STTR1, understand the program’s logic to a sufficient degree, and re-code some critical sections.

Is it spaghetti code? Of course it is. This is early BASIC and therefore a design requirement. Even so, some very clever algorithms exist throughout. (I’m especially impressed by the code that calculates course and torpedo trajectory.) However, the 1 or 2 character limit for variable names makes for a dizzying experience.

So before I move on and allow the weeds to germinate, I’d like to at least catalog the more interesting variables found in the original STTR1 listing along with my understanding of each one’s purpose.

Noteworthy Variables Found in Original STTR1

In case you’re inclined to follow along, here is the original BASIC listing for STTR1.


230  REM *****  PROGRAM STARTS HERE *****
240  Z$="                                                                      "
250  GOSUB 5460
260  DIM G[8,8],C[9,2],K[3,3],N[3],Z[8,8]
420  C[2,1]=C[3,1]=C[4,1]=C[4,2]=C[5,2]=C[6,2]=-1
430  C[1,1]=C[3,2]=C[5,1]=C[7,2]=C[9,1]=0
440  C[1,2]=C[2,2]=C[6,1]=C[7,1]=C[8,1]=C[8,2]=C[9,2]=1
1885  C2=INT(C1)
1890  X1=C[C2,1]+(C[C2+1,1]-C[C2,1])*(C1-C2)
1900  X2=C[C2,2]+(C[C2+1,2]-C[C2,2])*(C1-C2)
2700  H=(X/K3/FND(0))*(2*RND(1))
2710  K[I,3]=K[I,3]-H
2720  PRINT  USING 2730;H,K[I,1],K[I,2],K[I,3]
2730  IMAGE  4D," UNIT HIT ON KLINGON AT SECTOR ",D,",",D,"   (",3D," LEFT)"
3400  G[Q1,Q2]=K3*100+B3*10+S3
Variable Name Data Type Description
G 8×8 Matrix Galaxy; Elements contain 3-digit values to store number of Klingons, Starbases, and Stars in each of the 64 Quadrants
C 2×9 Matrix Lookup of Δrow, Δcol for a given course, where 1≤course<9
K 3×3 Matrix Klingon attributes; row, col, and hit-points remaining for up to 3 enemies found in current Quadrant


270  DIM C$[6],D$[72],E$[24],A$[3],Q$[72],R$[72],S$[48]
280  DIM Z$[72]
950  Q$=Z$
960  R$=Z$
970  S$=Z$[1,48]
3790  IF C$ <> "DOCKED" THEN 3820
3810  RETURN
Variable Name Data Type Description
C$ 6 char String Condition of the Enterprise – GREEN, RED, YELLOW, or DOCKED
D$ 72 char String First 6 labels for Damage Report – 72 char string treated as array of (6) 12-char strings
E$ 24 char String 2 more labels for Damage Report – 24 char string treated as array of (2) 12-char strings
A$ 3 char String Symbol definition for Stars (‘ * ‘), Klingons (‘+++’), or the Enterprise (‘<*>’)
Q$, R$, S$ total 192 char String Buffer used to display current Quadrant. 8×8 cells where each 3-char cell contains a copy of A$ or empty space
Z$ 72 char String Zeroed String – 72 spaces used to clear Q$, R$, and S$

Enterprise Attributes

4250  C$="DOCKED"
4260  E=3000
4270  P=10
4290  S=0
Variable Name Description
E Energy available to the Enterprise. Values 0-3000+
S Energy diverted to the Enterprise’s Shields
P Number of Photon Torpedoes remaining. Values 0-10
Q1,Q2 Quadrant; row, col of Enterprise’s location within the Galaxy. Values 1-8 each
S1,S2 Sector; row, col for Enterprise’s location within a Quadrant. Values 1-8 each

Galaxy Attributes

3690  PRINT  USING 3700;K[I,1],K[I,2]
3710  K3=K3-1
3720  K9=K9-1
3730  A$="   "
3740  Z1=K[I,1]
3750  Z2=K[I,2]
3760  GOSUB 5510
3770  G[Q1,Q2]=K3*100+B3*10+S3
3780  RETURN
Variable Name Description
K9 Total Number of Klingons remaining in the Galaxy. Set at start. Decremented as enemies are destroyed
K7 Total Number of Klingons at start of game. Used to calculate efficiency rating for successful games
B9 Total Number of Starbases remaining in the Galaxy. Set at start. Decremented if any are destroyed
S9 Total Number of Stars in the Galaxy. Set at start to 200

Quadrant Attributes

Variable Name Description
K3 Number of Klingons in current Quadrant (0-3)
B3 Number of Starbases in current Quadrant (0-3)
S3 Number of Stars in current Quadrant (1-8)

Time Attributes

4080  PRINT "YOUR EFFICIENCY RATING ="((K7/(T-T0))*1000)
4090  T1=TIM(0)+TIM(1)*60
Variable Name Description
T Current Stardate. Values like 2403
T0 Initial Stardate when game started
T1 Time at End of Game; Obtained from Real-time Clock
T7 Time at Start of Game; Obtained from Real-time Clock
T9 Time Limit; Number of Stardates you have to complete the game. Set to 30 at start

Set Course

1410  PRINT "COURSE (1-9):";
1420  INPUT C1
1430  IF C1=0 THEN 1270
1440  IF C1= 9 THEN 1410
1450  PRINT "WARP FACTOR (0-8):";
1460  INPUT W1
1470  IF W18 THEN 1410
1480  IF D[1] >= 0 OR W1 <= .2 THEN 1510
1500  GOTO 1410
Variable Name Description
C1 Course
W1 Warp Factor

Up Next

Hopefully a demonstration of STTR1 for the Aquarius


Retrochallenge, Retrochallenge 2016/01

Retrochallenge 2016/01: Post 2

(This is part two of the chronicle of my Retrochallenge 2016/01 submission, which is to port some classic Star Trek text games to the Mattel Aquarius. To jump to the beginning, go here.)

Work-in-Progress Port of STTR1 on the Aquarius

As with most of my Retrochallenge experiences, what I imagine I can accomplish in the first weekend requires the remainder of the month. So it has been with the no-frills port of the 1972 version of STTR1 to the Aquarius. My real goal is to extend a classic Star Trek text game to use Aquarius features such as color, sound, and hand controllers. But here we are halfway through January and I’m still just trying to get the original STTR1 game to run on the target platform.

As of the last several work sessions I have a foothold into the game and am able to play for a bit before encountering a mysterious syntax error at line number 1910. And torpedoes targeted towards Klingons instead say that I shouldn’t attack stars.

In this post I will enumerate the types of code changes I’ve had to make so far and provide some brief examples. At a high level there’s the trivial changes and, well, the non-trivial.

Trivial Changes

Printing Concatenated Strings

HP doesn’t require semicolons as concatenation operators.

HP Time-Shared BASIC


Aquarius BASIC


Array Indexes

HP uses square brackets. Aquarius uses parentheses.

HP Time-Shared BASIC

1630  D[I]=D[I]+1

Aquarius BASIC

1630  D(I)=D(I)+1

Chained Variable Assignments

HP allows chained assignments, the Aquarius does not.

HP Time-Shared BASIC

320  E0=E=3000
330  P0=P=10

Aquarius BASIC

320  E0=3000:E=E0
330  P0=10:P=P0

Shortening Command Lines to 72 Characters

Aquarius BASIC has a maximum line length of 72 characters. The original STTR1 source for the HP contains many, many lines that exceed that limit. These are simple but somewhat tedious changes.

Aquarius Guide to Home Computing pp. 1-10


Reformatting Output for a 40 Character Display

The teletype terminals that would be connected to an HP2000C  had generous line widths for displaying the program output. The 40 character display on a television set requires inserting line breaks into the original STTR1 text.

HP Time-Shared BASIC

3690  PRINT  USING 3700;K[I,1],K[I,2]

Aquarius BASIC

3690  PRINT "KLINGON AT SECTOR ";K(I,1);",";K(I,2);
3700  PRINT " DESTROYED ****"

Formatted Output

HP Time-Shared BASIC provides formatted printing akin to C’s printf() function. IMAGE statements define a mix of literal strings and placeholders with format codes. The PRINT USING statement points to the line containing the desired IMAGE statement and a list of variables to be substituted for the placeholders.



HP Time-Shared BASIC

2720  PRINT  USING 2730;H,K[I,1],K[I,2],K[I,3]
2730  IMAGE  4D," UNIT HIT ON KLINGON AT SECTOR ",D,",",D,"   (",3D," LEFT)"

Aquarius BASIC

2730  PRINT K(I,1);",";K(I,2);"  (";K(I,3);" LEFT)":PRINT

Zeroing an Array

The HP has strong matrix support and has the ability to operate on all elements in a matrix with one command.


HP Time-Shared BASIC

260  DIM G[8,8],C[9,2],K[3,3],N[3],Z[8,8]
910  MAT K=ZER

Aquarius BASIC

260  DIM G(8,8),C(9,2),K(3,3),N(3),Z(8,8)
910  FOR I=0 TO 3:FOR J=0 TO 3:K(I,J)=0:NEXT J:NEXT I

Jumped GOTO

HP Time-Shared BASIC provides a variation of the ON x GOTO line1 line2… seen in other BASICs on micros but not found on the Aquarius. And…Was GOTO originally intended to be GO TO (two words)!?


HP Time-Shared BASIC

1280  INPUT A
1290  GOTO A+1 OF 1410,1260,2330,2530,2800,3460,3560,4630

Aquarius BASIC

1280  INPUT A
1290  IF A=0 THEN 1410
1292  IF A=1 THEN 1260
1293  IF A=2 THEN 2330
1294  IF A=3 THEN 2530
1295  IF A=4 THEN 2800
1296  IF A=5 THEN 3460
1297  IF A=6 THEN 3560
1298  IF A=7 THEN 4630

Non-Trivial Changes

Fundamental Differences in String Variables


HP Time-Shared BASIC

HP BASIC strings are implemented as a one-dimensional array of bytes. The command DIM S$ [n] reserves n bytes for string S$.

Throughout the original STTR1 code, much of the game’s “graphical” representation is accomplished by injecting the symbols for the Enterprise (‘<*>’), stars (‘ * ‘), and Klingons (‘+++’) into large strings, exploiting HP’s treatment of Strings as special cases of matrices.

However, HP BASIC strings are limited to 72 characters. For this reason, the young Mr. Mayfield had to split the 192 (8 x 8 x 3) characters needed to represent the Short Range Scan view across 3 string variables Q$, R$, and S$. And then add code to cascade across the variables when trying to inspect  a particular spot in a quadrant.

Strings   ---------------------------------
Q$[01-24]:      *              <*>         
R$[01-24]:                      *       *  
R$[25-48]:   *               *       *      
S$[01-25]:           *                      

270  DIM C$[6],D$[72],E$[24],A$[3],Q$[72],R$[72],S$[48]
980  A$="<*>"
5520  S8=Z1*24+Z2*3-26 (Note: Z1 and Z2 are values between 1 and 8)
5530  IF S8>72 THEN 5560
5540  Q$[S8,S8+2]=A$
5550  GOTO 5600
5560  IF S8>144 THEN 5590
5570  R$[S8-72,S8-70]=A$
5580  GOTO 5600
5590  S$[S8-144,S8-142]=A$
5600  RETURN

Aquarius BASIC

Strings do not need to be declared before use. The command DIM Q$ (64) creates an array of 64 (maybe 65) strings. For the Aquarius version of STTR1, strings will need to be used in a totally different way. Since the game’s “graphics” are stored as 3-character  strings, I’ve opted to create an array of strings. In a 8×8 quadrant, Q$ will provide (64) 3-character strings.

270  DIM Q$(64)
980  A$="<*>"
5520  S8=(Z1-1)*8+Z2 (Note: Z1 and Z2 are values between 1 and 8)
5540  Q$(S8)=A$
5600  RETURN


No-Frills STTR1 Consumes Most of the 16K on an Aquarius

The target platform is an Aquarius with 16K RAM. If I drop the STTR1 code into an Aquarius emulator, FRE(0) shows that 1K of RAM is remaining. If I want to add new features, then the existing program will need to be put on a diet. Otherwise OM (Out of Memory) errors will begin to appear.

Solutions include: moving the embedded instructions to a separate, stand-alone program, combining multiple BASIC commands onto a single line, and creating an array of resource strings to use in place of repeated literals, like “KLINGON”, “TORPEDO”, and “ENTERPRISE”.

Up Next

Documenting the important variables used in STTR1.