Bally Alley

ZGRASS Language

by Tom Meeks

(April 1981)

This article first appeared in BASIC Express, The, 3, no. 1 (April 1981): 5-7.

Editor's Note: To show our readers the ease with which ZGRASS (the system language utilized by the AstroVision Add-Under for the Bally Arcade) can be learned, we asked Tom Meeks, who is a proud owner of the UV-1 (hi-res, $5,000 version of the Add-Under) to write an article for us explaining the use of the language. Tom, needless to say, is in love with the unit and plans to purvey ZGRASS-32 units to educational institutions.

Bally Add-Under Unit

Actually, it's much harder to write about Zgrass objectively than to learn it in the first place. There is something about the Zgrass language that brings out the "G-O-l-l-y!" and "Gee-Whiz!" in me. So, while I'll do my best to be objective and cool in appraising the capabilities of Tom DeFanti's brainchild... the truth is that it's just too much fun to pick at with any fervor.

There are now two micro's implementing the Zgrass language with the Bally custom chipset. The most familiar of the two is the AstroVision "Add-under" for the Bally Professional Arcade. The other is a commercial unit for video producers and graphics artists requiring a higher resolution picture. The Datamax UV-1 has a screen resolution of 320x202, or double that of the AstroVision machine. The operating systems are virtually identical. Four of the Datamax machines are now in the field with full production just getting underway. I have had mine for just a little over 1 month and have been more than pleased with what Zgrass allows me to do. Since I do not consider myself a professional programmer (or even a good hacker), I have been even more impressed with the ease with which complex art and animation can be done.

To this point, most of my experimentation and application with Zgrass has been purely graphics oriented. This, coupled with the fact that the Zgrass library of commands is still incomplete in several areas, leads me to limit this evaluation to graphics and game development capabilities we can expect from the AstroVision Zgrass-32 when it arrives. I will say this much however. Those readers engaged in educational activities are going to be very impressed with the versatility of Zgrass for Computer Aided Instruction.

Graphic development is the Zgrass' playground. All of the extravagant claims you may have heard are true! First, Zgrass is easier to learn than BASIC. Second, when they claim to have 'powerful graphics commands' they mean POWERFUL GRAPHICS COMMANDS! Not only can you build a character and make it walk across the screen, but, you can recall the character to the screen in many different ways. Your character can be squashed, stretched, shrunk, expanded, turned upside down and backwards, duplicated any number of times and even used as a pattern when you design your own quilt... all with simple commands resembling the familiar BOX command used in the Bally BASIC cartridge.

Since we are all familiar with the Gunfight game that is resident in the Bally Arcade, perhaps the best way to appreciate the scope of the Zgrass graphics capabilities would be to relate how it could be used to produce some of the Gunfight graphics. Before we do this, however, some time should be spent on the format of Zgrass MACROS, or programs. Line numbers are not usually used in a Zgrass program. Instead, the SKIP command is used to move forward or backward through a program. There is no RUN command. All that is necessary is to type in the program name. It may seem awkward as you read this, but quickly becomes familiar in use. A typical program to make boxes of decreasing sizes in four colors would look like this:

   BOX 0,0,A,A,B
   IF (B=B-1)<0,B=3
   IF (A=A-5)>5,SKIP -2}


Once the MACRO called TOM is entered, it can be recalled at any time by typing in the name as we did above, or within any other macro like this:


In this case, the MACRO called EXAMPLE prints out a statement, calls the MACRO named TOM (which draws the boxes on the screen) and then prints out a final statement. This capability of a MACRO calling other MACROS helps to simplify and organize otherwise complex programs into small, manageable units.

Since Zgrass gives us the natural ability to break down long problems into small units, this is exactly the method we will use to duplicate the Gunfight program. In this issue we will deal with generating the bullets at the top of the screen, the cacti, the trees and the covered wagon. There are three basic steps common to generating, saving and displaying each of these figures on the screen. Step 1 involves drawing the figure using keyboard commands or a joystick drawing program such as Scribble built into the Bally. Step 2 involves saving the drawn figure off the screen and storing it into memory. This is done with the SNAP (short for "snapshot") command. The syntax of the SNAP command looks like this:


Step 3 is the process of recalling the stored figure onto the screen... anywhere and any number of times that we need it. Notice that all of the bullets, cacti and trees look exactly the same. The syntax of the DISPLAY command is this:


We use the NAME in the DISPLAY command that we used in our original SNAP. We will now draw a bullet, SNAP it off the screen and then write a short MACRO that will DISPLAY the bullet 12 times at the top of the screen.

   BOX 0,0,4,6,1
   BOX 0,4,1,1,1
   SNAP BULLET,0,1,4,7
   IF (A=A+5) 50,SKIP -2}


Now, each time one of the players is shot and we want to reset the screen, we merely call the MACRO called PUTBULLET. As yet, we haven't explained the DISPLAYMODE used in the DISPLAY command. The DISPLAYMODE allows us to "plop" the SNAP-NAME on the screen or put it on with one of the built-in XOR, OR, AND or special PRIORITY WRITE features. These will be discussed in detail in future issues. The point is that we can generate different ways using the DISPLAY command.

The cacti and trees are generated and saved in exactly the same way. Suppose we drew a cactus centered at X=-20,Y=3 and a tree centered at X=20,Y=0. The cactus might be 18 pixels high and 7 pixels wide. The tree might be 19 pixels high and 8 pixels wide. The SNAP'S used to save them are:

   SNAP CACTUS,-20,0,7,18
   SNAP TREE,20,0,8,19

Notice that the SNAP's are the same width and height as the figure being saved. This only works for figures that remain stationary on the screen once displayed. Obviously, this applies to the bullets, the cacti and the trees. It does not apply to the covered wagon. Since it moves up and down, the wagon must be SNAPPED off with a 'buffer' zone that allows us to erase all of the previously displayed wagon with the new 'offset' display. Suppose we want to move the wagon 2 pixels at a time as we go up and down. We should have a buffer of at least 3 pixels at the top and bottom of the wagon figure. Suppose, further, that the wagon we draw is 21 pixels wide and 28 pixels high. Our SNAP command would look like this:

   SNAP WAGON,0,0,21,34

Our MACRO for putting the wagon on the screen and moving it up and down could be written:

   IF (Z=Z+2)<20,SKIP -1
   IF (Z=Z-2)>-30,SKIP -1
   SKIP -5}

This is all that is necessary to put the wagon on the screen and move it up and down... exactly like the movement in the Gunfight game. Imagine trying to do that in BASIC! Zgrass makes us LOOK like machine language programmers!

In the next installment, we will create the gunfighters and WALK them around on the screen.

Return to ZGrass/UV-1 Articles