Advertisement
Jhynjhiruu

Untitled

Aug 17th, 2019
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.58 KB | None | 0 0
  1. irq_tmr2_hi:
  2. PUSH BA
  3. PUSH HL
  4. PUSH IX
  5. PUSH EP
  6. PUSH IP
  7. LD EP,#00h
  8. _checkBGM:
  9. LD A,#01h
  10. AND A,[_pmmusram_aud_ena]
  11. JRL Z,_checkSFX
  12. _decwaitBGM:
  13. LD HL,_pmmusram_bgm_wait
  14. DEC [HL]
  15. JRL NZ,_checkSFX
  16. _goBGM:
  17. LD IX,[_pmmusram_bgm_ppr]
  18. LD A,[_pmmusram_bgm_ppr+2]
  19. LD XP,A
  20. LD BA,[IX]
  21. LD [_pmmusram_bgm_wait],A
  22. LD [_pmmusram_aud_cfg],B
  23. BIT B,#04h
  24. JRS Z,_BGMnovol
  25. LD A,B
  26. LD B,#00h
  27. AND A,#03h
  28. LD HL,_pmmusram_bgm_tvol
  29. ADD HL,BA
  30. LD A,[HL]
  31. LD [_pmmusram_bgm_pvol],A
  32. _BGMnovol:
  33. LD B,#00h
  34. LD A,[_pmmusram_aud_cfg]
  35. SRL A
  36. SRL A
  37. SRL A
  38. LD HL,_pmmusic_cmdextableadd
  39. ADD HL,BA
  40. LD A,[HL]
  41. LD HL,IX
  42. ADD HL,BA
  43. LD [_pmmusram_bgm_ppr],HL
  44. JRS NC,_bgm_noinc1
  45. LD HL,_pmmusram_bgm_ppr+2
  46. INC [HL]
  47. _bgm_noinc1:
  48. _BGM_Cwriteram:
  49. LD A,#08h
  50. AND A,[_pmmusram_aud_cfg]
  51. JRS Z,_BGM_Csetfreq
  52. INC IX
  53. INC IX
  54. JRS NZ,_BGM_Rwriteram
  55. LD A,XP
  56. INC A
  57. LD XP,A
  58. _BGM_Rwriteram:
  59. LD HL,[_pmmusram_ram_ptr]
  60. LD B,#00h
  61. LD A,[IX+01h]
  62. ADD HL,BA
  63. LD [HL],[IX]
  64. _BGM_Csetfreq:
  65. LD A,#10h
  66. AND A,[_pmmusram_aud_cfg]
  67. JRS Z,_BGM_Csetpivot
  68. INC IX
  69. INC IX
  70. JRS NZ,_BGM_Rsetfreq
  71. LD A,XP
  72. INC A
  73. LD XP,A
  74. _BGM_Rsetfreq:
  75. LD BA,[IX]
  76. LD [_pmmusram_bgm_frq],BA
  77. _BGM_Csetpivot:
  78. LD A,#20h
  79. AND A,[_pmmusram_aud_cfg]
  80. JRS Z,_BGM_Cnextend
  81. INC IX
  82. INC IX
  83. JRS NZ,_BGM_Rsetpivot
  84. LD A,XP
  85. INC A
  86. LD XP,A
  87. _BGM_Rsetpivot:
  88. LD BA,[IX]
  89. LD [_pmmusram_bgm_pvt],BA
  90. _BGM_Cnextend:
  91. LD A,#40h
  92. AND A,[_pmmusram_aud_cfg]
  93. JRS Z,_BGM_Cloop
  94. INC IX
  95. INC IX
  96. JRS NZ,_BGM_Rnextend
  97. LD A,XP
  98. INC A
  99. LD XP,A
  100. _BGM_Rnextend:
  101. LD BA,[IX]
  102. CP BA,0000h
  103. JRS NZ,_BGM_Rpatt
  104. PUSH SC
  105. PUSH BA
  106. LD SC,#C0h
  107. LD A,#02h
  108. AND A,[_pmmusram_aud_ena]
  109. LD [_pmmusram_aud_ena],A
  110. JRS NZ,_end
  111. PUSH EP
  112. LD EP,#00h
  113. AND [BR:23h],#DFh
  114. AND [BR:38h],#FBh
  115. AND [BR:48h],#FBh
  116. POP EP
  117. _end:
  118. POP BA
  119. POP SC
  120. JRS _BGM_Cloop
  121. _BGM_Rpatt:
  122. BIT B,#80h
  123. JRS NZ,_BGM_Rpattsub
  124. LD HL,[_pmmusram_bgm_ptb]
  125. ADD HL,BA
  126. LD [_pmmusram_bgm_ptb],HL
  127. LD A,[_pmmusram_bgm_ptb+2]
  128. JRS NC,_BGM_Rpatt_noinc1
  129. INC A
  130. LD [_pmmusram_bgm_ptb+2],A
  131. _BGM_Rpatt_noinc1:
  132. JRS _BGM_Rpatt_set
  133. _BGM_Rpattsub:
  134. LD HL,[_pmmusram_bgm_ptb]
  135. ADD HL,BA
  136. LD [_pmmusram_bgm_ptb],HL
  137. LD A,[_pmmusram_bgm_ptb+2]
  138. JRS C,_BGM_Rpatt_noinc2
  139. INC A
  140. LD [_pmmusram_bgm_ptb+2],A
  141. _BGM_Rpatt_noinc2:
  142. _BGM_Rpatt_set:
  143. LD EP,A
  144. LD BA,[HL]
  145. INC HL
  146. INC HL
  147. LD L,[HL]
  148. LD EP,#00h
  149. LD [_pmmusram_bgm_ppr],BA
  150. LD [_pmmusram_bgm_ppr+2],L
  151. _BGM_Cloop:
  152. LD A,#80h
  153. AND A,[_pmmusram_aud_cfg]
  154. JRS Z,_BGM_Cdone
  155. INC IX
  156. INC IX
  157. JRS NZ,_BGM_Rloop
  158. LD A,XP
  159. INC A
  160. LD XP,A
  161. _BGM_Rloop:
  162. LD HL,[IX]
  163. AND H,#0Ch
  164. CP L,#00h
  165. JRS NZ,_BGM_Rloop_loop
  166. LD A,H
  167. LD B,#00h
  168. LD HL,pmmusram_bgm_loop0
  169. ADD HL,BA
  170. LD BA,[_pmmusram_bgm_ppr]
  171. LD [HL],BA
  172. INC HL
  173. INC HL
  174. LD A,[_pmmusram_bgm_ppr+2]
  175. LD [HL],A
  176. INC HL
  177. XOR A,A
  178. LD [HL],A
  179. JRS _BGM_Cdone
  180. _BGM_Rloop_loop:
  181. LD A,H
  182. LD B,#00h
  183. LD HL,pmmusram_bgm_loop0+3
  184. ADD HL,BA
  185. LD A,[IX]
  186. CP A,[HL]
  187. JRS Z,_BGM_Cdone
  188. INC [HL]
  189. DEC HL
  190. LD A,[HL]
  191. LD [_pmmusram_bgm_ppr+2],A
  192. DEC HL
  193. DEC HL
  194. LD BA,[HL]
  195. LD [_pmmusram_bgm_ppr],BA
  196. _BGM_Cdone:
  197. LD A,#FFh
  198. AND A,[_pmmusram_bgm_wait]
  199. JRL Z,_goBGM
  200. LD A,[_pmmusram_sfx_mvol]
  201. CP A,#00h
  202. JRS Z,_setBGMaudio
  203. LD A,#02h
  204. AND A,[_pmmusram_aud_ena]
  205. JRS NZ,_checkSFX
  206. _setBGMaudio:
  207. LD HL,[_pmmusram_bgm_frq]
  208. LD [204Ah],HL ; TMR3_PRE = HL
  209. LD HL,[_pmmusram_bgm_pvt]
  210. LD A,[_pmmusram_bgm_pvol]
  211. BIT A,#04h
  212. JRS Z,_BGM_noSHRpivot
  213. LD BA,HL
  214. SRL B
  215. RR A
  216. SRL B
  217. RR A
  218. SRL B
  219. RR A
  220. SRL B
  221. RR A
  222. SRL B
  223. RR A
  224. LD HL,BA
  225. LD A,[_pmmusram_bgm_pvol]
  226. _BGM_noSHRpivot:
  227. LD [204Ch],HL ; TMR3_PVT = HL
  228. AND A,#03h
  229. LD [BR:71h],A ; AUD_VOL = A
  230. _checkSFX:
  231. LD A,#02h
  232. AND A,[_pmmusram_aud_ena]
  233. JRL Z,_goEND
  234. _decwaitSFX:
  235. LD HL,_pmmusram_sfx_wait
  236. DEC [HL]
  237. JRL NZ,_goEND
  238. _goSFX:
  239. LD IX,[_pmmusram_sfx_ppr]
  240. LD A,[_pmmusram_sfx_ppr+2]
  241. LD XP,A
  242. LD BA,[IX]
  243. LD [_pmmusram_sfx_wait],A
  244. LD [_pmmusram_aud_cfg],B
  245. BIT B,#04h
  246. JRS Z,_SFXnovol
  247. LD A,B
  248. LD B,#00h
  249. AND A,#03h
  250. LD HL,_pmmusram_sfx_tvol
  251. ADD HL,BA
  252. LD A,[HL]
  253. LD [_pmmusram_sfx_pvol],A
  254. _SFXnovol:
  255. LD B,#00h
  256. LD A,[_pmmusram_aud_cfg]
  257. SRL A
  258. SRL A
  259. SRL A
  260. LD HL,_pmmusic_cmdextableadd
  261. ADD HL,BA
  262. LD A,[HL]
  263. LD HL,IX
  264. ADD HL,BA
  265. LD [_pmmusram_sfx_ppr],HL
  266. JRS NC,_sfx_noinc1
  267. LD HL,_pmmusram_sfx_ppr+2
  268. INC [HL]
  269. _sfx_noinc1:
  270. _SFX_Cwriteram:
  271. LD A,#08h
  272. AND A,[_pmmusram_aud_cfg]
  273. JRS Z,_SFX_Csetfreq
  274. INC IX
  275. INC IX
  276. JRS NZ,_SFX_Rwriteram
  277. LD A,XP
  278. INC A
  279. LD XP,A
  280. _SFX_Rwriteram:
  281. LD HL,[_pmmusram_ram_ptr]
  282. LD B,#00h
  283. LD A,[IX+01h]
  284. ADD HL,BA
  285. LD [HL],[IX]
  286. _SFX_Csetfreq:
  287. LD A,#10h
  288. AND A,[_pmmusram_aud_cfg]
  289. JRS Z,_SFX_Csetpivot
  290. INC IX
  291. INC IX
  292. JRS NZ,_SFX_Rsetfreq
  293. LD A,XP
  294. INC A
  295. LD XP,A
  296. _SFX_Rsetfreq:
  297. LD BA,[IX]
  298. LD [_pmmusram_sfx_frq],BA
  299. _SFX_Csetpivot:
  300. LD A,#20h
  301. AND A,[_pmmusram_aud_cfg]
  302. JRS Z,_SFX_Cnextend
  303. INC IX
  304. INC IX
  305. JRS NZ,_SFX_Rsetpivot
  306. LD A,XP
  307. INC A
  308. LD XP,A
  309. _SFX_Rsetpivot:
  310. LD BA,[IX]
  311. LD [_pmmusram_sfx_pvt],BA
  312. _SFX_Cnextend:
  313. LD A,#40h
  314. AND A,[_pmmusram_aud_cfg]
  315. JRS Z,_SFX_Cloop
  316. INC IX
  317. INC IX
  318. JRS NZ,_SFX_Rnextend
  319. LD A,XP
  320. INC A
  321. LD XP,A
  322. _SFX_Rnextend:
  323. PUSH SC
  324. PUSH BA
  325. LD SC,#C0h
  326. LD A,#01h
  327. AND A,[_pmmusram_aud_ena]
  328. LD [_pmmusram_aud_ena],A
  329. JRS NZ,_endsfx
  330. PUSH EP
  331. LD EP,#00h
  332. AND [BR:23h],#DFh
  333. AND [BR:38h],#FBh
  334. AND [BR:48h],#FBh
  335. POP EP
  336. _endsfx:
  337. POP BA
  338. POP SC
  339. _SFX_Cloop:
  340. LD A,#80h
  341. AND A,[_pmmusram_aud_cfg]
  342. JRS Z,_SFX_Cdone
  343. INC IX
  344. INC IX
  345. JRS NZ,_SFX_Rloop
  346. LD A,XP
  347. INC A
  348. LD XP,A
  349. _SFX_Rloop:
  350. LD HL,[IX]
  351. AND H,#0Ch
  352. CP L,#00h
  353. JRS NZ,_SFX_Rloop_loop
  354. LD A,H
  355. LD B,#00h
  356. LD HL,_pmmusram_sfx_loop0
  357. ADD HL,BA
  358. LD BA,[_pmmusram_sfx_ppr]
  359. LD [HL],BA
  360. INC HL
  361. INC HL
  362. LD A,[_pmmusram_sfx_ppr+2]
  363. LD [HL],A
  364. INC HL
  365. XOR A,A
  366. LD [HL],A
  367. JRS _SFX_Cdone
  368. _SFX_Rloop_loop:
  369. LD A,H
  370. LD B,#00h
  371. LD HL,_pmmusram_sfx_loop0+3
  372. ADD HL,BA
  373. LD A,[IX]
  374. CP A,[HL]
  375. JRS Z,_SFX_Cdone
  376. INC [HL]
  377. DEC HL
  378. LD A,[HL]
  379. LD [_pmmusram_sfx_ppr+2],A
  380. DEC HL
  381. DEC HL
  382. LD BA,[HL]
  383. LD [_pmmusram_sfx_ppr],BA
  384. _SFX_Cdone:
  385. LD A,#FFh
  386. AND A,[_pmmusram_sfx_wait]
  387. JRL Z,_goSFX
  388. LD A,[_pmmusram_sfx_mvol]
  389. CP A,#00h
  390. JRS Z,_goEND
  391. _setSFXaudio:
  392. LD HL,[_pmmusram_sfx_frq]
  393. LD [204Ah],HL ; TMR3_PRE = HL
  394. LD HL,[_pmmusram_sfx_pvt]
  395. LD A,[_pmmusram_sfx_pvol]
  396. BIT A,#04h
  397. JRS Z,_SFX_noSHRpivot
  398. LD BA,HL
  399. SRL B
  400. RR A
  401. SRL B
  402. RR A
  403. SRL B
  404. RR A
  405. SRL B
  406. RR A
  407. SRL B
  408. RR A
  409. LD HL,BA
  410. LD A,[_pmmusram_sfx_pvol]
  411. _SFX_noSHRpivot:
  412. LD [204Ch],HL ; TMR3_PVT = HL
  413. AND A,#03h
  414. LD [BR:71h],A ; AUD_VOL = A
  415. _goEND:
  416. POP IP
  417. POP EP
  418. POP IX
  419. POP HL
  420. POP BA
  421. LD [BR:27h],#20h
  422. RETE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement