3

So I have found an old usborne book called Weird Computer Games, and it has listings of BASIC text games for commodore 64, which I want to type in and run, and probably rewrite some at C# or JS.

Problem is, I don't have commodore 64 or any other vintage machine, so I use the online JavaScript based Aplesoft BASIC interpreter, and I've got to a point where I've got an error I don't understand - I think it is due to different dialects of basic being used. Or I have misread some characters.

The error I get is: ParseError: Syntax error: Expected ')', saw {"operator":","} in line 610

But I am not able to find documentation on this TAB function. Below is the code

10 GOSUB 700 : GOSUB 620

19               REM 20 Set up variables (See if you can work outwhat they are.)
20 LET NW=4 : LET M=0 : LET FM=50

29              REM Choose new height "NH". "H" is heigh
30 GOSUB 530 : LET H=NH
40 GOSUB 550
50 LET EF=0 : LET FF=0 : LET HH=H
60 FOR I=1 TO 4 : LET G(I)=0 : NEXT I
70 FOR I=1 TO 4 : LET A$=P$(I)+":" : LET X=1
80 LET Y=1+I : GOSUB 610 : NEXT I
90 GOSUB 490 : GOSUB 430
100 IF M=FM THEN GOTO 250
110 IF EF=1 THEN GOTO 230
120 IF INKEY$(0)="" THEN GOTO 90
130 LET HH=H-1 : GOSUB 510
140 GOSUB 490 : GOSUB 430
150 LET H=HH
160 IF H>0 THEN GOTO 130
170 IF P=17 THEN GOSUB 320
180 IF FF=1 THEN GOTO 240
190 GOSUB 530
200 LET HH=H+1 : GOSUB 510 : GOSUB 490
210 LET H=HH : IF H=NH THEN GOTO 90
220 GOSUB 430 : GOTO 200
230 LET A$="WELL DONE! SUPERWITCH IS PLEASED WITH YOU"
240 LET A$="OUT OF BROOMSTICKS!" : GOTO 260
250 LET A$="TOO LATE!"
260 LET X=1 : LET Y=15 : GOSUB 610
270 STOP
280 LET A$="W" : LET X=P : GOSUB 610
290 FOR T=1 TO 1000 : NEXT T
300 LET NW=NW-1 : IF NW=0 THEN LET FF=1
310 RETURN
320 IF W=1 THEN GOSUB 280 : RETURN
330 LET G(R)=G(R)+1
340 LET A$=STR$(G(R)) : LET X=17
350 LET Y=1+R : GOSUB 610
360 LET P=19 : GOSUB 430
370 LET F=0
380 FOR I=1 TO 4
390 IF G(I)>=N(I) THEN LET F=F+1
400 NEXT I
410 IF F=4 THEN LET EF=1
420 RETURN
430 LET GD=GD+1 : IF GD=6 THEN LET GD=1
440 LET A$=G$(GD) : LET X=1 : LET Y=15 : GOSUB 610
450 LET A$=" " : LET X=P : LET Y=14 : GOSUB 610
460 LET P=P+1 : IF P=20 THEN GOSUB 550
470 LET X=P : LET A$=C$ : GOSUB 610
480 RETURN
490 LET A$="-Y-=" : LET X=16 : LET Y=14-HH
500 GOSUB 610 : RETURN
510 LET A$="    " : LET X=16 : LET Y=14-H
520 GOSUB 610 : RETURN

529              REM 530-540: Choose new height for witch.
530 LET NH = INT(RND(1)*5+3)
540 RETURN

549              REM 550: Chooses an object.
550 LET R=INT(RND(1)*4)+1
559              REM 560: Random chance of object being Broomstick Snatcher.
560 LET W=0 : IF RND(1)>0.8 THEN LET W=1
570 LET C$=LEFT$(P$(R),1) : LET P=1
580 LET M=M+1
590 IF M=FM THEN LET C$="CAULDRON"
600 RETURN

610 PRINT TAB(X,Y); A$ : RETURN
620 CLS : PRINT : PRINT
630 PRINT "THE POTION MUST HAVE" : PRINT
640 FOR I=1 TO 4
650 LET N=INT(RND(1)*3)+2 : LET N(I)=N
660 PRINT : PRINT; N; " "; P$(I)
670 NEXT I : PRINT : PRINT
680 PRINT "PRESS RETURN TO PLAY"
690 INPUT X$ : CLS : RETURN
700 DIM P$(4) : DIM N(4) : DIM G(4)
710 DIM G$(5)
720 FOR I=1 TO 4 : READ P$(I) : NEXT I
730 DATA "TOES OF NEWTS", "EYES OF LIZARDS", "ROOTS OF IVY", "BRAINS OF BATS"
740 LET H$=">====>====>====>====>===="
750 FOR I=1 TO 5 : LET G$(6-I)=MID$(H$,I,I+20)
760 NEXT I : LET GD=1
770 RETURN











  

1 Answers1

5

First, the BASICs of the era were all very different, so you may find a Commodore 64 emulator such as the one at Virtual Consoles useful. That said, this doesn’t look like Commodore 64 BASIC. The C64 TAB statement was line-oriented: it just tabbed over that much on the current line. This means it only took one parameter, X; there was no Y.

According to the version of Weird Computer Games on the Internet Archive, the code is not specifically for the Commodore 64, but rather for “a standard version of BASIC” (see page 2). Look for the changes marked with a pyramid symbol for changes for the Commodore 64. In this case, line 610 (the line with the two-parameter tab) needs to be changed to:

610 PRINT CHR$(19);FOR LL=1 TO Y:PRINT:NEXT:PRINT TAB(X);A$:RETURN

I’ve verified that this subroutine in the above emulator does in fact print at coordinates X and Y on the screen.

In the version of the book on the Internet Archive, the code you’ve posted starts on page 10, “Flying Witches”. The necessary changes for the Commodore 64 and other computers are on page 11, under “Conversion lines”. Each computer has its own symbol (see page 2 for the list of symbols) and the symbol for the Commodore 64 is the pyramid.

If you want to make it run on the Apple, look for the changes marked with a circle. In the case of TAB(X,Y), it needs to be replaced with VTAB(Y) and HTAB(X).

Jerry Stratton
  • 3,287
  • 1
  • 22
  • 30