Our family friends the Hansels were the first to get a videogame system, the Atari VCS. I remember playing Combat, Breakout, and later Space Invaders. My dad was jealous, but he ended up getting us the Bally Astrocade. This turned out to be a great system, and its BASIC was far better than the Atari’s (the Atari BASIC Programming cartridge limited programs to 64 characters!).

The Wikipedia article on the Astrocade didn’t have many details about its BASIC, so I added a section on the language. To that point, I’d programmed Level I BASIC, Level II BASIC, Integer BASIC at the library, and Sinclair BASIC at a friend’s. Even though all those other systems used keyboards, and Astro BASIC required an overlay on top of the Astrocade’s calculator keypad, it was the most functional system for writing games, because it had built in support for joysticks and sound.

How functional were the graphics? The very first version of Artillery Duel, an eventual cartridge, was written in Astro BASIC. Definitely my favorite game in the language. [Here’s a video playthrough.]

I didn’t realize it at the time, but Astro BASIC, like Level I BASIC, was adapted from Li Chen Wang’s Palo Alto Tiny BASIC.

Programs were entered via the calculator keypad, with a plastic overlay displaying letters, symbols, and BASIC keywords. These were selected through a set of 4 colored shift keys. For example; typing “WORD”(gold) shift then the “+” key would result in GOTO.

A simple line editor was supported. After typing the line number corresponding to an existing program, each press of the PAUSE key would load the next character from memory.

Language features

Astro BASIC supported the following keywords–

  • Statements: PRINTINPUT
  • Graphics: BOXCLEARLINE
  • Tape Commands: :PRINT:INPUT:LIST:RUN
  • Functions: ABS()CALL()JX() (specified joystick’s horizontal position), JY() (joystick vertical position), KN() (knob status), PX(X,Y) (pixel on or off), RND()TR() (trigger status)
  • Built-in variables
    • (read only): KP (key press), RM (remainder of last division), SZ (memory size), XY (last LINE position)
    • (write only): SM= (scroll mode), TV= (display ASCII character)
    • (read/write): BC (background color), CX CY (cursor position), FC (foreground color), NT (note time),
  • Math: + – × ÷
  • Relational operators: < > = # [not equal] [the language did not support: <= => <>]
  • Logical operators: × [AND] + [OR]

A period . at the start of the line was equivalent to REM in other BASIC implementations. Certain commands were handled by the keypad instead of by keywords: the RESET button was equivalent to NEW in other interpreters.

The language supported 26 integer variables A to Z, and two pre-defined arrays@() – which was stored starting after the program, ascending – and *() – which was stored from the top of memory, descending. The language lacked a DIM statement for dimensioning the arrays, the size of which was determined by available memory (SZ) not used by the program listing (2 bytes per item). Ports were accessed via the array &(), and memory was accessed via the array %(), rather than using PEEK and POKE. While the language lacked strings, KP would provide the ASCII value of a key press, which could be output to TV, meaning that characters could be read in from the keyboard, stored in an array, and then output.

The character display was 11 lines of 26 characters across. The resolution for the graphic commands is 88×160, with X ranging from -80 to 79 and Y ranging from -44 to 43.

Music could be produced in four ways:

  1. The PRINT command, as a side effect, produced a unique tone for each character or keyword displayed.
  2. The MU variable converted numbers into notes.
  3. Ports 16 through 23 accessed a music synthesizer.
  4. The sound-synthesizer variables MO (master oscillator), NM (Noise Mode), NV (Noise Volume), TA (Tone A), TB (Tone B), TC (Tone C), VA (Voice A volume), VB (Voice B volume), VC (Voice C volume), VF (Vibrato Frequency), VR (VibRato). (Added to Astro BASIC but not in Bally BASIC.)

Sample code

The following sample program from the manual demonstrates the joystick input and graphics functions. “Try your skill… The first player’s knob moves the phaser left or right and the trigger shoots… Player two controls the target while player one shoots.”

 10 X=RND(60)-31
 20 Y=RND(20)
 40 X=X+JX(2)×3
 50 Y=Y+JY(2)×3
 60 BOX X,Y,4,4,43
 70 K=KN(1)÷2
 80 BOX K,-40,3,8,1
 90 IF TR(1)=0GOTO 30
100 N=1
110 IF K>X-3IF K<X+3N=15
120 FOR A=1TO N
130 BOX K,0,1,80,3
140 MU="4"
150 BC=A×8
160 NEXT A
170 FC=7
180 BC=8
190 GOTO 10