Menu
JAQForum Ver 26.09

Forum Index : Microcontroller and PC projects : Restoring a old Microbee game

Posted: 04:48am
29 Oct 2026
Copy link to clipboard
Gizmo
Admin Group


When I first got my Microbee computer back in 1982 it came with a demo tape, and one of the games was called FOURROW.BAS, a connect 4 like game. I spend hours playing this game. It was a good opponent, and had a few amusing features, like "What do I do now" when it gets stuck.

Years later I did port the game to Quick Basic, and a ASCII version for a BBS, and later to the early Maximites. Along the way, the game lost some of its tact, it didnt play as well, I had broken the game engine.

Recently I went looking for the original code. Thanks to the Microbee archives, I found the WAV file of the original cassette tape. I still have my Microbee, but wanted to get the code without using the Bee. I discussed the problem with ChatGPT, and uploaded the original WAV file. It took ChatGTP a few minutes, it analyzed the audio, worked out the encoding and speed, then created the original program listing, mostly.

The Microbee used tokens for keywords, and the GPT didnt know what these were, but still gave me a listing that was close. Eventually I would have worked out what each token was.


140  {8C} T(11),S(44),N(7)
150  {8D} 170
160  {8A} I=1 {99} 1000:{8B} I
170  M1$="HIT ANY KEY TO CONTINUE" 1090
180  {84} {DE}="" {89} 180


Fortunately, at the same time, someone on the Microbee forum shared the original listing with me. Here is it.

