Advertisement
Guest User

1 Player Pong in BASIC for the C64

a guest
Sep 14th, 2021
2,162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.18 KB | None | 0 0
  1. 0 rem pong for 1
  2. 5 gosub 1000:for sprite=12800 to sprite+192:read a:poke sprite,a:next sprite
  3. 10 ?chr$(147):x=30:y=145
  4. 20 poke 53280,0:poke53281,0:poke 646,1
  5. 30 poke 2040,200:poke 53248,x:poke 53249,y
  6. 35 poke 53271,3:poke 53264,2
  7. 45 poke 2041,201:poke 53250,50:poke 53251,y
  8. 50 poke 2042,202:poke 53252,180:poke 53253,y+10
  9. 60 ?tab(8)"press any key to start"
  10. 65 a$="":get a$:if a$="" then goto 65
  11. 70 ?chr$(147)
  12. 100 PRINT " 1 pp o n n gg"
  13. 110 PRINT " 11 p p o o nn n g"
  14. 120 PRINT " 1 pp o o n nn g gg"
  15. 130 PRINT " 1 p o o n n g g"
  16. 140 PRINT " {blue}p1{white} 111 p o n n gg {red}p2{white}"
  17. 150 PRINT "UDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDI";
  18. 160 PRINT "{125} {125}";
  19. 170 PRINT "{125} {125}";
  20. 180 PRINT "{125} {125}";
  21. 190 PRINT "{125} {125}";
  22. 200 PRINT "{125} {125}";
  23. 210 PRINT "{125} {125}";
  24. 220 PRINT "{125} {125}";
  25. 230 PRINT "{125} {125}";
  26. 240 PRINT "{125} {125}";
  27. 250 PRINT "{125} {125}";
  28. 260 PRINT "{125} {125}";
  29. 270 PRINT "{125} {125}";
  30. 280 PRINT "{125} {125}";
  31. 290 PRINT "{125} {125}";
  32. 300 PRINT "{125} {125}";
  33. 310 PRINT "JFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFK";
  34. 320 poke 53287,1:poke 53288,1:poke 53269,255
  35. 330 poke 53289,1
  36. 340 xd=int(rnd(1)*2):yd=int(rnd(1)*2)
  37. 345 if xd=0 then xd=-1:if yd=0 then yd=-1
  38. 400 poke 53278,0:k=peek(203)
  39. 410 if k=9 and peek(53249)>100 then poke 53249,peek(53249)-5
  40. 420 if k=9 and peek(53251)<190 then poke 53251,peek(53251)+5
  41. 430 if k=13 and peek(53249)<190 then poke 53249,peek(53249)+5
  42. 440 if k=13 and peek(53251)>100 then poke 53251,peek(53251)-5
  43. 450 if peek(53252)=255 and peek(53264)=2 then gosub 700
  44. 455 if peek(53252)=0 and peek(53264)=6 then gosub 800
  45. 460 poke 53252,peek(53252)+xd:poke 53253,peek(53253)+yd
  46. 470 if peek(53279)<>0 and peek(53253)<100 then yd=-yd:poke 53253,peek(53253)+2
  47. 475 if peek(53252)<30 and peek(53264)=2 then goto 900
  48. 480 if peek(53279)<>0 and peek(53253)>200 then yd=-yd:poke 53253,peek(53253)-2
  49. 485 if peek(53252)>70 and peek(53264)=6 then goto 950
  50. 490 if peek(53278)>250 then goto 600
  51. 500 goto 400
  52. 600 xd=-xd
  53. 601 if xd<0 then poke 53252,peek(53252)-2
  54. 602 if xd>0 then poke 53252,peek(53252)+2
  55. 605 for l=54272 to l+24:poke l,0:next l
  56. 610 s=54272
  57. 620 for x=15 to 0 step -1
  58. 630 poke s+24,x
  59. 640 poke s+4,129
  60. 650 poke s+5,15
  61. 660 poke s+1,40
  62. 670 poke s,200:next x
  63. 680 poke s+4,125
  64. 690 poke s+5,0
  65. 699 goto 400
  66. 700 if xd>0 then poke 53264,6:poke 53252,0
  67. 790 return
  68. 800 if xd<0 then poke 53264,2:poke 53252,255
  69. 890 return
  70. 900 for n=631 to n+9:poke n,0:next n
  71. 905 poke 53269,0:?chr$(147):?"player 2 wins":?""
  72. 910 ?"press y to play again"
  73. 920 ?"any other key to quit"
  74. 930 a$="":get a$:if a$="" then goto 930
  75. 940 if a$="y" then goto 10
  76. 945 ?"thanks for playing, goodbye":end
  77. 950 for n=631 to n+9:poke n,0:next n
  78. 955 poke 53269,0:?chr$(147):?"player 1 wins":?""
  79. 960 ?"press y to play again"
  80. 970 ?"any other key to quit"
  81. 980 a$="":get a$:if a$="" then goto 930
  82. 990 if a$="y" then goto 10
  83. 995 ?"thanks for playing, goodbye":end
  84. 1000 REM Sprite data for bat (4 lines repeated)
  85. 1010 DATA 0,0,0,0,0,0,0,255,0,0,255,0,0,255,0,0
  86. 1020 DATA 255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255
  87. 1030 DATA 0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0
  88. 1040 DATA 0,255,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0
  89. 1050 DATA 0,0,0,0,0,0,0,255,0,0,255,0,0,255,0,0
  90. 1060 DATA 255,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255
  91. 1070 DATA 0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0
  92. 1080 DATA 0,255,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0
  93. 1100 REM Sprite data for ball
  94. 1110 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  95. 1120 DATA 0,0,0,0,0,0,60,0,0,126,0,0,255,0,0,255
  96. 1130 DATA 0,0,255,0,0,255,0,0,126,0,0,60,0,0,0,0
  97. 1140 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  98. 1150 return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement