home *** CD-ROM | disk | FTP | other *** search
/ Go64! / Go64_2000-06_2000_CSW_Side_A.d64 / audio (.txt) next >
Commodore BASIC  |  2023-02-26  |  9KB  |  294 lines

  1. 1000 rem ------------------------------
  2. 1010 rem scsi listing4
  3. 1011 rem original by achim taege   1997
  4. 1012 rem adapted for c64 and modified
  5. 1013 rem          by torsten baade 2000
  6. 1014 rem email:torsten@sport-moeller.de
  7. 1015 rem          v1.10      07/24/2000
  8. 1020 rem ------------------------------
  9. 1060 print chr$(147);chr$(14)                :rem clr sreen & s/b
  10. 1070 bd=peek(186):rem current floppy
  11. 1080 dim pu(9),td(36,7),pe%(512)
  12. 1090 bl=2352:rem length of audioblock                    =1/75 sec
  13. 1100 sk=0   :rem sessionnumber
  14. 1110 :
  15. 1120 mh=48:ml=0: rem h- & l-byte of scsi buffer
  16. 1130 dp=48*256: rem scsi data buffer
  17. 1140 z$="----------------------------------------"
  18. 1150 l$="                                      "
  19. 1190 goto 60000 :rem to main program
  20. 2000 rem - scsi-command: inquiry 6 byte
  21. 2010 sc$=chr$(18)+chr$(lu*32)+chr$(0)+chr$(0)+chr$(32)+chr$(0)
  22. 2020 gosub 4000:return:rem send command
  23. 2030 :
  24. 2040 rem ---------- scsi-kommando  test unit ready 6 byte ---
  25. 2050 sc$=chr$(0)+chr$(lu*32)+chr$(0)+chr$(0)+chr$(0)+chr$(0)
  26. 2060 gosub 4000:return:rem send command
  27. 2070 :
  28. 2400 rem ---------- scsi-kommando read toc 10 byte ----------
  29. 2410 sc$=chr$(67)+chr$(lu*32+2)+chr$(0)+chr$(0)+chr$(0)
  30. 2420 sc$=sc$+chr$(0)+chr$(0)+chr$(int(bl/256))+chr$(bl and 255)+chr$(0)
  31. 2430 gosub 4000
  32. 2440 if fe<>0 then 2600:                     rem else read titles
  33. 2450 ii=1:rem  sufficient for 36 titles
  34. 2460 :open 15,dv,15
  35. 2470 :for b=0 to ii
  36. 2480 : print#15,"m-r"chr$(ml)chr$(mh+b)chr$(0)
  37. 2490 : for i=0 to 255:get#15,b$:pe%(b*256+i)=asc(b$+chr$(0)):next
  38. 2500 :next
  39. 2510 :close15
  40. 2520 tn=pe%(0)*256+pe%(1):                   rem lenght of toc
  41. 2530 fk=pe%(2) :rem first title
  42. 2540 lk=pe%(3) :rem last  title
  43. 2550 for i=fk-1 to lk:print         :        rem read start and end time
  44. 2560 : for ii=0 to 7 :                       rem 8 byte per title
  45. 2570 :  td(i,ii)=pe%(4+(i*8)+ii)
  46. 2580 : next
  47. 2590 :next
  48. 2600 :
  49. 2610 return
  50. 2620 :
  51. 2700 rem ---------- play mfs ----------------------------------------
  52. 2710 sc$=chr$(71)+chr$(lu*32)+chr$(0)
  53. 2720 sc$=sc$+chr$(td(nr,5))+chr$(td(nr,6))+chr$(td(nr,7))
  54. 2730 sc$=sc$+chr$(mm)+chr$(ss)+chr$(dd)+chr$(0)
  55. 2740 gosub 4000:return:rem send command
  56. 2750 :
  57. 2800 rem ---------- read subchannel ---------------------------------
  58. 2801 print "[212]itle number >                     [157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157][157]";t
  59. 2802 pa=td(nr,5)*4500+td(nr,6)*75+td(nr,7):pe=mm*4500+ss*75+dd
  60. 2803 pg=(pe-pa)/4500:a=pg:gosub3600
  61. 2804 print l$:print "[145][212]itle length > ";a$:a$=""
  62. 2805 print l$: print l$: print l$
  63. 2806 print "[145][145][212]ime         > "
  64. 2807 print "[210]emaining    > "
  65. 2810 sc$=chr$(66)+chr$(lu*32+2)+chr$(64)+chr$(1)
  66. 2820 sc$=sc$+chr$(0)+chr$(0)+chr$(0)+chr$(0)
  67. 2830 sc$=sc$+chr$(15)+chr$(0)
  68. 2835 tf=0
  69. 2840 gosub 4000 :rem send command
  70. 2845 if fe>0 then tf=1:return                 :rem device not ready
  71. 2850 open 15,dv,15
  72. 2860 :print#15,"m-r"chr$(ml)chr$(mh)chr$(15)
  73. 2870 :for i=0 to 14:get#15,b$
  74. 2872 pe%(i)=asc(b$+chr$(0))
  75. 2875 next
  76. 2880 close15
  77. 2890 :
  78. 2900 pp=(pe%(13)*4500+pe%(14)*75+pe%(15))/4500+0.004
  79. 2910 a=pp:gosub 3600
  80. 2920 print "[145][145]      [157][157][157][157][157][157][157]";a$:a$=""
  81. 2925 a=pg-pp:gosub 3600
  82. 2930 print "      [157][157][157][157][157][157][157]";a$:a$=""
  83. 2940 :
  84. 2950 x$="":get x$
  85. 2960 if x$="_" then t=lk+1:goto 2990:rem lk+1 = cancel
  86. 2970 if x$="+" then 2990                     :rem next titel
  87. 2972 if x$="-"then t=t-2-(t=1):goto 2990     :rem previous titel
  88. 2980 if pe%(1)<>21 then 2840                 :rem 21 = title end
  89. 2990 return
  90. 2995 :
  91. 3100 rem --------- start / stop unit -------------------------------
  92. 3110 sc$=chr$(27)+chr$(lu*32)+chr$(0)+chr$(0)+chr$(0)+chr$(0)
  93. 3120 gosub 4000
  94. 3130 :
  95. 3500 rem ---------- mfs to lbn -------------------------------------
  96. 3510 bn=td(t,5)*4500+td(t,6)*75+td(t,7)-150
  97. 3520 return
  98. 3530 :
  99. 3540 rem ---------- lbn to mfs -------------------------------------
  100. 3550 bn=bn+150:mm=int(bn/4500):ss=int((bn-mm*4500)/75)
  101. 3560 dd=bn-mm*4500-ss*75
  102. 3570 return
  103. 3580 :
  104. 3600 rem ------------- 1/100 min to sec
  105. 3610 b=int(a)
  106. 3620 c=(a-b)*60/100
  107. 3630 c=int(c*100)
  108. 3640 a$=right$(str$(b),2)+":"+right$("0"+mid$(str$(c),2),2)
  109. 3650 return
  110. 4000 rem ---------- scsi-kommando request sense 6 byte ------
  111. 4010 gosub 4110
  112. 4015 return
  113. 4020 rem request sense makes no sence        for audio cd
  114. 4030 :
  115. 4110 rem ---------- send scsi-kommando -----------------------------
  116. 4120 gosub 4160
  117. 4130 if fe>0 then gosub 4160
  118. 4140 return
  119. 4150 :
  120. 4160 open 15,dv,15
  121. 4170 :print#15,"s-c"+chr$(id)chr$(ml)chr$(mh)sc$   :rem send command
  122. 4180 get#15,fe$
  123. 4182 if fe$="" then fe=0:goto4190
  124. 4185 fe=asc(fe$)
  125. 4190 close 15
  126. 4200 return
  127. 4210 :
  128. 5000 rem -------------- scann cbm-bus for cmd-hd ------------------
  129. 5010 print "[211]earching for [195][205][196]-[200][196]"
  130. 5020 :
  131. 5030 for ga=8 to 30                    :rem test drives 8 - 30
  132. 5040 : open 15,ga,15                   :rem open drive and close immediately
  133. 5050 : close 15                        :rem for setting st
  134. 5060 : if st=-128 then 5170            :rem st=-128 : device not present
  135. 5070 :  open 15,ga,15                  :rem st=0 drive enabled
  136. 5080 :  print#15,"ui"                  :rem send reset
  137. 5090 :  input#15,fe,fe$                :rem read error # and string
  138. 5100 :  close 15
  139. 5110 if left$(fe$,6)<>"cmd hd" then fe=1:goto5170
  140. 5120 :   dv=ga                         :rem cmd-hd found
  141. 5130 :   ga=30:fe=0                    :rem cose for-next loop
  142. 5140 :   print "[195][205][196]-[200][196] is drive #";dv;"[146]":print
  143. 5170 next
  144. 5180 return
  145. 5190 :
  146. 5200 rem --------------- scann scsi-bus for scsi-device --------------------
  147. 5210 print "[211]earching for [211][195][211][201]-devices"
  148. 5220 dp=48*256                      :rem scsi datenpuffer
  149. 5230 mh=48:ml=0  :rem init h.byte and                    l.byte of scsi buffer
  150. 5250 sd=0:sl=0                         :rem init scsi id and lun
  151. 5260 id=sd:lu=sl
  152. 5270 gosub 2000 :rem inquiry
  153. 5280 if fe<>0 then 5570 :rem read 1byte from buffer
  154. 5290 open 15,dv,15,"m-r"+chr$(ml)+chr$(mh)+chr$(1)
  155. 5300 get#15,ty$:rem scsi device class
  156. 5302 if ty$=""then ty=0:goto 5305
  157. 5303 ty=(asc(ty$) and 31)
  158. 5305 : close 15
  159. 5310 : if ty<>5 then 5570 :rem cd/drive not found
  160. 5510 :  lu=sl:id=sd:sl=7:sd=8
  161. 5570 :sl=sl+1:if sl=8 then sl=0:sd=sd+1
  162. 5575 print".";
  163. 5580 if sd<8 then 5260
  164. 5585 print
  165. 5590 return
  166. 5600 :
  167. 6000 rem -------------- clr screen
  168. 6010 poke53280,6:poke53281,11
  169. 6020 print "[147]     [195][196]-[193]udio-[208]layer by [193]chim [212]aege"
  170. 6030 print "    adapted for [195]64 by [212]orsten [194]aade[153]"
  171. 6050 print z$
  172. 6060 print"[215]hile playing please choose:"
  173. 6062 print"     +[146][153] - next title
  174. 6063 [153]"     -waitprint - previous title
  175. 6065 print"     _[146][153] - quit playing
  176. 6080 [142]
  177. 6100 [143] ------------- akt screen
  178. 6110 [153]"";
  179. 6120 [153] "(NULL)tatus       >                     cmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmdcmd";"";ts$;"print"
  180. 6130 [142]
  181. 6200 [143] ------------- init screen
  182. 6210 fe[178]0:pu[178]pu(0)
  183. 6220 [141] 6000:[141] 6100
  184. 6230 [142]
  185. 6240 :
  186. 7000 [143] -------- scan for hd and cd rom
  187. 7010 [143] dummy
  188. 7011 [143] ^^^ delete line 7010 for a new      search for device numbers
  189. 7030 [141] 5000: [143] scan cbm-bus
  190. 7040 [139] fe[178]0 [167] 7070
  191. 7050 [153]"(NULL)orry, no left$str$ found..."
  192. 7060 [128]
  193. 7070 [141] 5200: [143] scan scsi-bus
  194. 7080 [153]"(NULL)len(NULL)right$-right$str$ is ";id;"wait, (NULL)(NULL)(NULL) is ";lu"wait"
  195. 7100 [153]"(NULL)his program is self modifying."
  196. 7105 [153]"right$f you are pressing _wait then a new
  197. 7110 print"program called 'audio cd player' will be";
  198. 7111 print"stored on disc that contains all device
  199. 7115 [153]"numbers. (NULL)ext time load this proggy and
  200. 7120 print"you don't have to wait for finding the
  201. 7125 [153]"drives again. right$f you need a new search,
  202. 7130 print"delete line 7010 and [210][213][206] the program."
  203. 7135 print"[194][212][215]: any other key has no effect :-)
  204. 7150 [161] a$: [139] a$[178]"" [167] 7150
  205. 7180 [139] a$[178]"_" [167] 7200
  206. 7190 [142]
  207. 7200 [143] self modification
  208. 7210 [159]15,bd,15,"s:audio cd player":[160]15:[143] delete old file
  209. 7220 [153]
  210. 7225 [153]"7010 dv=";dv;":id=";id;":lun=";lu;":return"
  211. 7230 [153]"save"[170][199](34)[170]"audio cd player"[170][199](34)[170]","[170][196](bd)
  212. 7240 [153]"runononononon"
  213. 7250 [151]631,13:[151]632,13:[151]633,145:[151]634,145:[151]635,145:[151]636,13
  214. 7260 [151] 198,6                        :[143] 3*return + 2*^ to key buffer
  215. 7290 [128]
  216. 7500 [143] ------- input subtitute
  217. 7510 [151]204,0:[143] cursor
  218. 7520 [161]a$: [139] a$[178]"" [167] 7520
  219. 7530 wa$[178]a$
  220. 7540 [139] [197](a$)[178]0 [167] 7595:[143]              alphanumeric or 0
  221. 7545 [153] a$;
  222. 7550 [161] a$: [139] a$[178]"" [167] 7550
  223. 7560 [139] [198](a$)[178]13 [167] 7595
  224. 7570 [139] [198](a$)[179]48 [176] [198](a$)[177]57 [167] 7550:[143] no number
  225. 7580 wa$[178]wa$[170]a$
  226. 7590 [137] 7545
  227. 7595 [151]204,1:[142]
  228. 60000 [143] ---------- main program
  229. 60010 [141] 7000:[143] scan for hd and cd-rom
  230. 60050 ts$[178]"(NULL)lease insert a lenstr$":[141] 6200                   :[143] init screen
  231. 60060 fe[178]8
  232. 60070 :
  233. 60080 :  [141] 2040                :[143] test unit ready
  234. 60090 :  [141] 6100
  235. 60100 [139] fe[177]0 [137] 60070
  236. 60120 ts$[178]"(NULL)eading (NULL)(NULL)len":[141] 6100
  237. 60130 [141] 2400                   :[143] read toc
  238. 60140 ts$[178]"(NULL)lease choose :":[141] 6100
  239. 60150 [129]i[178]0[164]5:[153]l$:[130]:[153]"onononononon";
  240. 60155 [153]"     pwait - start lenstr$ and exit
  241. 60156 print"     r[146] - random play
  242. 60157 [153]"     _wait - exit programonononon"
  243. 60160 [153] "     awaitll or title";fk;"-";lk;"> ";:[141] 7500
  244. 60170 [139] wa$[178]"a" [167] [141] 60500
  245. 60180 [139] wa$[178]"_"[167] [141]3100:[153]"":[128]
  246. 60185 [139] wa$[178]"r" [167] [141] 60800: [143]        random play
  247. 60190 [139] wa$[178]"p"[167] [141]60700:[153]"":[128]:[143] play and exit prog
  248. 60200 [139] tf[178]1 [167] tf[178]0: [137] 60050:           [143] error while playing
  249. 60210 t[178][197](wa$)
  250. 60220 [139] t[179]fk [176] t[177]lk [167] 60140
  251. 60230 [141] 3500:bn[178]bn[171]1:[141] 3540:nr[178]t[171]1:[141] 2700
  252. 60240 ts$[178]"(NULL)laying":[141] 6100
  253. 60250 [141] 2800
  254. 60260 [141] 3100
  255. 60265 [139] tf[178]1 [167] 60050
  256. 60266 [139] pe%(1)[178]21 [167] 60140:                [143] new title
  257. 60267 t[178]t[170]1:[139] t[179]lk[170]1 [167] 60230:               [143] next/previous title
  258. 60270 [137] 60140
  259. 60500 [143] --------------- play all
  260. 60510 [129] t[178]fk [164] lk
  261. 60520 [141] 3500:[143] lbn for title end
  262. 60530 bn[178]bn[171]1  :[143] lbn of title end
  263. 60540 [141] 3540:[143] change lbn to mfs
  264. 60550 nr[178]t[171]1 :[143] count from 0
  265. 60560 [141] 2700 :[143] start playing
  266. 60570 ts$[178]"(NULL)laying all":[141] 6100
  267. 60580 :
  268. 60590 [141] 2800                       :[143] read subcannel till title end
  269. 60600 [139] tf[178]1 [167] t[178]lk[170]1: [143]                error while playing -> exit
  270. 60610 [130]
  271. 60620 [141] 3100               :[143] stop unit
  272. 60630 [142]
  273. 60700 [143] --- play entire cd
  274. 60710 t[178]lk:[143] last title
  275. 60720 [141]3500: [143] lbn of title end
  276. 60730 bn[178]bn[171]1
  277. 60740 [141]3540: [143] lbn -> mfs
  278. 60750 nr[178]fk[171]1: [143] start at first title
  279. 60760 [141]2700: [143] start playing
  280. 60770 [142]
  281. 60800 [143] ------------- random play
  282. 60805 t[178][187]([171]ti)
  283. 60810 t[178][181]((lk[171]fk[170]1)[172][187](ti)[170]fk)
  284. 60820 [141] 3500:[143] lbn for title end
  285. 60830 bn[178]bn[171]1  :[143] lbn of title end
  286. 60840 [141] 3540:[143] change lbn to mfs
  287. 60850 nr[178]t[171]1 :[143] count from 0
  288. 60860 [141] 2700 :[143] start playing
  289. 60870 ts$[178]"(NULL)andom play":[141] 6100
  290. 60880 [141] 2800                       :[143] read subcannel till title end
  291. 60890 [139]([168](x$[178]"_")[175](tf[178]0))[167] 60810
  292. 60895 [141] 3100        :[143] stop unit
  293. 60899 [142]
  294.