Jump to content
IGNORED

PC Basic Programs where to find.


bradhig1

Recommended Posts

It's trying to play the string "MFL24TO60O2GT120GT60AT120ABO3DO2BT60GP16" defined on line 210.

 

MF - Music foreground.  Halts the program while the music plays, rather than playing as the program continues

L24 - Plays 1/24th notes

T - tempo.  This is supposed to be followed by a number of quarter-notes per minute

O60 - 60th octave.  Probably not even dogs can hear that.

O2 - 2nd octave.

G - G note

T120 - 120 notes per minute

G - G note

T60 - 60 notes per minute

A - A note

T120 - 120 notes per minute

A - A note

B - B note

O3 - 3rd octave

D - D note

O2 - 2nd octave

B - B note

T60 - 60 notes per minute

G - G note

P16 - pause for a 16th

 

So the error is the first T with no number followed by an octave that's way out of range and overridden immediately anyway.

Link to comment
Share on other sites

Check line 240.  I see "CN.1" which is probably supposed to be "CN,1".

 

In case you're wondering how that affects line 400, lines 220-250 define a bunch of user functions that do things whenever you reference them, and line 400 references a few.  FNJ appears to be good.  FNK also.  FNL, though, looks wrong.

Link to comment
Share on other sites

690 has a ; where it should have a :

630 probably GOSUBs the wrong line at the end.

440 has too many THENs

You should also make sure you have the right letters after any FN use, because it can get locked up in 560-590, for instance.

There's a " missing on 390

Lines 610 and 620 have the same result, which can cause characters to move 2 spaces and jump out of bounds

Edited by ChildOfCv
Link to comment
Share on other sites

A few of the corrections seem to have introduced new errors.  The fun of BASIC's editing system (especially in graphics mode).

 

630 IF CN<3 THEN IF ABS(CAT(CN,1)-CAT(3,1))+ABS(CAT(CN,2)-CAT(3,2))< 4 THEN X=CAT(CN,1)+INT(RND*3)-1:Y=CAT(CAN,2)+INT(RND*3)-1:GOSUB 810 ELSE IF RND*10<2 THEN GOSUB 660

Notice the Y=CAT(CAN,2) part

 

