home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 47 / 047.d81 / joystick (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  2KB  |  79 lines

  1. 1 poke88,.:poke89,192:poke90,.:poke91,192:poke781,33:poke782,.:sys41964
  2. 2 poke88,254:poke89,255:poke90,254:poke91,255:poke781,33:poke782,.:sys41964
  3. 3 poke59639,12:poke1,53
  4. 10 print"[147]            press 'q' to quit[158]"
  5. 15 :
  6. 16 :
  7. 17 rem       setup the sprite
  8. 25 v=53248
  9. 30 poke 53280,0:poke53281,0
  10. 40 fora=12288to12350:pokea,255:nexta
  11. 50 poke 2040,192:poke v+39,1:pokev+21,1
  12. 60 poke v,24:pokev+1,50:r=24:d=50
  13. 65 :
  14. 66 :
  15. 70 gosub850:rem one way to check the                  joystick (lines 850-895)
  16. 71 :
  17. 72 rem    another way to check the                joystick  (lines 73-560)
  18. 73 joy=peek(56320):fire=joyand16:          di=15-(joyand15)
  19. 74 if fire <> 16 thengosub730
  20. 75 ifpeek(203)=62then60000
  21. 76 if di=0 then 70
  22. 80 on di gosub150,200,250,300,350,400,450,500,550,560
  23. 90 goto 70
  24. 100 :
  25. 110 :
  26. 120 :
  27. 149 rem move the sprite in the direction               of the joystick
  28. 150 d=d-1:gosub600:pokev+1,d:return
  29. 155 :
  30. 200 d=d+1:gosub600:pokev+1,d:return
  31. 210 :
  32. 250 return
  33. 255 :
  34. 300 r=r-1:gosub600:pokev,r:return
  35. 310 :
  36. 350 r=r-1:d=d-1:gosub600:pokev+1,d:pokev,r:return
  37. 355 :
  38. 400 r=r-1:d=d+1:gosub600:pokev+1,d:pokev,r:return
  39. 410 :
  40. 450 return
  41. 455 :
  42. 500 r=r+1:gosub600:pokev,r:return
  43. 510 :
  44. 550 r=r+1:d=d-1:gosub600:pokev+1,d:pokev,r:return
  45. 555 :
  46. 560 r=r+1:d=d+1:gosub600:pokev+1,d:pokev,r:return
  47. 565 :
  48. 590 :
  49. 595 rem    keep sprite on screen
  50. 600 if d=251thend=0
  51. 610 if d=-1then d=250
  52. 620 if peek(v+16)=1then700
  53. 650 if r=-1 then pokev+16,peek(v+16)+1:r=88
  54. 655 if r=256 then r=0:pokev+16,peek(v+16)+1
  55. 660 return
  56. 700 if r=89 then poke v+16,peek(v+16)-1:r=0
  57. 710 if r=-1then poke v+16,peek(v+16)-1:r=255
  58. 720 return
  59. 730 c=c+1:ifc>15thenc=0
  60. 740 poke53280,c:poke53281,c:return
  61. 800 :
  62. 810 :
  63. 820 :
  64. 830 rem  another way to check joystick
  65. 850 joy=peek(56320)and15:ok=0
  66. 855 print"";:if(peek(56320)and16)=.thenprint"";
  67. 860 if (joyor14)<>15 then print"up",:ok=1
  68. 870 if (joyor07)<>15 then print"right",:ok=1
  69. 880 if (joyor13)<>15 then print"down",:ok=1
  70. 890 if (joyor11)<>15 then print"left",:ok=1
  71. 893 if (ok) then print
  72. 895 return
  73. 10000 :
  74. 20000 :
  75. 30000 rem    reconnect to loadstar
  76. 60000 open15,8,15,"r0:hello connect=hello connect":input#15,er:close15
  77. 60010 pokev+21,.:ifer<>63thenend
  78. 60020 poke1,55:load"hello connect",8
  79.