home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 59 / 059.d81 / bytes (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1989-01-01  |  3.3 KB  |  127 lines

  1. 10 rem keyboard and joystick driver demo
  2. 20 rem initialize variables
  3. 30 poke53280,0:poke53281,0:printchr$(147)chr$(14)chr$(8)
  4. 40 v=53248:speed=2
  5. 50 printtab(11)"[159][205]ousing [193]round [215]ith"
  6. 60 printtab(10)"[203]eyboard [193]nd [202]oystick"
  7. 70 cr$=""
  8. 80 dimm$(4):fori=1to4:readm$(i):next
  9. 90 data " [211]elect [202]oystick [196]river "
  10. 100 data " [211]elect [203]eyboard [196]river "
  11. 110 data " [211]prite [196]emo            "
  12. 120 data " [210]eturn to [204]oadstar     "
  13. 130 rem load sprite pointer definition
  14. 140 sa=832:hi=int(sa/256):lo=sa-hi*256
  15. 150 sys57812"mouse.spr",8,0
  16. 160 poke780,0:poke781,lo:poke782,hi:sys65493
  17. 170 sa=12288:hi=int(sa/256):lo=sa-hi*256
  18. 180 sys57812"demo.spr",8,0
  19. 190 poke780,0:poke781,lo:poke782,hi:sys65493
  20. 200 rem select input device
  21. 210 print""tab(6)"[208]lease select input device:"
  22. 220 printtab(14)"1] [202]oystick
  23. 230 [153][163]14)"2] (NULL)eyboard
  24. 240 getk$:ifk$=""then240
  25. 250 k=val(k$):ifk<>1andk<>2then240
  26. 260 dv=k
  27. 270 ifk=1then360
  28. 280 rem load keyboard driver
  29. 290 r=15:gosub1140
  30. 300 poke147,0:sys57812"key driver 64",8,1:sys62631:poke49175,speed
  31. 310 printtab(5)"[156][203]eyboard driver installed."
  32. 320 printtab(5)"[208]ress [210][197][212][213][210][206] to continue with demo."
  33. 330 getk$:ifk$<>chr$(13)then330
  34. 340 goto430
  35. 350 rem load joystick driver
  36. 360 r=15:gosub1190
  37. 370 poke147,0:sys57812"joy driver 64",8,1:sys62631:poke49175,speed
  38. 380 printtab(5)"[156][202]oystick driver installed."
  39. 390 printtab(5)"[208]ress [198][201][210][197] to continue with demo."
  40. 400 if(peek(56320)and31)<>15then400
  41. 410 :
  42. 420 rem menu demo
  43. 430 print"[147]":printtab(15)"[159][205]enu [196]emo"
  44. 440 rem set up pointer sprite
  45. 450 pokev,50:pokev+16,0:pokev+1,100
  46. 460 pokev+39,1
  47. 470 poke2040,832/64
  48. 480 pokev+21,1
  49. 490 sys49155:rem activate driver
  50. 500 print""tab(7)"[176][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][174]"
  51. 510 fori=1to4:printtab(7)"[221]";m$(i);"[146][221]":next
  52. 520 printtab(7)"[173][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][189]"
  53. 530 r=15:ondvgosub1190,1140
  54. 540 y1=7
  55. 550 rem check pointer location
  56. 560 getk$
  57. 570 x=int((peek(v)+(peek(v+16)and1)*256-24)/8)
  58. 580 y=int((peek(v+1)-50)/8)
  59. 590 ifx<8orx>31thenprintleft$(cr$,y1+1)tab(8)"[159]"m$(y1-5):goto560
  60. 600 ify<6ory>9thenprintleft$(cr$,y1+1)tab(8)"[159]"m$(y1-5):goto560
  61. 610 ify1<>ythenprintleft$(cr$,y1+1)tab(8)"[159]"m$(y1-5)
  62. 620 printleft$(cr$,y+1)tab(8)"[156]"m$(y-5):y1=y
  63. 630 ifdv=1thenif(peek(56320)and31)<>15then560
  64. 640 ifdv=2thenifk$<>chr$(13)then560
  65. 650 ony-5goto680,750,820,1020
  66. 660 :
  67. 670 rem load joystick driver
  68. 680 sys49158
  69. 690 poke147,0:sys57812"joy driver 64",8,1:sys62631:poke49175,speed
  70. 700 sys49155
  71. 710 r=15:gosub1190:dv=1
  72. 720 goto560
  73. 730 :
  74. 740 rem load keyboard driver
  75. 750 sys49158
  76. 760 poke147,0:sys57812"key driver 64",8,1:sys62631:poke49175,speed
  77. 770 sys49155
  78. 780 r=15:gosub1140:dv=2
  79. 790 goto560
  80. 800 :
  81. 810 rem sprite demo
  82. 820 print"[147]":printtab(15)"[211]prite [196]emo"
  83. 830 fori=0to3:poke2041+i,192+i:next
  84. 840 fori=0to3:pokev+40+i,i+2:next
  85. 850 pokev+16,0
  86. 860 fori=2to8step2:pokev+i,100+i*15:next
  87. 870 fori=3to9step2:pokev+i,150:next
  88. 880 pokev+21,31:r=20:ondvgosub1190,1140
  89. 890 sp=0
  90. 900 rem check for sprite collision
  91. 910 getk$:ifk$=chr$(13)then930
  92. 920 if(peek(56320)and31)<>15thenx=peek(v+30):goto890
  93. 930 x=peek(v+30)-1
  94. 940 ifx>0thensp=log(x)/log(2)
  95. 950 ifsp=0then910
  96. 960 ifsp=4then430
  97. 970 co=peek(v+39+sp)+1:ifco>255thenco=1
  98. 980 pokev+39+sp,co
  99. 990 goto890
  100. 1000 :
  101. 1010 rem return to loadstar
  102. 1020 printleft$(cr$,20)tab(10)"[193]re you sure? [y/n]"
  103. 1025 sys49158:rem turn off driver
  104. 1030 getk$:ifk$=""then1030
  105. 1040 ifk$="y"then1050
  106. 1045 printleft$(cr$,20)tab(10)"                   ":sys49155:goto560
  107. 1050 pokev+21,0:rem turn off sprites
  108. 1060 sys49158:rem turn off driver
  109. 1070 open15,8,15,"r0:hello connect=hello connect"
  110. 1080 input#15,er%:close15
  111. 1090 ifer%<>63thenprint"[147]":end
  112. 1100 poke646,peek(53281):print"[147]load"chr$(34)"hello connect"chr$(34)",8"
  113. 1110 print"run"
  114. 1120 poke631,13:poke632,13:poke633,13:poke198,3:end
  115. 1130 :
  116. 1140 printleft$(cr$,r);
  117. 1150 printtab(5)"[158][213]se cursor keys to move pointer"
  118. 1160 printtab(5)"and [210][197][212][213][210][206] to make your choice."
  119. 1170 return
  120. 1180 :
  121. 1190 printleft$(cr$,r);
  122. 1200 printtab(5)"[158][213]se joystick to move pointer.  "
  123. 1210 printtab(5)"[208]ress [198][201][210][197] to make your choice."
  124. 1220 return
  125. 1230 :
  126. 1240 open15,8,15,"s0:mouse demo":close15:save"mouse demo",8
  127.