720 IF (ANG=) AND FNGX<3) OR (ANG=1 AND  FNGY<3) OR (ANG=2 AND FNGX>20) OR (ANG=3 ON ANG+1 GOTO 730,750,770,790

IF (ANG=)

Also, no closing parentheses before the GOTO, and no THEN before the GOTO either.  It's possible that this line got corrupted while trying to edit other lines, considering how much it has changed.

 

780 X=FNGX+2:Y=FNGY:ON D(FNGX=2,FNGY)+1 GOSUB 810,820,830,840:RETURN

D(FNGX=2,FNGY) is probably supposed to be FNGX-2

Edited by ChildOfCv
Link to comment
Share on other sites

8 hours ago, carlsson said:

Is this a type in from a magazine available somewhere? Has it been proof read so we know all those errors were part of the printed listing and not due to clumsy typing or bad OCR?

Unfortunately, it is from a magazine.

 

I rearranged the code a little, gave some variables more meaningful names, and changed some of the other crap that they did.  I also added comments.  Perhaps this code will run

 

Spoiler

100 REM ****************
110 REM * wild kingdom *
120 REM ****************
130 REM by monte ulm
140 REM and the hcm staff
150 REM home computer magazine
160 REM version 4.3.1
170 REM ibm pcjr cartridge basic
180 REM and 64k memory expansion
190 REM ibm pc basic w/color monitor
191 'She loves to do the Wild Thing
200 KEY OFF
210 CLS:SCREEN 1:COLOR 1,0
211 DIM C1(12),C2(12),D(23,32),HB(10),CAT(3,2),CIT(3)
212 LOCATE 12,14:PRINT "WILD KINGDOM":FOR TD=1 TO 2000:NEXT:CLS:COLOR ,0
213 DEF FNX(Z)=Z*8
214 DEF FNY(Z)=Z*10-4
220 DEF FNCX=FNX(CAT(CN,1))+2
221 DEF FNCY=FNY(CAT(CN,2))+2
230 DEF FNPLU=D(HX,HY)
231 DEF FNPR=D(HX,HY+1)
232 DEF FNPD=D(HX+1,HY)
233 DEF FNCLU=D(CAT(CN,1),CAT(CN,2))
234 DEF FNCD=D(CAT(CN,1)+1,CAT(CN,2))
240 DEF FNCR=D(CAT(CN,1),CAT(CN,2)+1)
241 DEF FNPX=FNX(HX)+2
242 DEF FNPY=FNY(HY)+2
250 DEF FNDX=HX-CAT(CN,1)
251 DEF FNDY=HY-CAT(CN,2)
252 FOR Z=1 TO 31:D(23,Z)=2:NEXT:FOR Z=1 TO 22:D(Z,32)=1:NEXT
253 MEN=3:SCORE=0
254 RANDOMIZE TIMER
255 C$="RUR4DRDL3NUL3F2R2EU":H$="A=ANG;C1NU2LDGR4HLEL;"
256 GET(100,50)-(107,56),HB
260 DRAW "BM10,30C2;XC$;BM30,30C3;XC$;":GET(10,29)-(16,33),C1:GET(30,29)-(36,33),C2
270 CLS:FOR Z=0 TO 3:LINE (5-Z,7-Z)-(316+Z,184+Z),2,B:NEXT
280 FOR X=1 TO 22:FOR Y=1 TO 31:R=INT(RND*4):D(X,Y)=R: ON R+1 GOSUB 810,820,830,840:NEXT:NEXT
290 Y=5:X=3:GOSUB 810
291 HY=5:HX=3:GOSUB 860
292 CAT(1,1)=10:CAT(1,2)=9
293 CAT(2,1)=9:CAT(2,2)=10
294 CAT(3,1)=10:CAT(3,2)=10
300 X=10:Y=9:GOSUB 810
301 X=9:Y=10:GOSUB 810
302 X=10:Y=10:GOSUB 810
303 CN=1:PUT(FNCY,FNCX),C2,PSET
304 CN=2:PUT(FNCY,FNCX),C2,PSET
305 CN=3:PUT(FNCY,FNCX),C1,PSET
310 ON KEY(11) GOSUB 680
311 ON KEY(12) GOSUB 690
312 ON KEY(13) GOSUB 700
313 ON KEY(14) GOSUB 710
314 'Assign key 15 to the SPACE key, I guess?
315 KEY 15,CHR$(&H00)+CHR$(&H39):ON KEY(15) GOSUB 720:KEY (15) ON
320 LOCATE 25,1:PRINT "score:";SCORE;TAB(20);"men  ";:IF MEN>-1 THEN PRINT STRING$(MEN,16);"   "; ELSE PRINT "   ";
330 T = TIMER + 0.5
331 GOSUB 400:IF EAT=1 THEN GOTO 370
332 SCORE=SCORE+CIT(1)*2+CIT(2)*2:IF CIT(3)=1 THEN 360 ELSE LOCATE 25,7:PRINT SCORE;
340 KEY(11) ON:KEY(12) ON:KEY(13) ON:KEY(14) ON:KEY(11) STOP:KEY(12) STOP:KEY(13) STOP:KEY(14) STOP
341 FOR CN=1 TO 3:IF FNDX=0 AND FNDY=0 THEN GOTO 370
350 NEXT
351 WHILE TIMER < T:WEND
352 GOTO 330
360 SCORE=SCORE+1000:SOUND 440,5:GOTO 270
370 SOUND 110,5:EAT=0:MEN=MEN-1:GOSUB 850:FOR CN=1 TO 3:PUT(FNCY-1,FNCX-1),HB,PSET:NEXT:IF MEN>-1 THEN GOTO 290
380 FOR Z=1000 TO 110:SOUND Z,1,15:NEXT:CLS:LOCATE 12,1:PRINT "YOUR FINAL SCORE IS :";SCORE:PRINT:PRINT "WOULD YOU LIKE TO PLAY AGAIN (Y/N)"
390 Z$=INKEY$:IF Z$="" THEN 390 ELSE IF Z$="N" THEN END ELSE IF Z$="Y" THEN RUN ELSE GOTO 390
391 ' FNCLU = door up or left
392 ' FNCD = door below
393 ' FNCR = door to right
394 '0 = nothing above or left
395 '1 = can't move left
396 '2 = can't move up
397 '3 = can't move up or left
398 'Move each animal
399 'First see if a wild thing is trapped.  If so, score a point and see about breaking a wall
400 FOR CN=1 TO 3:IF FNCLU=3 AND (FNCD AND 2) <> 0 AND (FNCR AND 1) <> 0 THEN CIT(CN)=1:GOTO 630 ELSE CIT(CN)=0
401 'Every once in a while, don't move toward the player.  Just choose a random direction and go
410 IF RND*10<3 THEN 500
411 'Every other turn, prefer either horizontal or vertical movement towards player
412 RZ=ABS(RZ-1):IF RZ=1 THEN GOTO 460
413 'Prefer horizontal
420 IF FNDY>0 AND (FNCR AND 1) = 0 THEN MCY=1:GOTO 600
430 IF FNDY<0 AND (FNCLU AND 1) = 0 THEN MCY=-1:GOTO 600
440 IF FNDX>0 AND (FNCD AND 2) = 0 THEN MCX=1:GOTO 600
450 IF FNDX<0 AND (FNCLU AND 2) = 0 THEN MCX=-1:GOTO 600 ELSE GOTO 500
451 'Prefer vertical
460 IF FNDX<0 AND (FNCLU AND 2) = 0 THEN MCX=-1:GOTO 600
470 IF FNDX>0 AND (FNCD AND 2) = 0 THEN MCX=1:GOTO 600
480 IF FNDY>0 AND (FNCR AND 1) = 0 THEN MCY=1:GOTO 600
490 IF FNDY<0 AND (FNCLU AND 1) = 0 THEN MCY=-1:GOTO 600
491 'Either can't move toward player or randomness has chosen a different path this time
492 'Choose a random direction to move.  There should be at least one direction open, since
493 'there was already a check for "trapped" above.
500 R=INT(RND*4)+1
501 'Choose a different interpretation of the random direction each time.  The random direction
502 'spins around looking for the open gate.  The direction selection chooses clockwise or
503 'counterclockwise, and the repeated lines are in reverse order to follow that difference
510 RZ=ABS(RZ-1):IF RZ=1 THEN ON R GOTO 520,530,540,550 ELSE ON R GOTO 560,570,580,590
520 IF (FNCLU AND 1) = 0 THEN MCY=-1:GOTO 600
530 IF (FNCR AND 1) = 0 THEN MCY=1:GOTO 600
540 IF (FNCLU AND 2) = 0 THEN MCX=-1:GOTO 600
550 IF (FNCD AND 2) = 0 THEN MCX=1:GOTO 600 ELSE GOTO 520
560 IF (FNCD AND 2) = 0 THEN MCX=1:GOTO 600
570 IF (FNCLU AND 2) = 0 THEN MCX=-1:GOTO 600
580 IF (FNCR AND 1) = 0 THEN MCY=1:GOTO 600
590 IF (FNCLU AND 1) = 0 THEN MCY=-1:GOTO 600 ELSE GOTO 560
591 'A direction has been chosen.  Make sure it stays on the map
600 IF CAT(CN,1)+MCX<1 OR CAT(CN,1)+MCX>22 OR CAT(CN,2)+MCY<1 OR CAT(CN,2)+MCY>31 THEN 630
601 'It stays on the map.  Now erase the wild thing from its old position and move it to its new position
610 IF CN<3 THEN PUT(FNCY-1,FNCX-1),HB,PSET:CAT(CN,1)=CAT(CN,1)+MCX:CAT(CN,2)=CAT(CN,2)+MCY:PUT(FNCY,FNCX),C2:GOTO 630
620 PUT (FNCY-1,FNCX-1),HB,PSET:CAT(CN,1)=CAT(CN,1)+MCX:CAT(CN,2)=CAT(CN,2)+MCY:PUT(FNCY,FNCX),C1
621 'The first two wild things can destroy walls when close to the third
630 IF CN<3 THEN IF ABS(CAT(CN,1)-CAT(3,1))+ABS(CAT(CN,2)-CAT(3,2))<4 THEN X=CAT(CN,1)+INT(RND*3)-1:Y=CAT(CN,2)+INT(RND*3)-1:GOSUB 810 ELSE IF RND*10<2 THEN GOSUB 660
631 'See if the wild thing got you
640 SOUND 660,1:IF FNDX=0 AND FNDY=0 THEN EAT=1
641 'Clear the movement direction and cycle through the other wild things
650 MCX=0:MCY=0:NEXT CN:RETURN
651 'See if wild thing #3 is going to destroy a wall, which happens when the player is too far away
660 IF FNDX+FNDY>4 AND RND*10>2 THEN RETURN
670 X=CAT(3,1)+INT(RND*3)-1:Y=CAT(3,2)+INT(RND*3)-1:GOSUB 810:RETURN
671 'FNPLU = wall at player position
672 'FNPR = wall to right of player
673 'FNPD = wall below player
674 '0 = nothing above or left
675 '1 = can't move left
676 '2 = can't move up
677 '3 = can't move up or left
678 'Player pressed up.  If not facing up, turn upwards.  Otherwise move upwards.
680 IF ANG<>0 THEN ANG=0:GOSUB 850:GOTO 860
681 IF HX>1 AND (FNPLU AND 2)=0 THEN GOSUB 850:HX=HX-1:GOSUB 860:GOTO 870
682 RETURN
683 'Player pressed left.  If not facing left, turn to left.  Otherwise move left.
690 IF ANG<>1 THEN ANG=1:GOSUB 850:GOTO 860
691 IF HY>1 AND (FNPLU AND 1)=0 THEN GOSUB 850:HY=HY-1:GOSUB 860:GOTO 870
692 RETURN
693 'Player pressed right.  If not facing right, turn to right.  Otherwise move right.
700 IF ANG<>3 THEN ANG=3:GOSUB 850:GOTO 860
701 IF HY<30 AND (FNPR AND 1)=0 THEN GOSUB 850:HY=HY+1:GOSUB 860:GOTO 870
702 RETURN
703 'Player pressed down.  If not facing down, turn down for what.  Otherwise move down.
710 IF ANG<>2 THEN ANG=2:GOSUB 850:GOTO 860
711 IF HX<22 AND (FNPD AND 2)=0 THEN GOSUB 850:HX=HX+1:GOSUB 860:GOTO 870
712 RETURN
713 'Player pressed (key 15).  The PC BASIC manual list the legal range as 1-14, but this seems to be okay.  WTF... PCJr thing?
714 'Anyway, I don't know which key this is supposed to be, but its purpose is to build a wall in front of the player
715 'First make sure the wall building is on the board
720 IF (ANG=0 AND HX<2) OR (ANG=1 AND HY<2) OR (ANG=2 AND HX>21) OR (ANG=3 AND HY>29) THEN RETURN
721 'It's on the board.  Toggle a wall according to direction facing.
722 ON ANG+1 GOTO 730,750,770,790
723 'Facing up.  Toggle the up wall
730 '
740 X=HX:Y=HY:ON (D(X,Y) XOR 2) + 1 GOTO 810,820,830,840
741 'Facing left.  Toggle the left wall
750 '
760 X=HX:Y=HY:ON (D(X,Y) XOR 1) + 1 GOTO 810,820,830,840
761 'Facing down.  Toggle the down wall
770 '
780 X=HX+1:Y=HY:ON (D(X,Y) XOR 2) + 1 GOTO 810,820,830,840
781 'Facing right.  Toggle the right wall
790 '
800 X=HX:Y=HY+1:ON (D(X,Y) XOR 1) + 1 GOTO 810,820,830,840
801 '0 = nothing above or left
802 '1 = can't move left
803 '2 = can't move up
804 '3 = can't move up or left
810 IF X>22 OR X<1 OR Y>31 OR Y<1 THEN RETURN
811 IF X=1 THEN 830
812 IF Y=1 THEN 820
813 D(X,Y)=0:LINE (FNY(Y),FNX(X))-(FNY(Y)+9,FNX(X)),0:LINE (FNY(Y),FNX(X))-(FNY(Y),FNX(X)+7),0,B:RETURN
820 IF X>22 OR X<1 OR Y>31 OR Y<1 THEN RETURN
821 IF X=1 THEN 840
822 D(X,Y)=1:LINE (FNY(Y),FNX(X))-(FNY(Y)+9,FNX(X)),0:LINE (FNY(Y),FNX(X))-(FNY(Y),FNX(X)+7),2,B:RETURN
830 IF X>22 OR X<1 OR Y>31 OR Y<1 THEN RETURN
831 IF Y=1 THEN 840
832 D(X,Y)=2:LINE (FNY(Y),FNX(X))-(FNY(Y)+9,FNX(X)),2:LINE (FNY(Y),FNX(X)+1)-(FNY(Y),FNX(X)+7),0,B:RETURN
840 IF X>22 OR X<1 OR Y>31 OR Y<1 THEN RETURN
841 D(X,Y)=3:LINE (FNY(Y),FNX(X))-(FNY(Y)+9,FNX(X)),2:LINE (FNY(Y),FNX(X))-(FNY(Y),FNX(X)+7),2,B:RETURN
850 PUT(FNPY-1,FNPX-1),HB,PSET:RETURN
860 PSET(FNPY+3,FNPX+3),0:DRAW "XH$;":SOUND 1000,2:RETURN
861 'See if the player moved onto a wild thing and got eaten
870 FOR CN=1 TO 3:IF FNDX=0 AND FNDY=0 THEN EAT=1
880 NEXT:RETURN

 

 

Edited by ChildOfCv
  • Like 1
Link to comment
Share on other sites

2 hours ago, bradhig1 said:

I am working on the apple ii version of the same game right now and the doors work the same as the c64 and ti99a versions.  Fire button opens door two doors from you.

They actually do intend to open doors from that far away?  I figured that was somewhere between weirdly managing the coords or a typo.

 

Well, this should fix the door issue then.

740 X=HX-1:Y=HY:ON (D(X,Y) XOR 2) + 1 GOTO 810,820,830,840
741 'Facing left.  Toggle the left wall
750 '
760 X=HX:Y=HY-1:ON (D(X,Y) XOR 1) + 1 GOTO 810,820,830,840
761 'Facing down.  Toggle the down wall
770 '
780 X=HX+2:Y=HY:ON (D(X,Y) XOR 2) + 1 GOTO 810,820,830,840
781 'Facing right.  Toggle the right wall
790 '
800 X=HX:Y=HY+2:ON (D(X,Y) XOR 1) + 1 GOTO 810,820,830,840

 

Link to comment
Share on other sites

There was one magazine from the day that had a program to assist in entering their other programs.  You'd run this other program and start typing in lines from the magazine.  Each line included a check code, and if the text didn't match up with the check code, it would buzz you and make you reenter it.  Might have been Compute magazine.  Anyway, it's too bad that the other magazines didn't do that.

 

There was another magazine called Family Computing, and one of their December issues came with a program called The Christmas Tree Construction Set.  It was a program that worked a lot like a paint program but instead of pens you had ornaments, tree branches, etc. to choose from.  But better than half the program was DATA statements, so it was very easy to screw up.

Link to comment
Share on other sites

On 10/12/2019 at 1:11 AM, ChildOfCv said:

There was one magazine from the day that had a program to assist in entering their other programs.  You'd run this other program and start typing in lines from the magazine.  Each line included a check code, and if the text didn't match up with the check code, it would buzz you and make you reenter it.  Might have been Compute magazine.  Anyway, it's too bad that the other magazines didn't do that.

 

Rainbow magazine (for the Coco) included this "feature". I never used it because it required someone to type all of the comment lines (REMarks) and even spaces exactly as printed. 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...