Bally/Astro Basic

As you may have noticed above there are 2 versions of the Basic Cartridge, and possibly 3 Labels. So what's the difference & why should I care?

The original Bally Basic is a robust & serviceable programming language. The only complaints could be the extra purchase of an audio cassette interface. The package came with a ring bound manual & Tutorial. The "Basic Expansion Kit" included a tape library pak with some programming demos, and the audio cassette interface. The interface saved data at 300 baud.

The Second release of Bally Basic, later called Astrocade Basic, Had the tape interface built in! The speed of the interface was also increased to 2000 baud. This made the Old Bally Demo tapes virtually useless, but allowed more data to be stored on a tape & shorter load times!

For the sake of ease of identification the news letters & Tape manufactures referred to any Basic Cart with the built-in Audio cassette interface as AstroBasic or AB for short.

Other new features to Astro Basic were the introduction of Music Processor Commands, allowing direct control of the sound chip without using the memory consuming port access array. The "$" command using features of the built-in calculator program was removed.

Why only 1800 Bytes?

Q:

Why with 4K of Ram does the Bally/Astrocade only get about 1800 Bytes of program space, when a PET or TRS-80 had a lot more?

A:

The Graphics. Both the PET and TRS-80 use character based graphics and were only B+W. The Bally/Astrocade uses Bitmaped graphics in 4 colours.

Lets look at the PET first. 40 columns by 25? rows equals 1000 Bytes used for screen display. This leaves 3096 minus operating expense (say 16 Bytes or more). With the TRS-80, 64x25?=1600 Bytes leaving 2496 minus operating expense.(BTW within 2 months My TRS-80 got a RAM expansion!)

Now the Bally. 160x102x4, 160 pixels at 4 colours a pixel(2 Bits) = 40 Bytes, (But Astro Basic only gets 2 colours! Ya, Ya, I'll get back to that.) 40x102=4080 Bytes leaving 16 BYTES! That IS the operating Expense!

THERE IS NO FREE MEMORY!!!

NOW The Wizardry of Jay Fenton......
..........................or How to get 1800 Bytes out of 0!

This must have been the question when Mr. Fenton took to programming the original Bally Basic Cart. The answer IS use every other bit for code. This would leave a terrible mess on the screen, and it does. So you hide it!

Set & keep the colour palette so Code+Graf=Grafcolour, NoCode+Graf=Grafcolour, Code+NoGraf=Background and NoCode+NoGraf=Background. Or simply Colour1&2 are always the same, as are Colour 3&4. If you have a Bally/Astrocade you can set &(9)=80 and half the screen will show the program underneath.

As this is not the place for a tutorial of Bally/Astro Basic, I shall simply include the entire list of Astro Basic commands. For those who have the cart and no manual to try out, and those familiar with other Basics to marvel at! Or you can see a PDF version of the manual on BallyAlley!

Astro Basic Commands:

Basic Statements & Commands

BOX X,Y,A,B,1                   Draw a box at position X,Y of Width A and
                                Height B, Mode 1
                                Modes available: 1 Foreground Colour
                                                 2 Background Colour
                                                 3 Reverse box (xor)
                                                 4 Invisible (Useful?)

LINE X,Y,1                      Line to X,Y, mode 1 (See above) from last
                                Pixel location. Use BOX, XY or mode 4
                                to set start location.

CLEAR                           Clears screen. Not memory.

FOR/TO/STEP/NEXT                Same as any For/Next loop function

IF                              NO THEN E.G.: IF A=5GOTO20 is not only valid

                                but actually preferred to save ram!!!

INPUT A                         Wait for Keypad Input
INPUT "HOW MANY?"A              Prints message & waits for input

LIST                            AS all Basics
LIST ,5                         List the FIRST 5 basic lines
LIST 100                        List starting at line 100
LIST 100,5                      Start at line 100 list next 5 lines

PRINT "A"                       Print Character A
PRINT A                         Print Value of A
PRINT #A,B                      Print A spaces then B value

GOTO A                          Goto line number A 
GOSUB 100                       Gosub line 100
RETURN                          Return to GOSUB

RND(A)                          Generate number between 1 and A

RUN                             Execute program


General Functions

ABS(A)                          Absolute Value of A

CALL(A)                         Goto assembly routine at A

RM                              Remainder of last division

SM=A                            Scroll Mode A
                                Modes:  0 Normal
                                        1 No Scroll
                                        2 Clear screen, Cursor at bottom
                                        3 Clear screen, Cursor at top
                                        4 Auto Pause. press key to continue

STOP                            Stop program here

SZ                              SiZe of available programming space

XY                              Location of last Box or LINE command

PX(X,Y)                         Is PiXel on or off?


Input Output Functions

JX(1)                           Joystick 1 horizontal position -0+
                                                             +
JY(1)                           Joystick 1 Vertical Position 0
                                                             -
TR(1)                           Trigger for Joy 1

KN(1)                           Knob (Paddle) position for Joy 1

A=KP                            Wait for key press, store ASCII in A

TV=A                            Display ASCII character A to TV

MU=A                            Play MUsical Note value A

MU="A"                          Play same note as character A
                                (All characters in Bally Basic Produce a
                                 Tone when displayed unless NT=0)

FC                              Foreground Colour

BC                              Background Colour

NT                              Note Time, Duration of note play

CX                              Cursor X position

CY                              Cursor Y position


Tape Commands

:PRINT                          Save Program/Variables & Screen to tape

:PRINT @(0),100                 Save contents of @ array 0-99

:INPUT                          Load program from tape

:INPUT @(0),100                 Load data into @ array locations 0,99

:LIST                           Check stored program against memory.
                                Used to confirm saves.

:RUN                            Load & execute ML programs


Punctuation and Operators

+,-,Multiply and Divide symbols Standard math functions

;                               Separate multiple statements on same line

,                               Continue printing on same line.
                                E.g.: 10 PRINT "A",
                                      20 PRINT "B"
                                Gives  AB

.                               REM statement

#                               NOT equal to

B=%(A)                          PEEK A,B

%(A)=B                          POKE A,B

@(N)                            First array in Bally Basic

*(N)                            Second Array Astro Basic Only

&(N)                            Read/write port N

Down Arrow                      Stop ALL sounds


Music Processor Commands                Astro Basic ONLY

MO                              Master Oscillator Freq.

NM                              Noise Mode

NV                              Noise Volume NM must be 1

VR                              Vibrato Range NM must be 0

VF                              Vibrato Frequency

TA TB TC                        Tone A,B or C

VA VB VC                        Volume A,B or C


Error Messages

WHAT?                           Syntax error

SORRY                           Out of Memory

HOW?                            Catch all Error Code
                                E.G.: GOTO 50   No line 50     HOW?
                                    GOSUB A   A=10 NO line 10  HOW?
                                    NEXT Y      NO FOR Y       HOW?

Bally/Astro Basic Overlay

Most keys on the keypad have 5 functions. Except for the 4 bottom keys which are your shift keys.

Key pad overlay

The linked image is setup to be printed and used as a replacement overlay.