Letter Defender: My big program from 30 years ago

[image] [image]

I'm pretty excited about this - for years now I've been wanting to extract a program I wrote back around 1982 from an old computer cassette tape it was stored on. My son is now getting old enough to take an interest in programming, and it spurred me to take another stab at loading up my first "big" program from when I was about his age.

The game is called Letter Defender, and I wrote it in 5th grade (I think) for the TRS-80 Color Computer. I was taking classes at the time where I learned how to program, and this was one of my big projects. I have clear memories of it getting a lot of attention for it back. I was getting worried that time would take its toll on the tapes and make it impossible to get the data back.

I had to get a cassette player (they still sell them, believe it or not), then play the cassette with the audio going into my PC where I recorded the sound in .wav format. Then using the MESS emulator and an original TRS-80 ROM file, I was able to load the sound file into memory as a program and run it. (It took a few tries to get the sound settings right so the emulator didn't barf, but once I found the right combo, it worked like a charm.)

This is where I had gotten stuck before when I tried doing this about a decade ago when I lived in Spain, as I couldn't figure out how to get the program back out of the emulator in any sort of readable way. 10 years later, I'm actually much more technically savvy, so this time I was able to add a "virtual floppy" disk, read up on the instructions for using it (as back when I was kid, the Color Computer didn't have no stinkin' floppy drives, so I had no idea how to use it), and then after saving the file (in ASCII format, very important this) to the virtual floppy .dsk file, I was able to pull up a terminal do a simple Unix "strings" command to extract the text and see my program in its entirety again after almost 30 years.

Woohoo!

Very exciting (for me at least)! I just got it done, but I can't wait to show my son tomorrow and have him be amazed... at how ugly, underpowered computers were back when I was his age. :-D I've got a few more programs saved that I can get access to, which I'll eventually pull off, but this was the one that I couldn't wait to get at.

-Russ

Here's the screenshots of the game in action:

[image] [image] [image] [image] [image]

Here's the actual code: letterdefender.bas :


 '***********************
2 '****LETTER DEFENDER****
3 '*BY RUSSELL A. BEATTIE*
4 '***********************
5 NN=10
6 CLS 
7 A=RND(26)+64:B=RND(26)+64
8 C=RND(26)+64:D=RND(26)+64
9 E=RND(26)+64
10 IF A=B OR A=C OR A=D OR A=E THEN GOTO 7
11 IF B=C OR B=D OR B=E THEN 7
12 IF C=D OR C=E THEN 7
13 IF D=E THEN 7
14 A$=CHR$(A):B$=CHR$(B)
15 C$=CHR$(C):D$=CHR$(D)
16 E$=CHR$(E)
17 PRINT "DIRECTIONS?(Y/N)"
18 A$=INKEY$:IF A$="" THEN 18
19 IF A$="Y" THEN GOSUB 127 ELSE 20
20 GOSUB 138:GOSUB 119
21 FOR X=1 TO 63
22 SET(X,25,2)
23 NEXT X
24 RESET(5,25):RESET(17,25):RESET(29,25):RESET(41,25):RESET(53,25)
25 PRINT @ 448," "
26 PRINT@ 450,A$:PRINT@456,B$
27 PRINT@ 462,C$:PRINT@468,D$:PRINT@474,E$
28 S=1:Y=1
29 W=RND(5)
30 S=RND(3)
31 IF W=1 THEN Q=5
32 IF W=2 THEN Q=17
33 IF W=3 THEN Q=29
34 IF W=4 THEN Q=41
35 IF W=5 THEN Q=53
36 IF CC=44 THEN GOTO 51
37 B=RND(5):IF B=1 THEN I=5
38 IF B=2 THEN I=17:IF B=3 THEN I=29
39 IF B=4 THEN I=41:IF B=5 THEN I=53
40 O=RND(3)
41 IF VV=22 THEN 51
42 L=RND(5)
43 Y=RND(3)
44 IF L=1 THEN Z=5
45 IF L=2 THEN Z=17
46 IF L=3 THEN Z=29
47 IF L=4 THEN Z=41
48 IF L=5 THEN Z=53
49 C=0
50 V=0
51 P$=INKEY$
52 IF M>6 THEN GOSUB 111
53 IF N=25 THEN GOSUB 116
54 IF I=0 THEN GOTO 37
55 IF P$=A$ THEN SOUND 245,1:GOSUB 73
56 IF P$=B$ THEN SOUND 245,1:GOSUB 81
57 IF P$=C$ THEN SOUND 245,1:GOSUB 89
58 IF P$=D$ THEN SOUND 245,1:GOSUB 96
59 IF P$=E$ THEN SOUND 245,1:GOSUB 104
60 RESET(Q,S):RESET(Q,S-1)
61 RESET(I,O):RESET(I,O-1)
62 RESET(Z,Y):RESET(Z,Y-1)
63 S=S+SS:Y=Y+SS:O=O+SS
64 IF SS=1 THEN FOR TD=1 TO NN:NEXT TD
65 IF S=>25 THEN S=1:CC=44:M=M+1
66 IF O=>25 THEN O=1:VV=22:M=M+1
67 IF Y=>25 THEN Y=1:M=M+1:GOTO29
68 SET(Q,S,8):SET(Q,S-1,8)
69 SET(I,O,7):SET(I,O-1,7)
70 SET(Z,Y,5):SET(Z,Y-1,5)
71 FOR X=1 TO 5:NEXTX
72 GOTO 51
73 FOR X=26 TO 10 STEP-1
74 SET(5,X,6)
75 IF POINT(5,X-1)=8 THEN RESET(Q,S):RESET(Q,S-1):RESET(5,X):S=1:CC=44:N=N+1:GOTO 29
76 IF POINT(5,X-1)=7 THEN RESET(I,O):RESET(I,O-1):RESET(5,X):VV=22:N=N+1:O=1:GOTO 37
77 IF POINT(5,X-1)=5 THEN RESET(Z,Y):RESET(Z,Y-1):RESET(5,X):Y=1:N=N+1:GOTO 41
78 RESET(5,X)
79 NEXT X
80 RETURN
81 FOR X=26 TO 10 STEP-1
82 SET(17,X,6)
83 IF POINT(17,X-1)=8 THEN RESET(Q,S):RESET(Q,S-1):RESET(17,X):S=1:CC=44:N=N+1:GOTO 29
84 IF POINT(17,X-1)=7 THEN RESET(I,O):RESET(I,O-1):RESET(17,X):N=N+1:VV=22:O=1:GOTO 37
85 IF POINT(17,X-1)=5 THEN RESET(Z,Y):RESET(Z,Y-1):RESET(17,X):N=N+1:Y=1:GOTO41
86 RESET(17,X)
87 NEXTX
88 RETURN
89 FOR X=26 TO 10 STEP-1
90 SET(29,X,6)
91 IF POINT(29,X-1)=8 THEN RESET(Q,S):RESET(Q,S-1):RESET(29,X):S=1:N=N+1:CC=44:GOTO 29
92 IF POINT(29,X-1)=5 THEN RESET(Z,Y):RESET(Z,Y-1):RESET(29,X):Y=1:N=N+1:GOTO 41
93 RESET(29,X)
94 NEXTX
95 RETURN
96 FOR X=26 TO 10 STEP-1
97 SET(41,X,6)
98 IF POINT(41,X-1)=8 THEN RESET(Q,S):RESET(Q,S-1):RESET(41,X):S=1:CC=44:N=N+1:GOTO 29
99 IF POINT(41,X-1)=7 THEN RESET(I,O):RESET(I,O-1):RESET(41,X):N=N+1:VV=22:O=1:GOTO 37
100 IF POINT(41,X-1)=5 THEN RESET(Z,Y):RESET(Z,Y-1):RESET(41,X):Y=1:N=N+1:GOTO 41
101 RESET(41,X)
102 NEXT X
103 RETURN
104 FOR X=26 TO 10STEP-1
105 SET(53,X,6)
106 IF POINT(53,X-1)=8 THEN RESET(Q,S):RESET(Q,S-1):RESET(53,X):S=1:CC=44:N=N+1:GOTO 29
107 IF POINT(53,X-1)=5 THEN RESET(Z,Y):RESET(Z,Y-1):RESET(53,X):Y=1:N=N+1:GOTO 41
108 RESET(53,X)
109 NEXT X
110 RETURN
111 CLS
112 PRINT "YOU STOPPED ";N;" TYPE'S BUT THEY STILL DESTROYED YOUR LETTERS"
113 PRINT "TRY AGAIN? Y=YES N=NO"
114 C$=INKEY$:IF C$="" THEN 114
115 IF C$="Y" THEN RUN ELSE END :CLS
116 CLS
117 PRINT "YOU STOPPED ALL THE TYPE'S YOU  ARE A GREAT 'LETTER DEFENDER'!!"
118 GOTO 113
119 CLS
120 PRINT "THESE ARE THE LETTERS YOU HAVE  TO DEFEND."
121 PRINT "         ";
122 PRINT A$" ";B$;" ";C$;" ";D$;" ";E$
123 PRINT "PRESS ANY KEY TO PLAY."
124 IF INKEY$="" THEN 124
125 CLS0
126 RETURN
127 CLS
128 PRINT "THE OBJECT OF THIS GAME IS TO   GET YOU FAMILAR WITH THE        KEYBOARD."
129 PRINT "YOU WILL SEE THREE OBJECTS      COMING DOWN TOWARD THE BOTTOM   OF THE SCREEN.YOU WILL HAVE TO  PROTECT THE LETTERS AT THE      BOTTOM OF THE SCREEN BY PRESSING THE LETTER THAT IS IN DANGER."
130 PRINT "PRESS ANY KEY TO GO ON."
131 IF INKEY$="" THEN 131
132 CLS
133 PRINT "THEN A BULLET WILL FLY UP TO HIT THE TYPE (THAT'S THE NAME OF   THE OBJECTS).THE OTHER TYPES    WILL STOP TO GIVE YOU A CHANCE. YOU CANT LET THE TYPES HIT YOUR FORCE SHIELD MORE THAN 8 TIMES  OR YOUR GAME WILL END."
134 PRINT "IF YOU HIT 25 TYPES THE GAME IS OVER AND YOU BEAT THE TYPES."
135 PRINT "PRESS ANY KEY TO START."
136 IF INKEY$="" THEN 136
137 RETURN
138 PRINT"BEGINNER OR EXPERT TYPIST?       (B=BEGINNER E=EXPERT)
139 A$=INKEY$:IF A$="" THEN 139
140 IF A$="B" THEN SS=1 ELSE SS=3
141 CLS:RETURN
AME IS OVER AND YOU BEAT THE TYPES."
135 PRINT "PRESS ANY KEY TO START."
136 IF INKEY$="" THEN 136
137 RETURN
138 PRINT"BEGINNER OR EXPERT TYPIST?       (B=BEGINNER E=EXPERT)
139 A$=INKEY$:IF A$="" THEN 139
140 IF A$="B" THEN SS=1 ELSE SS=3
141 CLS:RETURN

149 lines? Not bad for a 10-year-old, hey? :-)

< Previous         Next >