Pac Man

Date: 198x
Type: Program
Platform(s): TS 2068

A homemade implementation of the popular game.

Appears on

Library tape of the Indiana Sinclair Timex User’s Group.

Gallery

Pac Man

Source Code

    2 LET h=0
    5 LET e$="Jack"
   10 DATA 60,126,240,224,224,240,126,60
   12 DATA 0,66,195,195,231,255,126,60,60,126,15,7,7,15,126,60
   14 DATA 60,126,255,231,195,195,66,0,0,0,0,0,60,60,60,60
   18 DATA 60,125,255,255,255,255,126,60,0,6,8,60,126,60,24,0
   20 DATA 24,60,24,255,24,24,36,102
   30 FOR b=0 TO 55
   40 READ c
   50 POKE USR "\a"+b,c
   60 NEXT b
   75 LET s=0: LET v=1
   77 LET z=4: LET y=0: PAPER 3: INVERSE 1
   78 LET f=0
   79 CLS 
   80 PRINT INK z;"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
   90 IF f=1 THEN RETURN 
  100 PRINT INK z;"x"; INK y;"\g\g\g\g\g\g\g\g\g\g\g\g\g''''\g\g\g\g\g\g\g\g\g\g\g\g\g"; INK z;"x"
  110 IF f=1 THEN GO TO 80
  120 PRINT INK z;"x"; INK y;"\g"; INK z;"xxxxxxxxxxxx"; INK y;"''''"; INK z;"xxxxxxxxxxxx"; INK y;"\g"; INK z;"x"
  130 IF f=1 THEN GO TO 100
  140 PRINT INK z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g\g\g\g\g\g\g\g\g\g\g''''\g\g\g\g\g\g\g\g\g\g\g"; INK z;"x"; INK y;"\g"; INK z;"x"
  150 IF f=1 THEN GO TO 120
  160 PRINT INK z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK z;"xxxxxxxxxx"; INK y;"''''"; INK z;"xxxxxxxxxx"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK z;"x"
  170 IF f=1 THEN GO TO 140
  180 PRINT INK z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK  z;"x"; INK y;"\g\g\g\g\g\g\g\g\g''''\g\g\g\g\g\g\g\g\g"; INK z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK z;"x"
  190 IF f=1 THEN GO TO 160
  200 PRINT INK z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK z;"xxxxxxxx";  INK y;"''''"; INK z;"xxxxxxxx"; INK y;"\g"; INK z;"z"; INK y;"g"; INK z;"x"; INK y;"\g"; INK z;"x"
  210 IF f=1 THEN GO TO 180
  220 PRINT INK z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK z;"x" ; INK y;"\g"; INK z;"x"; INK y;"\g\g\g\g\g\g\g''''\g\g\g\g\g\g\g"; INK z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK z;"x"
  230 IF f=1 THEN GO TO 200
  240 PRINT INK z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK z;"xxxxxxxxxxxxxxxx"; INK y;"\g"; INK  z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK z;"x"; INK y;"\g"; INK z;"x"
  250 IF f=1 THEN GO TO 220
  260 FOR a=1 TO 4
  270 PRINT INK z;"x"; INK y;"'''''''"; INK z;"xxxxxxxxxxxxxxxx"; INK y;"'''''''"; INK z;"x"
  280 NEXT a
  290 LET f=1
  300 GO SUB 240
  305 INVERSE 0
  307 GO SUB 1040
  310 LET u=20
  315 PAPER 0: INK 6
  320 LET p=17
  330 LET du=0
  335 LET lj=4
  340 LET dp=1
  345 LET lf=4
  350 LET a=10
  355 LET g$="'"
  360 LET t=1
  365 LET l$="'"
  370 LET da=-1
  375 PRINT AT 9,9; PAPER 0; INK 4; INVERSE 1;"Score: "
  380 LET dt=0
  385 LET q=1
  390 LET c=144
  400 IF INKEY$<>"" THEN BEEP .01,0
  410 PRINT AT u,p; INK 6;CHR$ c
  440 IF SCREEN$ (u+du,p+dp)="x" THEN GO TO 1000
  460 PRINT AT a,t; INK 3;g$
  470 IF SCREEN$ (a+da,t+dt)="x" THEN GO TO 1020
  490 LET g$=SCREEN$ (a+da,t+dt)
  495 IF ATTR (a+da,t+dt)>128 THEN LET g$=","
  500 IF g$<>"," THEN LET q=v
  510 IF g$<>"," AND g$<>"," THEN LET g$="\g"
  515 LET a=a+da: LET t=dt
  517 IF a=ba AND t=rl THEN GO SUB 1200
  520 IF SCREEN$ (a,t)="," AND lj<>lf THEN GO SUB 710
  525 PRINT AT a,t;"H"
  530 PRINT AT u,p; INK 3;l$
  540 LET u=u+du: LET p=p+dp
  542 IF ATTR (u,p)=6 THEN GO TO 800
  545 LET m=0 : LET l$=SCREEN$ (u,p): IF l$="" THEN LET l$=",": LET m=1
  547 IF u=ba AND p=rl THEN GO SUB 1150
  550 PRINT AT u,p;"F"
  555 IF m=1 THEN LET s=s+1: LET s2=s2+1  : BEEP .005,-10: BEEP .005,-5: PRINT AT 9,17;s
  557 IF s2>=224 THEN GO TO 1110
  560 IF INKEY$="" OR l$="," THEN GO TO 400
  565 LET i$=INKEY$
  570 IF CODE INKEY$<53 OR CODE INKEY$>56 THEN GO TO 400
  580 RESTORE 585
  585 DATA du,"6","7",dp,"5","8"
  590 FOR i=1 TO 2
  600 READ j: READ j$: READ k$
  610 IF j=0 AND INKEY$<>j$ AND INKEY$<>k$ THEN GO TO 400
  620 NEXT i
  630 LET u1=u: LET p1=p
  640 LET u1=u+((i$="6")-(i$="7"))*(du=0)*2
  650 LET p1=p+((i$="8")-(i$="5"))*(dp=0)*2
  655 LET n=(i$="6")*(dp=1)+(i$="7")*(dp =-1)+(I$="5")*(du=1)+(i$="8")*(du=-1)
  660 IF n=0 THEN LET n=-1
  665 IF lj+n=0 OR lj+n=5 THEN GO TO 400
  670 LET lj=lj+n
  675 PRINT AT u,p; INK 3;l$
  680 LET u=u1: LET p=p1
  690 PRINT AT u,p;"F"
  695 BEEP .01,10
  700 GO TO 400
  710 IF INT q=0 THEN RETURN 
  715 LET tf=lf+(lf<lj)-(lf>lj)
  720 LET q=q-1
  730 LET o=(lf>lj)*(da=-1)+(lf<lj)*(da=1)
  740 IF o=0 THEN LET o=-1*(dt=0)
  745 LET o=o*2
  750 LET t=t+o
  760 LET o=(lf>lj)*(dt=1)+(lf<lj)*(dt=-1)
  765 LET lf=tf
  770 IF o=0 THEN LET o=-1*(da=0)
  775 LET o=o*2
  780 LET a=a+o
  790 RETURN 
  800 RESTORE 900
  805 FOR a=1 TO 4
  810 READ b$: READ r
  820 PRINT AT u,p;b$
  830 BEEP 1,r
  840 NEXT a
  850 FOR a=1 TO 64
  860 BEEP .01,25
  870 NEXT a
  872 PRINT AT 17,11;"GAME  OVER"
  875 IF h<s THEN INPUT "You have attained the high score:Please type in your name and press enter. ";e$: IF LEN e$>11 THEN PRINT AT u,p-5;"Too long.......": GO TO 800
  880 IF h<s THEN LET h=s
  885 IF INKEY$="" THEN GO TO 885
  890 GO TO 75
  900 DATA "F",30,"E",20,".",10,"",0
 1000 IF du=0 THEN LET du=-dp: LET dp=0: LET c=c+1: GO TO 420
 1010 IF dp=0 THEN LET dp=du: LET du=0 : LET c=c+1: IF c=148 THEN LET c=144
 1015 GO TO 420
 1020 IF da=0 THEN LET da=dt: LET dt=0: GO TO 515
 1030 IF dt=0 THEN LET dt=-da: LET da=0: GO TO 515
 1040 RESTORE 1050
 1042 LET s2=0
 1045 GO SUB 1200
 1050 DATA 7,1,7,.5,7,.5,10,1,12,1,14,.5,12,1.5,10,1.5,12,.5,7,1,7,.5,7,.5,10,1,12,1,7,2
 1055 DATA 7,1,7,1,10,1,12,1,14,.5,12,1.5,10,1,12,1,7,1,7,1,5,.5,4,1.5,0,2
 1060 FOR a=1 TO 28
 1070 READ w: READ x
 1080 BEEP x/10,w
 1090 NEXT a
 1095 IF h<s THEN LET h=s
 1100 PRINT AT 11,9; PAPER 4; INK 0;"Hi-score: ";h;AT 12,9;"by ";e$
 1105 RETURN 
 1110 LET v=v+RND
 1120 GO TO 77
 1150 FOR d=24 TO 0 STEP -1
 1155 BEEP .01,d
 1160 NEXT d
 1165 BEEP .1,36
 1170 LET s=s+5
 1180 LET l$=","
 1200 LET ba=INT (RND*20)+1
 1210 LET rl=INT (RND*29)+1
 1220 LET b$=SCREEN$ (ba,rl)
 1230 IF b$="'" OR b$="x" OR (b$="," AND s2<112) OR (ba>8 AND ba<13) THEN GO TO 1200
 1240 PRINT AT ba,rl; FLASH 1; INK 5; PAPER 0;"\g"
 1245 IF s>=112 THEN LET s2=s2+1
 1250 RETURN 
 9990 REM Needs fixin?
 9999 SAVE "PAC MAN" LINE 1

People

No people associated with this content.

Scroll to Top