home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 76 / 076.d81 / bits (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  3KB  |  86 lines

  1. 5 rem *** demo program for mr joystick ***
  2. 10 sys57812"mrj49152",8,1:sys62631
  3. 20 sys49152,"abcdefghij"
  4. 100 gosub3000
  5. 110 print"this program starts with the line:":printchr$(142)""
  6. 120 print"10 poke147,0:sys57812";chr$(34);"mrj49152";chr$(34);","
  7. 130 print"8,1:sys62631":print
  8. 140 print"this loads mr joystick.  the program"
  9. 150 print"is activated by the line:":print
  10. 160 print"20 sys49152,";chr$(34);"abcdefghij";chr$(34):print
  11. 170 print"insert the joystick into either port"
  12. 180 print"and experiment by moving the joystick"
  13. 190 print"and pressing the fire button":print
  14. 200 print"...then try the other port!"
  15. 210 gosub2000:gosub3000
  16. 220 print"the first 5 characters of the string"
  17. 230 print"passed to mr joystick indicate"
  18. 240 print"which characters to use for port 1,"
  19. 250 print"while the second 5 are the return"
  20. 260 print"characters for port 2.  (if only"
  21. 270 print"5 characters are given, they are"
  22. 280 print"used for both ports.)":print
  23. 290 print"the first character of each group is"
  24. 300 print"the return value for the fire button."
  25. 310 print"the remaining characters, in order,"
  26. 320 print"are the return values for up, down,"
  27. 330 print"left, and right."
  28. 340 gosub2000:gosub3000
  29. 350 sys49152,"f"+chr$(145)+chr$(17)+chr$(157)+chr$(29)
  30. 360 print"we can change these return values by"
  31. 370 print"a second sys to 49152:":print
  32. 380 print"sys49152,";chr$(34);"f";chr$(34);"+chr$(145)+chr$(17)+"
  33. 390 print"chr$(157)+chr$(29)":print
  34. 400 print"with these values, both joysticks act"
  35. 410 print"like the cursor keys (the fire"
  36. 420 print"buttons return 'f')."
  37. 430 gosub2000:gosub3000
  38. 440 print"you may have noticed that only one"
  39. 450 print"character is generated, no matter how"
  40. 460 print"long you keep the joystick in one"
  41. 470 print"direction.  by default, mr joystick"
  42. 480 print"will not auto-repeat.  however, by"
  43. 490 print"passing additional parameters after"
  44. 500 print"the string, auto-repeat will be"
  45. 510 print"enabled.  the first number gives the"
  46. 520 print"number of jiffies before the fire"
  47. 530 print"button should repeat, the second"
  48. 540 print"gives the repeat rate.  the third and"
  49. 550 print"fourth numbers (if present), give the"
  50. 560 print"delay and repeat rates for the"
  51. 570 print"direction characters (i.e. 'up')."
  52. 580 print"we have now recalled 49152 as follows":print
  53. 590 print"sys49152,";chr$(34);"fudlr";chr$(34);",10,4,20,5"
  54. 600 sys49152,"fudlr",10,4,20,5:gosub2000:gosub3000:sys49155
  55. 610 print"[154](s[154])ee demo again"
  56. 620 print"(r[154])eturn to loadstar"
  57. 630 geta$:ifa$<>"s"anda$<>"r"then630
  58. 640 ifa$="s"then20
  59. 650 goto60000
  60. 2000 rem *** run keyboard ***
  61. 2010 print"[154][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][192][192][174]   [158]press[154]"
  62. 2020 print"[221][155]abcdefghijklmnopqrstuvwxyz[154][221]  [158][return][154]"
  63. 2030 print"[221][155]  0123456789 up dn lf rt  [154][221]     [158]to[154]"
  64. 2040 print"[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][192][192][189]  [158]continue[154]"
  65. 2050 geta$:ifa$=""then2050
  66. 2060 a=asc(a$):ifa>64anda<91thenl=55272+a:r=l:goto2140
  67. 2070 ifa>47anda<58thenl=55331+a:r=l:goto2140
  68. 2080 ifa=17thenl=55393:r=l+1:goto2140
  69. 2090 ifa=29thenl=55399:r=l+1:goto2140
  70. 2100 ifa=145thenl=55390:r=l+1:goto2140
  71. 2110 ifa=157thenl=55396:r=l+1:goto2140
  72. 2120 ifa=13thenreturn
  73. 2130 goto2050
  74. 2140 pokel,1:poker,1:fori=0to100:next:pokel,15:poker,15:goto2050
  75. 3000 rem *** draw frame ***
  76. 3010 poke53280,0:poke53281,0
  77. 3020 print"[147][150][213][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][201]"
  78. 3030 fori=6to24:print"[221]                                     [221]":next
  79. 3040 print"[202][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][203]";:return
  80. 10000 open15,8,15,"s0:bits":close15:save"bits",8:end
  81. 60000 a$="hello connect":open15,8,15,"r0:"+a$+"="+a$:input#15,er:close15
  82. 60010 if er<>63 then print"[147]":end
  83. 60011 q$=chr$(34):print"[147]":poke646,peek(53281)
  84. 60020 print"load"q$a$q$",8"
  85. 60030 poke631,13:poke632,82:poke633,213:poke634,58:poke635,13:poke198,5:end
  86.