00010  REM ***FOUR*** a program by Bruce Pratt April 1982
00020  CLS: PRINT
00030  GOSUB 1160
00040  PRINT "THE OBJECT OF THE GAME IS TO GET "
00050  PRINT "FOUR IN A LINE"
00060  PRINT "THE FOUR SYMBOLS MAY BE"
00070  PRINT "HORIZONTAL,VERTICAL OR DIAGONAL."
00080  PRINT "COLUMNS ARE FILLED FROM THE BASE UPWARD."
00090  PRINT "IN PLAY, ONLY THREE KEYS ARE USED"
00100  PRINT "          >  MOVES THE POINTER RIGHT"
00110  PRINT "          <  MOVES THE POINTER LEFT"
00120  PRINT "          SPACE BAR DROPS A MARKER TO"
00130  PRINT "          THE BASE OF THE SELECTED COLUMN"
00140  DIM T(11),S(44),N(7)
00150  GOTO 170
00160  FOR I=1 TO 1000: NEXT I
00170  M1$="HIT ANY KEY TO CONTINUE": GOSUB 1090
00180  IF KEY ="" THEN 180
00190  E=0:F=0:G=0: FOR A=1 TO 44:S(A)=0: NEXT A
00200  CLS: PRINT: PRINT TAB (12);"FOUR IN A ROW": PRINT: PRINT
00210  PRINT TAB (7);"SCORES": PRINT
00220  PRINT "YOU"; TAB (9);S1
00230  PRINT "ME"; TAB (9);S2
00240  PRINT "DRAWN"; TAB (9);S3: PRINT: PRINT
00250  RESTORE
00260  CURS 0,16
00270  L=-4006
00280  DATA 134,133,132,131
00290  FOR T1=1 TO 13: IF T1/2= FLT ( INT (T1/2)) THEN RESTORE
00300  READ A,B: FOR C=1 TO 28 STEP 4
00310  IF T1=1 THEN 340
00320  POKE L,133: POKE L+29,134
00330  POKE L+C,A: POKE L+C+3,B
00340  NEXT C:L=L+64: NEXT T1
00350  W=36: FOR C=1 TO 7:N(C)=W:W=W+1: NEXT C
00360  R=-4008:C=4
00370  S4=S1+S2+S3: IF S4/2 <> FLT ( INT (S4/2)) THEN 660
00380  M1$="MY MOVE": GOSUB 1070
00390  IF G<>0 THEN LET G=0: GOTO 160
00400  V=0:X=0:Y=0:Z=0
00410  FOR J=1 TO 7:C=C+1: IF C>7 THEN LET C=1
00420  P=R+C*4: IF N(C)>0 THEN GOSUB 820
00430  IF F<>0 THEN NEXT *J 620
00440  NEXT J
00450  IF X<>0 THEN LET C=X: GOTO 620
00460  IF Y<>0 THEN LET C=Y: GOTO 500
00470  IF Z<>0 THEN LET C=Z: GOTO 500
00480  C= INT ( RND *7+1): IF N(C)<1 THEN 480
00490  V=V+1: IF C<>4 AND V<5 THEN 480
00500  IF N(C)<8 THEN LET F=0: GOTO 620
00510  IF V< 10 THEN 580
00520  IF FLT (V)/3= FLT ( INT ( FLT (V)/3)) THEN LET M=1
00530  M1$="NOW WHAT DO I DO": GOSUB 1090
00540  IF V<21 THEN 580
00550  FOR A=1 TO 500:Q= INT ( RND *940-4084)
00560  J= INT ( RND *222+33): POKE Q,J
00570  NEXT A:E=1: GOTO 800
00580  N(C)=N(C)-7:Z=0: GOSUB 820:N(C)=N(C)+7
00590  IF F<>0 THEN LET F=0: IF V<9 THEN 480
00600  IF Z<>0 THEN LET Z=0: IF V<6 THEN 480
00610  IF X<>0 THEN LET X=0: GOTO 480
00620  X=R+63+C * 4 + 128 * INT (( FLT (N(C)-C))/7)
00630  FOR B=1 TO 2: POKE X+B,137: POKE X+B+64,136: NEXT B
00640  S(N(C))=5:N(C)=N(C)-7
00650  IF F<>0 THEN LET M1$="I WIN": GOSUB 1090: PLAY 8;5;3;8:S2=S2+1: GOTO 160
00660  M1$="YOUR MOVE": GOSUB 1070
00670  IF G<>0 THEN LET G=0: GOTO 160
00680  P=R+C*4: POKE P,135: POKE P+1,138
00690  K1$= KEY:K= ASC (K1$): IF K=44 OR K=46 THEN  720
00700  IF K=32 THEN 760
00710  GOTO 690
00720  IF K=46 AND C<7 THEN LET C=C+1
00730  IF K=44 AND C>1 THEN LET C=C-1
00740  POKE P,32: POKE P+1,32
00750  GOTO 680
00760   L1=( FLT (N(C)-C))/7: IF L1<0 THEN 680
00770  X=P+63+ INT (L1)*128
00780  FOR A=1 TO 2: POKE X+A,129: POKE X+A+64,130: NEXT A
00790  S(N(C))=1:E=0: GOSUB 820
00800  IF E<>0 THEN LET M1$="YOU WIN": GOSUB 1070: PLAY 1,6:S1=S1+1: GOTO 160
00810  N(C)=N(C)-7: GOTO 380
00820  P=R+C*4: POKE P,135: POKE P+1,138
00830  FOR A=0 TO 11:T(A)=0: NEXT A
00840  I=0:O=N(C)
00850  FOR U=O TO O+21 STEP 7: IF U>42 THEN 870
00860  T(I)=T(I)+S(U)
00870  NEXT U:I=I+1
00880  K=C-3: IF K<1 THEN LET K=1
00890  FOR A=K TO C+3
00900  IF A>4 OR A>C THEN 940
00910  FOR B=A TO A+3:T(I)=T(I)+S(O-C+B): NEXT B:I=I+1
00920  W=O-(C-A)*8: IF W<1 OR W>18 THEN 940
00930  FOR D=0 TO 3:T(I)=T(I)+S(W):W=W+8: NEXT D:I=I+1
00940  IF A>7 THEN 980
00950  IF A<4 OR A<C THEN 980
00960  W=O+(C-A)*6: IF W<4 OR W>21 THEN 980
00970  FOR D=0 TO 3:T(I)=T(I)+S(W):W=W+6: NEXT D:I=I+1
00980  NEXT A
00990  FOR H=0 TO I:D=T(H): IF D=4 THEN LET E=1
01000  IF D=15 THEN LET F=C
01010  IF D=10 THEN LET Z=C
01020  IF D=3 THEN LET X=C
01030  IF H<>0 AND D=2 THEN LET Y=C
01040  NEXT H
01050  POKE P,32: POKE P+1,32
01060  RETURN
01070  FOR A=1 TO 7: IF S(A)=0 THEN NEXT *A 1090
01080  NEXT A:M1$="ITS A DRAW":G=1
01090  CURS 0,16: PRINT  [A50 32];
01100  PRINT [A20 8];M1$; CHR (13);
01110  IF M=0 THEN 1130
01120  FOR D=1 TO 300: NEXT D:M=0:M1$="": GOTO 1090
01130  POKE -3124,32
01140  IF G<>0 THEN LET S3=S3+1
01150  RETURN
01160  POKE -2032,0
01170  READ (1230)B
01180  FOR A=-2031 TO (-2032+159)
01190  READ B
01200  POKE A,B
01210  NEXT A
01220  RETURN
01230  DATA 0,0,0,0,0,0,0,0,24,24,36,36,66,66,129,129
01240  DATA 129,129,66,66,36,36,24,24,0,0,0,0,0,0,0,0
01250  DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,255
01260  DATA 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,255
01270  DATA 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
01280  DATA 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128
01290  DATA 1,1,1,1,1,1,1,1,1,1,17,25,13,7,3,1
01300  DATA 255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0
01310  DATA 0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255
01320  DATA 128,128,128,128,128,128,128,128,128,128,136,152,176,224,192,128

The bottom DATA statements are for creating the PCG characters ( graphics )

I fed this back into the AI and it gave a good explanation of the ( very clever ) game engine.

Next, I wanted to play, so asked Chat GPT to create a javascript browser based edition. The rules were it must use the same game engine as the original code. Get that working, then add some delays to simulate the 2MHz Z80 of the Bee, and some animation to dropping the marker. The results can be found on this Link

Feel free to play and copy the page.

Glenn
The best time to plant a tree was twenty years ago, the second best time is right now.
JAQ
 
Posted: 07:40am
29 Oct 2026
Copy link to clipboard
homa
Guru


Glenn,
That's really nice; I like how it makes “thinking” visible.

Matthias
 


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026