Yet another CoCo & MC-10 site

Dedicated to the Tandy/Radio Shack MC-10 Micro Color Computer and the Color Computers 1, 2 & 3

(The following Article was featured for the June '99 edition of this page)

A small Micro Color Basic Arcade Shoot-em up

Ok, so the following program does not exploit special features of the MC-10 and is not exactly an original idea as it is based on a Basic program that appeared in a TRS-80 Graphics book Radio Shack once sold. This was one of the first TRS-80 programs I converted and the MC-10 got first crack at the conversion, being this the first computer I ever owned. The concepts applied here consist of program structure disciplines in order to get the most of speed out of the execution times and one or two examples at how to build STRING$ using FOR-NEXT loops (the MC-10 does not have a STRING$ function).

The general layout of the program is: subroutines first, main loop in the middle and all variable definitions and general setup at the end. Using variables instead of numeric values speeds up the interpretation time of a Basic program and setting up the most often called subroutines right on the beginning of a program also contributes to enhanced response time from the computer. The listing (formatted as 32 characters per line): 

MC-10 Laser Cannon

0 GOTO 100
1 S$=RIGHT$(S$,G-1)+LEFT$(S$,1)
2 T$=RIGHT$(T$,L-2)+LEFT$(T$,2)
3 PRINT@224,LEFT$(S$,32);:PRINT@
5 IFP=1THENB=B+20:S$=LEFT$(S$,15
6 IFP=0THENB=B+30:T$=LEFT$(T$,14
22 I$=INKEY$
30 A=A-1:PRINT@448,"SHOTS:"A;
40 IFPOINT(30,14)THENH=1:P=1
55 B=B-10:GOSUB1:GOTO20
100 DIM ST$(15):CLEAR 2000:CLS 0
102 A=50
105 V$=CHR$(128)+CHR$(128)+CHR$(
110 FOR I=1 TO 10
115 Y$=Y$+CHR$(128)
120 NEXT I
125 ST$(1)=CHR$(128)
130 FOR I=2 TO 10
135 ST$(I)=STR(I-1)+CHR$(128)
140 NEXT I
145 FOR I=1 TO 20
150 S$=S$+CHR$(200)+ST$(RND(10))
155 NEXT I
160 Z1$=CHR$(161)+CHR$(171)
165 Z2$=CHR$(173)+CHR$(167)+CHR$
170 PRINT@462,Z1$;
175 PRINT@494,Z2$;
180 W$=CHR$(237)+CHR$(238)
185 FOR I=1 TO 10
190 T$=T$+W$+ST$(RND(6))+ST$(6)
195 NEXT I
200 L=LEN(T$):G=LEN(S$)
205 U$=CHR$(250)
210 GOAT 5
220 GOAT 220

The screen consists of two rows of "moving" targets and a laser cannon activated by pressing the space bar. The top row of targets add 30 points and the bigger lower row of targets adds 20 points to the overall score - missing targets subtracts 10 points, be careful. The movement of the targets is accomplished by printing certain portion of each of the target strings and when a target is hit its space is replaced by blanks. Due to the hurry at the time when the program was written I didn't care of taking a close look at just how many targets appear per row and how the lower row should be treated in order to have whole targets right from the start; as it is, sometimes you can end up with a halved target - fair game though. Also, if the laser beam hits two targets (same column), the lower target takes the hit and the topmost is spared.

Line 102 has the number of shots available to the player. Variable B has the score and the reward and punishment level is set in lines 5, 6 and 55; if you feel like making the game tougher or easier  you should adjust the plus/minus values in those lines affecting B. The laser beam in the original TRS-80 Model I/O game was made using the built in space compression and cursor control codes available in those machines; the MC-10 doesn't have those fancy features so a FOR NEXT with SET/RESET commands takes care of printing a whole column of laser characters from bottom to top and then erases the column in the same direction - the action is fast enough to rate in the arcade variety of effects; actually, I was surprised by the speed of the game after converting it from the TRS-80 Basic where the same version of the game runs a bit slower.

So here you have it - a blast from the past. Let me know what you think of these articles. I have many MC-10 Color Basic programs to share, perhaps an idea you might have has already been implemented. See you next month!



Actually, this was first edited using the HTML editor found in Netscape Gold (remember this one?), back then the page resided in the Delphi personal web space. When that died, the page was moved to Tripod and maintained with (oh sacrilege!) MS Frontpage. I got wise, moved out of Tripod and now use NetObjects Fusion...

TRS-80 Tandy Color Computer
[ Join Now | Ring Hub | Random | << Prev | Next >> ]