Music.asm 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734
  1. include_macros equ 1
  2. include_deb_mac equ 1
  3. include_flags equ 1
  4. include_error_codes equ 1
  5. include include.asm
  6. music_base_file equ 60200
  7. files_per_section equ 4
  8. rl_mboard_offset equ 0
  9. rl_max_music_size equ 62000
  10. rl_max_fx_size equ 150000
  11. sb_mboard_offset equ 2
  12. sb_max_music_size equ 56000
  13. sb_max_fx_size equ 217000
  14. sfxf_start_delay equ 80h
  15. sfxf_save equ 20h
  16. start32data
  17. extrn __x386_zero_base_selector:word ;data selector
  18. extrn code16_seg:word
  19. extrn _force_roland:dword
  20. driver_add dd ? ;32 bit address of driver
  21. driver_seg dw ? ;real mode segment of driver
  22. fx_add dd ? ;32 bit address of fx
  23. fx_seg dw ? ;real mode segment of fx
  24. voc_work_space dd ? ;32 bit pointer to 64k voc buffer
  25. voc_fx_space dd ? ;32 bit pointer to 64k voc buffer
  26. voc_work_seg dw ? ;real mode segment of voc buffer
  27. voc_fx_seg dw ? ;real mode segment of voc buffer
  28. align 4
  29. mboard_offset dd 0 ;0 = roland, 2 = adlib
  30. max_music_size dd 0
  31. max_fx_size dd 0
  32. current_music dd -1 ;music currently playing
  33. adlibflag2 db 0
  34. rolandflag2 db 0
  35. tandyflag2 db 0
  36. sblflag2 db 0
  37. portaddress dw 0C0h ; tandy sound IO port address
  38. ALport dw 388h ; AdLib Port Address (may change)
  39. cfg_ports dw 0,220h,240h,260h,280h
  40. cfg_irq db 7,2,5,7,10
  41. cfg_dma db 1,0,1,2,3,4,5,6,7
  42. align 4
  43. fx_vol_0x db ? ;store for current fx volumes
  44. fx_vol_1x db ?
  45. align 4
  46. ; Special music data
  47. stfx_cur_snd dd ? ;stores for fx being processed
  48. stfx_cur_chn dd ?
  49. music_list dd fx_press_bang ;256 banging of the press
  50. dd fx_press_hiss ;257 hissing press
  51. dd fx_wind_howl ;258 howling wind
  52. dd fx_spanner_clunk ;259 spanner in works
  53. dd fx_reichs_fish ;260 Reichs fish
  54. dd fx_explosion ;261 panel blows open
  55. dd fx_wind_3 ;262 single steam
  56. dd fx_open_door ;263 general open door
  57. dd fx_open_lamb_door ;264 lamb door opens
  58. dd fx_comp_bleeps ;265 scanner bleeps
  59. dd fx_helmet_down_3 ;266
  60. dd fx_helmet_up_3 ;267
  61. dd fx_helmet_grind ;268
  62. dd fx_lift_close_29 ;269 rm 29 lift closes
  63. dd fx_lift_open_29 ;270 rm 29 lift opens
  64. dd fx_computer_3 ;271 rm 29 lift arrives
  65. dd fx_level_3_ping ;272 background noise in room 4
  66. dd fx_lift_alarm ;273 loader alarm
  67. dd fx_null ;274 furnace room background noise
  68. dd fx_rm3_lift_moving ;275 lift moving in room 3
  69. dd fx_lathe ;276 jobsworth lathe
  70. dd fx_factory_sound ;277 factory background sound
  71. dd fx_weld ;278 do some welding
  72. dd fx_lift_close_7 ;279 rm 7 lift closes
  73. dd fx_lift_open_7 ;280 rm 7 lift opens
  74. dd fx_lift_arrive_7 ;281 rm 7 lift arrives
  75. dd fx_lift_moving ;282 lift moving
  76. dd fx_scanner ;283 scanner operating
  77. dd fx_force_fire_door ;284 Force fire door open
  78. dd fx_null ;285 General door creak
  79. dd fx_phone ;286 telephone
  80. dd fx_lazer ;287 lazer
  81. dd fx_lazer ;288 lazer
  82. dd fx_anchor_fall ;289 electric ;not used on amiga
  83. dd fx_weld12 ;290 welding in room 12 (not joey)
  84. dd fx_hello_helga ;291 helga appears
  85. dd fx_byee_helga ;292 helga disapears
  86. dd fx_null ;293 smash through window ;doesn't exist
  87. dd fx_pos_key ;294
  88. dd fx_neg_key ;295
  89. dd fx_s2_helmet ;296 ;helmet down section 2
  90. dd fx_s2_helmet ;297 ; " up " "
  91. dd fx_lift_arrive_7 ;298 ;security door room 7
  92. dd fx_null ;299
  93. dd fx_rope_creak ;300
  94. dd fx_crowbar_wooden ;301
  95. dd fx_fall_thru_box ;302
  96. dd fx_use_crowbar_grill ;303
  97. dd fx_use_secateurs ;304
  98. dd fx_grill_creak ;305
  99. dd fx_timber_cracking ;306
  100. dd fx_masonry_fall ;307
  101. dd fx_masonry_fall ;308
  102. dd fx_crowbar_plaster ;309
  103. dd fx_prise_brick ;310
  104. dd fx_brick_hit_foster ;311
  105. dd fx_spray_on_skin ;312
  106. dd fx_hit_crowbar_brick ;313
  107. dd fx_drop_crowbar ;314
  108. dd fx_fire_crackle_in_pit ;315
  109. dd fx_remove_bar_grill ;316
  110. dd fx_liquid_bubble ;317
  111. dd fx_liquid_drip ;318
  112. dd fx_guard_fall ;319
  113. dd fx_sc74_pod_down ;320
  114. dd fx_hiss_in_nitrogen ;321
  115. dd fx_null ;322
  116. dd fx_hit_joey1 ;323
  117. dd fx_hit_joey2 ;324
  118. dd fx_medi_stab_gall ;325
  119. dd fx_gall_drop ;326
  120. dd fx_null ;327
  121. dd fx_null ;328
  122. dd fx_null ;329
  123. dd fx_big_tent_gurgle ;330
  124. dd fx_null ;331
  125. dd fx_orifice_swallow_drip ;332
  126. dd fx_brick_hit_plank ;333
  127. dd fx_goo_drip ;334
  128. dd fx_plank_vibrating ;335
  129. dd fx_splash ;336
  130. dd fx_buzzer ;337
  131. dd fx_shed_door_creak ;338
  132. dd fx_dog_yap_outdoors ;339
  133. dd fx_dani_phone_ring ;340
  134. dd fx_locker_creak_open ;341
  135. dd fx_judges_gavel1 ;342
  136. dd fx_dog_yap_indoors ;343
  137. dd fx_brick_hit_plank ;344
  138. dd fx_brick_hit_plank ;345
  139. dd fx_shaft_industrial_noise ;346
  140. dd fx_judges_gavel2 ;347
  141. dd fx_judges_gavel3 ;348
  142. dd fx_elevator_4 ;349
  143. dd fx_lift_closing ;350
  144. dd fx_null ;351
  145. dd fx_null ;352
  146. dd fx_sc74_pod_down ;353
  147. dd fx_null ;354
  148. dd fx_null ;355
  149. dd fx_heartbeat ;356
  150. dd fx_star_trek_2 ;357
  151. dd fx_null ;358
  152. dd fx_null ;359
  153. dd fx_null ;350
  154. dd fx_null ;361
  155. dd fx_null ;362
  156. dd fx_null ;363
  157. dd fx_null ;364
  158. dd fx_null ;365
  159. dd fx_break_crystals ;366
  160. dd fx_disintegrate ;367
  161. dd fx_statue_on_armour ;368
  162. dd fx_null ;369
  163. dd fx_null ;360
  164. dd fx_ping ;371
  165. dd fx_null ;372
  166. dd fx_door_slam_under ;373
  167. dd fx_null ;374
  168. dd fx_null ;375
  169. dd fx_null ;376
  170. dd fx_null ;377
  171. dd fx_null ;378
  172. dd fx_null ;379
  173. dd fx_steam1 ;380
  174. dd fx_steam2 ;381
  175. dd fx_steam2 ;382
  176. dd fx_steam3 ;383
  177. dd fx_null ;384
  178. dd fx_null ;385
  179. dd fx_fact_sensor ;386 Sensor in Potts' room
  180. dd fx_null ;387
  181. dd fx_null ;388
  182. dd fx_null ;389
  183. dd fx_null ;390
  184. dd fx_null ;391
  185. dd fx_null ;392
  186. dd fx_null ;393
  187. dd fx_25_weld ;394 my anchor weld bodge
  188. max_fx_number equ 393
  189. ; Non-existant effect
  190. fx_null db 0 ;fx no
  191. db 0 ;flags
  192. db 200,127,127 ;room,volume (adlib / roland)
  193. db -1
  194. fx_level_3_ping db 1
  195. db 0
  196. db 28,63,63
  197. db 29,63,63
  198. db 31,63,63
  199. db -1
  200. fx_factory_sound db 1 ;fx no
  201. db sfxf_save ;flags
  202. db -1,30,30 ;room,volume (adlib / roland)
  203. fx_crowbar_plaster db 0 dup (0)
  204. fx_masonry_fall db 1 ;fx no
  205. db 0 ;flags
  206. db -1,127,127 ;room,volume (adlib / roland)
  207. fx_prise_brick db 0 dup (0)
  208. fx_rope_creak db 2 ;fx no
  209. db 0 ;flags
  210. db -1,127,127 ;room,volume (adlib / roland)
  211. fx_ping db 0 dup (0)
  212. fx_force_fire_door db 3
  213. db 0
  214. db -1,127,127
  215. fx_brick_hit_foster db 3 ;fx no
  216. db 10+sfxf_start_delay ;flags
  217. db -1,127,127 ;room,volume (adlib / roland)
  218. fx_brick_hit_plank db 3 ;fx no
  219. db 8+sfxf_start_delay ;flags
  220. db -1,127,127 ;room,volume (adlib / roland)
  221. fx_rm3_lift_moving db 4 ;fx no
  222. db sfxf_save ;flags
  223. db 3,127,127 ;room,volume (adlib / roland)
  224. db 2,127,127 ;room,volume (adlib / roland)
  225. db -1
  226. fx_weld db 4 ;fx no
  227. db 0 ;flags
  228. db 15,127,127 ;room,volume (adlib / roland)
  229. db 7,127,127 ;room,volume (adlib / roland)
  230. db 6,60,60 ;room,volume (adlib / roland)
  231. db 12,60,60 ;room,volume (adlib / roland)
  232. db 13,60,60 ;room,volume (adlib / roland)
  233. db -1
  234. fx_weld12 db 4 ;fx no
  235. db 0 ;flags
  236. db 12,127,127 ;room,volume (adlib / roland)
  237. db -1
  238. fx_spray_on_skin db 4 ;fx no
  239. db 0 ;flags
  240. db -1,127,127 ;room,volume (adlib / roland)
  241. fx_plank_vibrating db 4 ;fx no
  242. db 6+sfxf_start_delay ;flags
  243. db -1,127,127 ;room,volume (adlib / roland)
  244. fx_press_bang db 5 ;fx no
  245. db 0 ;flags
  246. db 0,50,100 ;room,volume (adlib / roland)
  247. db -1
  248. fx_spanner_clunk db 5 ;fx no
  249. db 0 ;flags
  250. db -1,127,127 ;room,volume (adlib / roland)
  251. fx_break_crystals db 5 ;fx no
  252. db 0 ;flags
  253. db 96,127,127 ;room,volume (adlib / roland)
  254. db -1
  255. fx_press_hiss db 6 ;fx no
  256. db 0 ;flags
  257. db 0,40,40 ;room,volume (adlib / roland)
  258. db -1
  259. fx_open_door db 6 ;fx no
  260. db 0 ;flags
  261. db -1,127,127 ;room,volume (adlib / roland)
  262. fx_open_lamb_door db 6 ;fx no
  263. db 0 ;flags
  264. db 20,127,127 ;room,volume (adlib / roland)
  265. db 21,127,127 ;room,volume (adlib / roland)
  266. db -1
  267. fx_splash db 6 ;fx no
  268. db 22+sfxf_start_delay ;flags
  269. db -1,127,127 ;room,volume (adlib / roland)
  270. fx_disintegrate db 7 ;fx no
  271. db 0 ;flags
  272. db -1,127,127 ;room,volume (adlib / roland)
  273. fx_buzzer db 7 ;fx no
  274. db 4+sfxf_start_delay ;flags
  275. db -1,127,127 ;room,volume (adlib / roland)
  276. fx_lathe db 7 ;fx no
  277. db sfxf_save ;flags
  278. db 4,60,60 ;room,volume (adlib / roland)
  279. db 2,20,20
  280. db -1
  281. fx_hit_crowbar_brick db 7 ;fx no
  282. db 9+sfxf_start_delay ;flags
  283. db -1,127,127 ;room,volume (adlib / roland)
  284. fx_hello_helga db 0 dup (0)
  285. fx_statue_on_armour db 8 ;fx no
  286. db 0 ;flags
  287. db -1,127,127 ;room,volume (adlib / roland)
  288. fx_lift_alarm db 8 ;fx no
  289. db sfxf_save ;flags
  290. db 2,63,63 ;room,volume (adlib / roland)
  291. db -1
  292. fx_drop_crowbar db 8 ;fx no
  293. db 5+sfxf_start_delay ;flags
  294. db -1,127,127 ;room,volume (adlib / roland)
  295. fx_byee_helga db 9 ;fx no
  296. db 3+sfxf_start_delay ;flags
  297. db -1,127,127 ;room,volume (adlib / roland)
  298. fx_shed_door_creak db 0 dup (0)
  299. fx_explosion db 10 ;fx no
  300. db 0 ;flags
  301. db -1,127,127 ;room,volume (adlib / roland)
  302. fx_fire_crackle_in_pit db 9 ;fx no
  303. db sfxf_save ;flags
  304. db -1,127,127 ;room,volume (adlib / roland)
  305. fx_remove_bar_grill db 10 ;fx no
  306. db 7+sfxf_start_delay ;flags
  307. db -1,127,127 ;room,volume (adlib / roland)
  308. fx_grill_creak db 10 ;fx no
  309. db 43+sfxf_start_delay ;flags
  310. db -1,127,127 ;room,volume (adlib / roland)
  311. fx_steam1 db 11 ;fx no
  312. db sfxf_save ;flags
  313. db 18,20,20 ;room,volume (adlib / roland)
  314. db -1
  315. fx_steam2 db 11 ;fx no
  316. db sfxf_save ;flags
  317. db 18,63,63 ;room,volume (adlib / roland)
  318. db -1
  319. fx_steam3 db 11 ;fx no
  320. db sfxf_save ;flags
  321. db 18,127,127 ;room,volume (adlib / roland)
  322. db -1
  323. fx_crowbar_wooden db 0 dup (0)
  324. fx_helmet_down_3 db 11 ;fx no
  325. db 0 ;flags
  326. db -1,127,127 ;room,volume (adlib / roland)
  327. fx_guard_fall db 11 ;fx no
  328. db 4 ;flags
  329. db -1,127,127 ;room,volume (adlib / roland)
  330. fx_furnace db 11 ;fx no
  331. db 0 ;flags
  332. db 3,90,90 ;room,volume (adlib / roland)
  333. db -1
  334. fx_fall_thru_box db 0 dup (0)
  335. fx_lazer db 0 dup (0) ;identical
  336. fx_scanner db 0 dup (0) ;identical
  337. fx_helmet_up_3 db 12 ;fx no
  338. db 0 ;flags
  339. db -1,127,127 ;room,volume (adlib / roland)
  340. fx_liquid_bubble db 12 ;fx no
  341. db sfxf_save ;flags
  342. db 80,127,127 ;room,volume (adlib / roland)
  343. db 72,127,127 ;room,volume (adlib / roland)
  344. db -1
  345. fx_liquid_drip db 13 ;fx no
  346. db 6+sfxf_start_delay ;flags
  347. db -1,127,127 ;room,volume (adlib / roland)
  348. fx_goo_drip db 13 ;fx no
  349. db 5+sfxf_start_delay ;flags
  350. db -1,127,127 ;room,volume (adlib / roland)
  351. fx_comp_bleeps db 13 ;fx no
  352. db 0 ;flags
  353. db -1,127,127 ;room,volume (adlib / roland)
  354. fx_use_crowbar_grill db 13 ;fx no
  355. db 34+sfxf_start_delay ;flags
  356. db -1,127,127 ;room,volume (adlib / roland)
  357. fx_helmet_grind db 14 ;fx no
  358. db 0 ;flags
  359. db -1,127,127 ;room,volume (adlib / roland)
  360. fx_lift_moving db 14 ;fx no
  361. db sfxf_save ;flags
  362. db 7,127,127 ;room,volume (adlib / roland)
  363. db 29,127,127 ;room,volume (adlib / roland)
  364. db -1
  365. fx_use_secateurs db 14 ;fx no
  366. db 18+sfxf_start_delay ;flags
  367. db -1,127,127 ;room,volume (adlib / roland)
  368. fx_hit_joey1 db 14 ;fx no
  369. db 7+sfxf_start_delay ;flags
  370. db -1,127,127 ;room,volume (adlib / roland)
  371. fx_hit_joey2 db 14 ;fx no
  372. db 13+sfxf_start_delay ;flags
  373. db -1,127,127 ;room,volume (adlib / roland)
  374. fx_dani_phone_ring db 0 dup (0)
  375. fx_sc74_pod_down db 0 dup (0)
  376. fx_phone db 0 dup (0)
  377. fx_25_weld db 15 ;welding in room 25
  378. db 0
  379. db -1,127,127
  380. fx_lift_open_7 db 15 ;fx no
  381. db 0 ;flags
  382. db 7,127,127 ;room,volume (adlib / roland)
  383. db -1
  384. fx_lift_close_7 db 16 ;fx no
  385. db 0 ;flags
  386. db 7,127,127 ;room,volume (adlib / roland)
  387. db -1
  388. fx_s2_helmet db 0 dup (0)
  389. fx_hiss_in_nitrogen db 16 ;fx no
  390. db 0 ;flags
  391. db -1,127,127 ;room,volume (adlib / roland)
  392. fx_dog_yap_indoors db 16 ;fx no
  393. db 0 ;flags
  394. db 38,127,127 ;room,volume (adlib / roland)
  395. db -1
  396. fx_dog_yap_outdoors db 16 ;fx no
  397. db 0 ;flags
  398. db 31,127,127 ;room,volume (adlib / roland)
  399. db 30,40,40 ;room,volume (adlib / roland)
  400. db 32,40,40 ;room,volume (adlib / roland)
  401. db 33,40,40 ;room,volume (adlib / roland)
  402. db -1
  403. fx_locker_creak_open db 0 dup (0)
  404. fx_big_tent_gurgle db 17 ;fx no
  405. db 0 ;flags
  406. db -1,127,127 ;room,volume (adlib / roland)
  407. fx_wind_howl db 17 ;fx no
  408. db sfxf_save ;flags
  409. db 1,127,127 ;room,volume (adlib / roland)
  410. db -1
  411. fx_lift_open_29 db 17 ;fx no
  412. db 0 ;flags
  413. db 29,127,127 ;room,volume (adlib / roland)
  414. db -1
  415. fx_lift_arrive_7 db 17 ;fx no
  416. db 0 ;flags
  417. db 7,63,63 ;room,volume (adlib / roland)
  418. db -1
  419. fx_lift_close_29 db 18 ;fx no
  420. db 0 ;flags
  421. db 29,127,127 ;room,volume (adlib / roland)
  422. db 28,127,127 ;room,volume (adlib / roland)
  423. db -1
  424. fx_shaft_industrial_noise db 18 ;fx no
  425. db sfxf_save ;flags
  426. db -1,127,127 ;room,volume (adlib / roland)
  427. fx_gall_drop db 18 ;fx no
  428. db 29+sfxf_start_delay ;flags
  429. db -1,127,127 ;room,volume (adlib / roland)
  430. fx_door_slam_under db 19 ;fx no
  431. db 0 ;flags
  432. db -1,127,127 ;room,volume (adlib / roland)
  433. fx_reichs_fish db 19 ;fx no
  434. db sfxf_save ;flags
  435. db -1,60,60 ;room,volume (adlib / roland)
  436. fx_judges_gavel1 db 19 ;fx no
  437. db 13+sfxf_start_delay ;flags
  438. db -1,60,60 ;room,volume (adlib / roland)
  439. fx_judges_gavel2 db 19 ;fx no
  440. db 16+sfxf_start_delay ;flags
  441. db -1,90,90 ;room,volume (adlib / roland)
  442. fx_judges_gavel3 db 19 ;fx no
  443. db 19+sfxf_start_delay ;flags
  444. db -1,127,127 ;room,volume (adlib / roland)
  445. fx_wind_3 db 0 dup (0)
  446. fx_fact_sensor db 20
  447. db sfxf_save ;flags
  448. db -1,60,60
  449. fx_medi_stab_gall db 20 ;fx no
  450. db 17+sfxf_start_delay ;flags
  451. db -1,127,127 ;room,volume (adlib / roland)
  452. fx_computer_3 db 21 ;fx no
  453. db sfxf_save ;flags
  454. db -1,127,127 ;room,volume (adlib / roland)
  455. fx_timber_cracking db 21 ;fx no
  456. db 0 ;flags
  457. db -1,127,127 ;room,volume (adlib / roland)
  458. fx_anchor_fall db 0 dup (0)
  459. fx_elevator_4 db 22 ;fx no
  460. db 0 ;flags
  461. db -1,127,127 ;room,volume (adlib / roland)
  462. fx_star_trek_2 db 22 ;fx no
  463. db sfxf_save ;flags
  464. db -1,127,127 ;room,volume (adlib / roland)
  465. fx_lift_closing db 23 ;fx no
  466. db 0 ;flags
  467. db -1,127,127 ;room,volume (adlib / roland)
  468. fx_heartbeat db 23 ;fx no
  469. db 11+sfxf_start_delay ;flags
  470. db 67,60,60
  471. db 68,60,60
  472. db 69,60,60
  473. db 77,20,20
  474. db 78,50,50
  475. db 79,70,70
  476. db 80,127,127
  477. db 81,60,60 ;6 room,vol
  478. db -1
  479. fx_pos_key db 25 ;fx no
  480. db 2+sfxf_start_delay ;flags
  481. db -1,127,127 ;room,volume (adlib / roland)
  482. fx_neg_key db 26 ;fx no
  483. db 2+sfxf_start_delay ;flags
  484. db -1,100,100 ;room,volume (adlib / roland)
  485. fx_orifice_swallow_drip db 28 ;fx no
  486. db 0 ;flags
  487. db -1,127,127 ;room,volume (adlib / roland)
  488. align 4
  489. end32data
  490. start32save_data
  491. saved_current_music dd 0
  492. max_queued_fx equ 4
  493. queue_fx struc
  494. count db 0
  495. fx_no db 0
  496. chan db 0
  497. vol db 0
  498. queue_fx ends
  499. fx_queue queue_fx max_queued_fx dup (<>)
  500. save_fx_0 dd 0 ;stores for fx that need restarting on restore
  501. save_fx_1 dd 0
  502. align 4
  503. end32save_data
  504. start32code
  505. extrn __x386_memlock:near
  506. init_music proc
  507. ; If force sounds off option has been selected then don't install anything
  508. test [_force_sounds_off],-1
  509. jne init_music_ret
  510. ifdef no_music
  511. ret
  512. endif
  513. test [config_file_present],-1 ;is there a config file
  514. je test_anyway
  515. cmp 1[config_name],1
  516. je got_roland
  517. jmp got_blaster
  518. test_anyway:
  519. ifdef cd_version_prot
  520. jmp got_blaster
  521. endif
  522. ; -----------------------------------------
  523. ; Routine to detect presence of sound cards
  524. ; -----------------------------------------
  525. ; NOTE that Soundblaster will give positive results for
  526. ; both sblflag and adlibflag
  527. ; sound cards supported ...
  528. ; AdLib
  529. ; Roland LAPC1 ; bug removed 03.10.92
  530. ; Tandy TI sound chip
  531. ; Soundblaster ; added 23.03.92
  532. ; -----------------------------------------
  533. ; these bytes tell you whether each card is
  534. ; attached - zero means not available
  535. ; -----------------------------------------
  536. detect: mov alport,388h
  537. call adlib_sub
  538. mov adlibflag2,al
  539. ifdef dont_check_rlnd
  540. mov rolandflag2,0
  541. else
  542. call testroland
  543. mov rolandflag2,al
  544. endif
  545. call testtandy
  546. mov tandyflag2,al
  547. ; Soundblaster -
  548. ; detect adlib but at Soundblaster addresses
  549. ; possibilities are 210h/220h/230h/240h/250h/260h/270h
  550. mov alport,228h ; factory setting
  551. call adlib_sub ; ( most likely to be used )
  552. or al,al
  553. jne got_sbl
  554. ; some of these ports will no doubt generate conflicts
  555. ; my driver doesn't check them unless a punter specifically asks
  556. mov alport,218h ; try others
  557. call adlib_sub
  558. or al,al
  559. jne got_sbl
  560. mov alport,238h
  561. call adlib_sub
  562. or al,al
  563. jne got_sbl
  564. mov alport,248h
  565. call adlib_sub
  566. or al,al
  567. jne got_sbl
  568. mov alport,258h
  569. call adlib_sub
  570. or al,al
  571. jne got_sbl
  572. mov alport,268h
  573. call adlib_sub
  574. or al,al
  575. jne got_sbl
  576. mov alport,278h
  577. call adlib_sub
  578. got_sbl: mov sblflag2,al
  579. jmp music_checked
  580. ; ********************************
  581. ; --------------------------------
  582. ; Test if AdLib Sound Card present
  583. ; --------------------------------
  584. ; on exit :
  585. ; al = 1 if present , 0 if not present
  586. AdLib_sub: push bx
  587. push cx
  588. push dx
  589. mov dx,ALport
  590. mov ax,6004h
  591. call WriteAdLib ; reset timer-1 and timer-2
  592. mov ax,8004h
  593. call WriteAdLib ; reset the IRQ
  594. in al,dx ; read the status register
  595. push ax ; save the result
  596. mov ax,0ff02h
  597. call WriteAdLib ; set timer-1 to 0ffh
  598. mov ax,2104h
  599. call WriteAdLib ; unmask and start timer-1
  600. mov bx,1FFFh-67 ; wait at least 80us
  601. call time_out
  602. in al,dx ; read status
  603. push ax ; save result
  604. mov ax,6004h
  605. call WriteAdLib ; reset timer-1 and timer-2
  606. mov ax,8004h
  607. call WriteAdLib ; reset the IRQ
  608. pop ax ; al - second read
  609. pop bx ; bl - first read
  610. and al,0e0h ; mask off the bits
  611. and bl,0e0h
  612. jne NotPresent
  613. cmp al,0C0h
  614. jne NotPresent
  615. @@present: mov eax,1
  616. pop dx
  617. pop cx
  618. pop bx
  619. ret
  620. NotPresent: xor eax,eax
  621. pop dx
  622. pop cx
  623. pop bx
  624. ret
  625. ; ----------------------------------
  626. ; Write a value to an AdLib register
  627. ; AH holds data , AL holds register
  628. ; ----------------------------------
  629. WriteAdLib: push bx
  630. push dx
  631. mov dx,ALport
  632. out dx,al
  633. ; wait for at least 3.3 microseconds
  634. mov bx,1FFFh-3
  635. call time_out
  636. mov al,ah
  637. inc dx ; dx now data reg
  638. out dx,al
  639. ; now wait about 23 microseconds
  640. mov bx,1FFFh-19
  641. call time_out
  642. pop dx
  643. pop bx
  644. ret
  645. port_b equ 61h
  646. ; Timer Chip Addresses ....
  647. timer_0 = 40h ; Timer Channel 0
  648. timer_1 = 41h ; Timer Channel 1
  649. timer_2 = 42h ; Timer Channel 2
  650. timer_ctrl = 43h ; Timer Control Register
  651. ; Timer Control Register Looks Like This ....
  652. ; Bit 0 if 0,Binary Data ; else BCD
  653. ; Bit 3-1 Mode ( 0 - 5 )
  654. ; Bit 5-4 Type of Operation ... 00 = Move Counter Value to Latch
  655. ; 01 = Read/Write Hi-Byte Only
  656. ; 10 = Read/Write Lo-Byte Only
  657. ; 11 = Read/Write Hi- then Lo-Byte
  658. ; Bit 7-6 Channel Number , 0-2
  659. ; ----------------------------------
  660. ; wait for a specific amount of time
  661. ; ----------------------------------
  662. ; bx = 1FFFh minus number of ticks to wait
  663. time_out: push ax
  664. mov al,10110110b ; channel 2 / read/write lo then hi
  665. out timer_ctrl,al ; mode 3 / binary
  666. in al,port_B
  667. or al,3
  668. out port_B,al
  669. mov ax,1FFFh ; maximum timer value
  670. AL_loop1: out timer_2,al
  671. mov al,ah
  672. out timer_2,al
  673. mov al,10000110b ; latch channel 2 value
  674. out timer_ctrl,al
  675. mov al,10110110b ; read/write word
  676. out timer_ctrl,al
  677. in al,timer_2
  678. mov ah,al
  679. in al,timer_2
  680. xchg ah,al
  681. cmp ax,bx
  682. jg al_loop1
  683. in al,port_B
  684. and al,0FEh
  685. out port_B,al
  686. pop ax
  687. ret
  688. Status equ 331h
  689. Control equ 331h
  690. Data equ 330h
  691. ; ---------------------------
  692. ; Test if LAPC1 Board Present
  693. ; ---------------------------
  694. ; on exit :
  695. ; al = 1 if present , 0 if not present
  696. TestRoland: push cx
  697. push dx
  698. mov cx,27
  699. TR1: call TestRol2
  700. cmp al,0FEh
  701. jz IsOne ; LOOPNE wouldn't work here !
  702. loop TR1
  703. ; if no acknowledge after this many tries
  704. ; there mustn't be
  705. pop dx
  706. pop cx
  707. xor eax,eax ; flag no card
  708. ret
  709. ; Yes , one is connected , Do a Reset
  710. IsOne: mov al,0FFh
  711. call SendCommand
  712. pop dx
  713. pop cx
  714. mov eax,1
  715. ret
  716. TestRol2: push cx
  717. mov dx,status
  718. mov cx,-1
  719. tr21: in al,dx ; make sure it isn't busy
  720. test al,40h ; we need to test bit 6
  721. loopnz tr21
  722. mov al,0FFh ; Reset Command
  723. out dx,al ; send it
  724. mov cx,-1 ; Maximum no of tries
  725. tr22: in al,dx
  726. test al,80h ; Bit 7 is Data Strobe ( possibly !)
  727. loopnz tr22
  728. mov dx,data
  729. in al,dx
  730. pop cx
  731. ret ; Should be Acknowledge in AL
  732. ; -----------------------------
  733. ; Send a command to the MPU-401
  734. ; -----------------------------
  735. SendCommand: push ax
  736. push cx
  737. push dx
  738. mov dx,status
  739. mov ah,al ; keep command byte
  740. sc1: in al,dx ; make sure it isn't busy
  741. add al,al ; we need to test bit 6
  742. js sc1 ; here it is in bit 7 - sign flag
  743. mov al,ah ; get command back
  744. out dx,al ; send it
  745. sc2: in al,dx
  746. or al,al ; Bit 7 is DSR ( possibly !)
  747. js sc2
  748. mov dx,data
  749. in al,dx
  750. cmp al,0FEh ; 0FEh = acknowledge byte
  751. pop dx
  752. pop cx
  753. pop ax
  754. ret
  755. ; ---------------------
  756. ; check for Tandy sound
  757. ; ---------------------
  758. ; on exit :
  759. ; al = 1 if present , else 0
  760. ; PortAddress = tandy sound IO port address
  761. ; this routine has been brought to you by Tandy US
  762. ; in PsygnosisVision , thru DMA Design
  763. testtandy: push es
  764. mov ax,8100h ; issue a status command to
  765. int 1Ah ; the sound BIOS call
  766. cmp ah,80h ; see what the result is
  767. jc yesboth ; BIOS returned a port number
  768. ; mov ax,0F000h
  769. ; mov es,ax
  770. ; mov al,byte ptr es:0C000h
  771. mov es,[__x386_zero_base_selector]
  772. mov al,es:[0f0000h + 0c000h]
  773. cmp al,21h ; this byte is present on all 1000s
  774. jz TIonly
  775. ; the TI sound and digital hardware is not present ,
  776. ; at least on Tandy systems
  777. xor eax,eax ; signal not available
  778. jmp TT_exit ; pull everything and return
  779. ; the TI sound hardware is available but the digital
  780. ; sound hardare is not ( Digital sound not used by this driver anyway )
  781. TIonly: mov portaddress,0C0h ; set port address
  782. mov al,1 ; signal soundchip found
  783. jmp TT_exit ; pull everything and return
  784. YesBoth: sub ax,4 ; following documentation supplied
  785. mov portaddress,ax ; having dry-run the code !!!
  786. mov eax,1
  787. TT_exit: pop es
  788. ret
  789. music_checked: ;check what boards are present
  790. test [_force_roland],-1 ;has r option been used
  791. jne got_r_option
  792. test [sblflag2],-1
  793. jne got_blaster
  794. got_r_option: test [rolandflag2],-1
  795. jne got_roland
  796. test [adlibflag2],-1
  797. jne got_adlib
  798. ; yes we have no boards
  799. ret
  800. got_roland: bts [system_flags],sf_roland
  801. bts [system_flags],sf_plus_fx
  802. mov [mboard_offset],rl_mboard_offset
  803. mov [max_music_size],rl_max_music_size
  804. mov [max_fx_size],rl_max_fx_size
  805. jmp found_board
  806. got_blaster: bts [system_flags],sf_sblaster
  807. bts [system_flags],sf_plus_fx
  808. mov [max_fx_size],sb_max_fx_size
  809. got_adlib: bts [system_flags],sf_adlib
  810. mov [mboard_offset],sb_mboard_offset
  811. mov [max_music_size],sb_max_music_size
  812. found_board: bts [system_flags],sf_music_board
  813. ; allocate space for the driver / music
  814. push es
  815. mov ebx,[max_music_size]
  816. ifdef mem_check
  817. add [dos_mem_allocated],ebx
  818. endif
  819. shr ebx,4
  820. inc ebx
  821. mov ah,48h
  822. int 21h
  823. mov [driver_seg],ax
  824. mov [driver_add],ebx
  825. push [max_music_size] ;lock the data
  826. push ds
  827. push [driver_add]
  828. call __x386_memlock
  829. cherror eax,ne,0,em_internal_error
  830. lea esp,12[esp]
  831. ; allocate space for the fx ROLAND/SBLASTER ONLY
  832. bt [system_flags],sf_plus_fx
  833. jnc fx_not_valid
  834. mov ebx,[max_fx_size]
  835. ifdef mem_check
  836. add [dos_mem_allocated],ebx
  837. endif
  838. shr ebx,4
  839. inc ebx
  840. mov ah,48h
  841. int 21h
  842. mov [fx_seg],ax
  843. mov [fx_add],ebx
  844. push [max_fx_size] ;lock the data
  845. push ds
  846. push [fx_add]
  847. call __x386_memlock
  848. cherror eax,ne,0,em_internal_error
  849. lea esp,12[esp]
  850. fx_not_valid: mov ax,2509h ;get system segments and selectors
  851. int 21h
  852. mov [code16_seg],bx
  853. movzx ebx,bx ;zero upper word
  854. shl ebx,4 ;make into an absoloute address
  855. mov es,__x386_zero_base_selector ;point to base memory
  856. assume es:nothing
  857. mov ax,[driver_seg] ;store value of code segment
  858. mov es:music_bin_seg[ebx],ax
  859. pop es
  860. ; On sblaster make a 64k buffer for voc files
  861. ; remember music binary not loaded at this point
  862. bt [system_flags],sf_sblaster
  863. jnc init_music_ret
  864. mov ebx,65536/16
  865. ifdef mem_check
  866. add [dos_mem_allocated],65536
  867. endif
  868. mov ah,48h
  869. int 21h
  870. jnc qop
  871. cherror eax,ne,0,em_memory_error
  872. qop: mov [voc_work_seg],ax
  873. mov [voc_work_space],ebx
  874. mov eax,65536 ;lock the data
  875. push eax
  876. push ds
  877. push [voc_work_space]
  878. call __x386_memlock
  879. cherror eax,ne,0,em_internal_error
  880. lea esp,12[esp]
  881. mov ah,100 ;set up voc segment
  882. mov bx,[voc_work_seg]
  883. ifdef debug_42
  884. and eax,0ff00h
  885. clear ecx
  886. clear edx
  887. endif
  888. call music_command
  889. mov ebx,65536/16
  890. ifdef mem_check
  891. add [dos_mem_allocated],65536
  892. endif
  893. mov ah,48h
  894. int 21h
  895. jnc qip
  896. cherror eax,ne,0,em_memory_error
  897. qip: mov [voc_fx_seg],ax
  898. mov [voc_fx_space],ebx
  899. mov eax,65536 ;lock the data
  900. push eax
  901. push ds
  902. push [voc_fx_space]
  903. call __x386_memlock
  904. cherror eax,ne,0,em_internal_error
  905. lea esp,12[esp]
  906. mov ah,102 ;set up voc segment
  907. mov bx,[voc_fx_seg]
  908. ifdef debug_42
  909. and eax,0ff00h
  910. clear ecx
  911. clear edx
  912. endif
  913. call music_command
  914. bts [system_flags],sf_play_vocs ;allow speech
  915. bts [system_flags],sf_allow_speech
  916. init_music_ret: ret
  917. init_music endp
  918. load_section_music proc
  919. ; load music binary file for section eax
  920. mov [current_music],0
  921. bt [system_flags],sf_music_board ;no board, no music
  922. jnc load_no_music
  923. cherror eax,nc,7,em_internal_error
  924. push es
  925. ; If binary already loaded then stop any music or fx
  926. bt [system_flags],sf_music_bin
  927. jnc first_one
  928. push eax
  929. mov ah,6
  930. call music_command
  931. mov ah,3
  932. call music_command
  933. mov ah,1
  934. call music_command
  935. mov ah,3
  936. call music_command
  937. pop eax
  938. first_one: ;calculate music file number
  939. imul eax,files_per_section
  940. add eax,music_base_file
  941. add eax,[mboard_offset]
  942. push eax
  943. ifdef debug_42
  944. push eax
  945. call get_file_size
  946. cmp eax,[max_music_size]
  947. jc msize_ok
  948. pop ebx
  949. printf "music file %d size %d, max size %d",ebx,eax,[max_music_size]
  950. msize_ok: pop eax
  951. endif
  952. mov edx,[driver_add] ;load the driver
  953. call load_file
  954. bts [system_flags],sf_music_bin ;flag the driver as present
  955. clear ecx
  956. clear edx
  957. ; Check if we have a configoration override
  958. test [config_file_present],-1
  959. je no_cfg
  960. mov dl,2[config_name] ;get port
  961. jife dl,no_cfg ;0 = auto detect
  962. mov dx,word ptr [offset cfg_ports + edx*2]
  963. movzx eax,byte ptr 3[config_name]
  964. mov cl,byte ptr [offset cfg_irq + eax]
  965. mov al,4[config_name]
  966. mov ch,byte ptr [offset cfg_dma + eax]
  967. no_cfg: clear eax ;initialise driver
  968. call music_command
  969. pop eax
  970. ; Roland and sblaster have seperate fx files
  971. bt [system_flags],sf_plus_fx
  972. jnc no_fx
  973. inc eax
  974. ifdef debug_42
  975. push eax
  976. call get_file_size
  977. cherror eax,nc,[max_fx_size],em_internal_error
  978. pop eax
  979. endif
  980. mov edx,[fx_add]
  981. call load_file
  982. mov eax,900h
  983. mov cx,[fx_seg]
  984. call music_command
  985. mov ah,100 ;set up voc segment
  986. mov bx,[voc_work_seg]
  987. call music_command
  988. mov ah,102 ;set up voc segment
  989. mov bx,[voc_fx_seg]
  990. call music_command
  991. no_fx: pop es
  992. ; set music tempo
  993. mov eax,200h
  994. mov ecx,23864 ;23000
  995. call music_command
  996. load_no_music: ret
  997. load_section_music endp
  998. fn_start_fx proc
  999. ; start sound eax on channel ebx.
  1000. and bl,1 ;only 2 channels, 0 & 1
  1001. cmp eax,max_fx_number+1
  1002. jnc num_err
  1003. cmp eax,256
  1004. jnc num_ok
  1005. num_err: mov al,1
  1006. ret
  1007. num_ok: cmp eax,278 ;is this weld in room 25
  1008. jne not_weld_25
  1009. cmp [screen],25
  1010. jne not_weld_25
  1011. mov eax,394
  1012. not_weld_25: mov [stfx_cur_snd],eax
  1013. mov [stfx_cur_chn],ebx
  1014. btr eax,8 ;check for special sound
  1015. mov esi,[offset music_list + eax*4] ;get pointer to fx info
  1016. mov edx,[screen] ;and current screen
  1017. mov edi,esi
  1018. lea edi,2[edi] ;point to room list
  1019. cmp bpt[edi],-1 ;if room list empty then do all rooms
  1020. je do_fx
  1021. room_loop: cmp dl,[edi] ;check rooms
  1022. je do_fx
  1023. lea edi,3[edi]
  1024. cmp bpt[edi],-1
  1025. jne room_loop
  1026. jmp no_fx
  1027. do_fx: ;get fx volume
  1028. mov cl,7fh ;start with max vol
  1029. bt [system_flags],sf_sblaster
  1030. jc get_vol
  1031. bt [system_flags],sf_roland
  1032. jnc got_vol
  1033. inc edi
  1034. get_vol: movzx ecx,bpt 1[edi] ;get volume
  1035. got_vol: movzx eax,bpt [esi] ;get sound number
  1036. ; Check the flags, the sound may come on after a delay.
  1037. movzx edx,bpt 1[esi] ;get flags
  1038. test dl,sfxf_start_delay ;start delay?
  1039. jne start_delay
  1040. test dl,sfxf_save ;put into save table?
  1041. je normal_fx
  1042. ; fx needs saving
  1043. mov esi,[stfx_cur_chn]
  1044. mov edx,[stfx_cur_snd]
  1045. mov [offset save_fx_0 + esi*4],edx
  1046. jmp normal_fx
  1047. start_delay: ;put fx into delay table
  1048. and dl,7fh
  1049. ; Look for a slot
  1050. mov esi,offset fx_queue
  1051. mov ch,max_queued_fx
  1052. qlook_loop: test (queue_fx ptr[esi]).count,-1
  1053. jne used
  1054. ; This queue is free
  1055. mov (queue_fx ptr[esi]).count,dl
  1056. mov (queue_fx ptr[esi]).fx_no,al
  1057. mov (queue_fx ptr[esi]).chan,bl
  1058. mov (queue_fx ptr[esi]).vol,cl
  1059. ;mov bpt [offset start_delay_count0 + ebx*4],dl
  1060. ;mov bpt 1[offset start_delay_count0 + ebx*4],al
  1061. ;mov bpt 2[offset start_delay_count0 + ebx*4],cl
  1062. mov al,1
  1063. ret
  1064. used: lea esi,SIZE queue_fx[esi]
  1065. dec ch
  1066. jne qlook_loop
  1067. mov al,1 ;ignore effect
  1068. ret
  1069. normal_fx: call start_fx_main
  1070. no_fx: mov al,1
  1071. ret
  1072. fn_start_fx endp
  1073. start_fx_main proc
  1074. ; fx eax, chan ebx, vol ecx
  1075. and ebx,1
  1076. je not_ch_0 ;play vocs on channel 1
  1077. bt [system_flags],sf_voc_playing
  1078. jc no_fx
  1079. not_ch_0: mov [offset fx_vol_0x + ebx],ecx
  1080. bt [system_flags],sf_fx_off ;fx turned off?
  1081. jc no_fx
  1082. mov ah,5
  1083. mov ch,bl
  1084. call music_command
  1085. no_fx: ret
  1086. start_fx_main endp
  1087. fn_pause_fx proc
  1088. ; Set fx volumes to 0 temporarily
  1089. bt [system_flags],sf_fx_off
  1090. jc no_pause
  1091. mov ah,10
  1092. clear ecx
  1093. call music_command
  1094. mov ah,10
  1095. mov cx,100h
  1096. call music_command
  1097. no_pause: mov al,1
  1098. ret
  1099. fn_pause_fx endp
  1100. fn_un_pause_fx proc
  1101. ; Set fx volumes to 0 temporarily
  1102. bt [system_flags],sf_fx_off
  1103. jc no_pause
  1104. mov ah,10
  1105. clear ch
  1106. mov cl,[fx_vol_0x]
  1107. call music_command
  1108. mov ah,10
  1109. mov ch,1
  1110. mov cl,[fx_vol_1x]
  1111. call music_command
  1112. no_pause: mov al,1
  1113. ret
  1114. fn_un_pause_fx endp
  1115. fx_control proc
  1116. ; Start or stop a delayed fx
  1117. mov esi,offset fx_queue
  1118. mov ecx,max_queued_fx
  1119. con_loop: test (queue_fx ptr[esi]).count,-1 ;slot full?
  1120. je mt_slot
  1121. dec (queue_fx ptr[esi]).count ;do it yet?
  1122. jne mt_slot
  1123. push esi
  1124. push ecx
  1125. mov al,(queue_fx ptr[esi]).fx_no
  1126. mov bl,(queue_fx ptr[esi]).chan
  1127. mov cl,(queue_fx ptr[esi]).vol
  1128. call start_fx_main
  1129. pop ecx
  1130. pop esi
  1131. mt_slot: lea esi,SIZE queue_fx[esi]
  1132. loop con_loop
  1133. no_stop: ret
  1134. fx_control endp
  1135. ; fn_stop_fx stops a sound effect on a channel and clears the save_fx status
  1136. ; fn_suspend_fx stops the sound but keeps the save status (used by control panel_
  1137. fn_stop_fx proc
  1138. ; stop fx on channel eax
  1139. and eax,1
  1140. mov dpt[offset save_fx_0 + eax*4],0
  1141. jife eax,not_0
  1142. ; We could be playing a voc file on this channel, don't stop it if we are
  1143. bt [system_flags],sf_voc_playing
  1144. jc no_stop_fx
  1145. not_0: ;mov dpt[offset save_fx_0 + eax*4],0
  1146. call fn_suspend_fx
  1147. no_stop_fx: mov al,1
  1148. ret
  1149. fn_stop_fx endp
  1150. fn_stop_voc proc
  1151. ; When replaying real fast we have to be able to stop voc files
  1152. mov ah,8
  1153. mov ch,1
  1154. call music_command
  1155. btr [system_flags],sf_voc_playing
  1156. ret
  1157. fn_stop_voc endp
  1158. fn_suspend_fx proc
  1159. ; Stop fx on channel al
  1160. mov ah,8
  1161. mov ch,al
  1162. ifdef debug_42
  1163. and eax,0ff00h
  1164. clear ebx
  1165. and ecx,0ff00h
  1166. clear edx
  1167. endif
  1168. call music_command
  1169. ret
  1170. fn_suspend_fx endp
  1171. fn_start_music proc
  1172. cmp eax,[current_music]
  1173. je no_mus
  1174. mov [current_music],eax
  1175. bt [system_flags],sf_mus_off
  1176. jc no_mus
  1177. jife al,stop_music
  1178. mov ah,4
  1179. mov ecx,256
  1180. call music_command
  1181. mov ecx,[music_volume] ;0-32
  1182. shl ecx,3 ;0-256
  1183. mov ah,13
  1184. call music_command
  1185. no_mus: mov al,1
  1186. ret
  1187. fn_start_music endp
  1188. restart_current_music proc
  1189. bt [system_flags],sf_mus_off
  1190. jc no_mus
  1191. mov eax,[current_music]
  1192. mov ah,4
  1193. call music_command
  1194. no_mus: ret
  1195. restart_current_music endp
  1196. restore_saved_effects_0 proc
  1197. mov eax,[save_fx_0] ;check for saved fx on chan 0
  1198. jife eax,no_sfx_0
  1199. clear ebx
  1200. call fn_start_fx
  1201. no_sfx_0: ret
  1202. restore_saved_effects_0 endp
  1203. restore_saved_effects_1 proc
  1204. mov eax,[save_fx_1] ;check for saved fx on chan 1
  1205. jife eax,no_sfx_1
  1206. mov ebx,1
  1207. call fn_start_fx
  1208. no_sfx_1: ret
  1209. restore_saved_effects_1 endp
  1210. trash_all_fx proc
  1211. ; Stop any current fx and clear any delayed ones
  1212. clear eax ;Amiga fx stopped on file cache
  1213. call fn_stop_fx
  1214. mov eax,1
  1215. call fn_stop_fx
  1216. mov esi,offset fx_queue
  1217. mov ecx,max_queued_fx
  1218. trash_loop: mov (queue_fx ptr[esi]).count,0
  1219. lea esi,SIZE queue_fx[esi]
  1220. loop trash_loop
  1221. ret
  1222. trash_all_fx endp
  1223. fn_stop_music proc
  1224. mov [current_music],0
  1225. fn_stop_music endp
  1226. stop_music proc
  1227. mov ah,7
  1228. ifdef debug_42
  1229. and eax,0ff00h
  1230. clear ebx
  1231. clear ecx
  1232. clear edx
  1233. endif
  1234. call music_command
  1235. mov al,1
  1236. ret
  1237. stop_music endp
  1238. end32code
  1239. start16code
  1240. extrn music_bin_seg:word
  1241. end16code
  1242. end
  1243.