Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- irq_tmr2_hi:
- PUSH BA
- PUSH HL
- PUSH IX
- PUSH EP
- PUSH IP
- LD EP,#00h
- _checkBGM:
- LD A,#01h
- AND A,[_pmmusram_aud_ena]
- JRL Z,_checkSFX
- _decwaitBGM:
- LD HL,_pmmusram_bgm_wait
- DEC [HL]
- JRL NZ,_checkSFX
- _goBGM:
- LD IX,[_pmmusram_bgm_ppr]
- LD A,[_pmmusram_bgm_ppr+2]
- LD XP,A
- LD BA,[IX]
- LD [_pmmusram_bgm_wait],A
- LD [_pmmusram_aud_cfg],B
- BIT B,#04h
- JRS Z,_BGMnovol
- LD A,B
- LD B,#00h
- AND A,#03h
- LD HL,_pmmusram_bgm_tvol
- ADD HL,BA
- LD A,[HL]
- LD [_pmmusram_bgm_pvol],A
- _BGMnovol:
- LD B,#00h
- LD A,[_pmmusram_aud_cfg]
- SRL A
- SRL A
- SRL A
- LD HL,_pmmusic_cmdextableadd
- ADD HL,BA
- LD A,[HL]
- LD HL,IX
- ADD HL,BA
- LD [_pmmusram_bgm_ppr],HL
- JRS NC,_bgm_noinc1
- LD HL,_pmmusram_bgm_ppr+2
- INC [HL]
- _bgm_noinc1:
- _BGM_Cwriteram:
- LD A,#08h
- AND A,[_pmmusram_aud_cfg]
- JRS Z,_BGM_Csetfreq
- INC IX
- INC IX
- JRS NZ,_BGM_Rwriteram
- LD A,XP
- INC A
- LD XP,A
- _BGM_Rwriteram:
- LD HL,[_pmmusram_ram_ptr]
- LD B,#00h
- LD A,[IX+01h]
- ADD HL,BA
- LD [HL],[IX]
- _BGM_Csetfreq:
- LD A,#10h
- AND A,[_pmmusram_aud_cfg]
- JRS Z,_BGM_Csetpivot
- INC IX
- INC IX
- JRS NZ,_BGM_Rsetfreq
- LD A,XP
- INC A
- LD XP,A
- _BGM_Rsetfreq:
- LD BA,[IX]
- LD [_pmmusram_bgm_frq],BA
- _BGM_Csetpivot:
- LD A,#20h
- AND A,[_pmmusram_aud_cfg]
- JRS Z,_BGM_Cnextend
- INC IX
- INC IX
- JRS NZ,_BGM_Rsetpivot
- LD A,XP
- INC A
- LD XP,A
- _BGM_Rsetpivot:
- LD BA,[IX]
- LD [_pmmusram_bgm_pvt],BA
- _BGM_Cnextend:
- LD A,#40h
- AND A,[_pmmusram_aud_cfg]
- JRS Z,_BGM_Cloop
- INC IX
- INC IX
- JRS NZ,_BGM_Rnextend
- LD A,XP
- INC A
- LD XP,A
- _BGM_Rnextend:
- LD BA,[IX]
- CP BA,0000h
- JRS NZ,_BGM_Rpatt
- PUSH SC
- PUSH BA
- LD SC,#C0h
- LD A,#02h
- AND A,[_pmmusram_aud_ena]
- LD [_pmmusram_aud_ena],A
- JRS NZ,_end
- PUSH EP
- LD EP,#00h
- AND [BR:23h],#DFh
- AND [BR:38h],#FBh
- AND [BR:48h],#FBh
- POP EP
- _end:
- POP BA
- POP SC
- JRS _BGM_Cloop
- _BGM_Rpatt:
- BIT B,#80h
- JRS NZ,_BGM_Rpattsub
- LD HL,[_pmmusram_bgm_ptb]
- ADD HL,BA
- LD [_pmmusram_bgm_ptb],HL
- LD A,[_pmmusram_bgm_ptb+2]
- JRS NC,_BGM_Rpatt_noinc1
- INC A
- LD [_pmmusram_bgm_ptb+2],A
- _BGM_Rpatt_noinc1:
- JRS _BGM_Rpatt_set
- _BGM_Rpattsub:
- LD HL,[_pmmusram_bgm_ptb]
- ADD HL,BA
- LD [_pmmusram_bgm_ptb],HL
- LD A,[_pmmusram_bgm_ptb+2]
- JRS C,_BGM_Rpatt_noinc2
- INC A
- LD [_pmmusram_bgm_ptb+2],A
- _BGM_Rpatt_noinc2:
- _BGM_Rpatt_set:
- LD EP,A
- LD BA,[HL]
- INC HL
- INC HL
- LD L,[HL]
- LD EP,#00h
- LD [_pmmusram_bgm_ppr],BA
- LD [_pmmusram_bgm_ppr+2],L
- _BGM_Cloop:
- LD A,#80h
- AND A,[_pmmusram_aud_cfg]
- JRS Z,_BGM_Cdone
- INC IX
- INC IX
- JRS NZ,_BGM_Rloop
- LD A,XP
- INC A
- LD XP,A
- _BGM_Rloop:
- LD HL,[IX]
- AND H,#0Ch
- CP L,#00h
- JRS NZ,_BGM_Rloop_loop
- LD A,H
- LD B,#00h
- LD HL,pmmusram_bgm_loop0
- ADD HL,BA
- LD BA,[_pmmusram_bgm_ppr]
- LD [HL],BA
- INC HL
- INC HL
- LD A,[_pmmusram_bgm_ppr+2]
- LD [HL],A
- INC HL
- XOR A,A
- LD [HL],A
- JRS _BGM_Cdone
- _BGM_Rloop_loop:
- LD A,H
- LD B,#00h
- LD HL,pmmusram_bgm_loop0+3
- ADD HL,BA
- LD A,[IX]
- CP A,[HL]
- JRS Z,_BGM_Cdone
- INC [HL]
- DEC HL
- LD A,[HL]
- LD [_pmmusram_bgm_ppr+2],A
- DEC HL
- DEC HL
- LD BA,[HL]
- LD [_pmmusram_bgm_ppr],BA
- _BGM_Cdone:
- LD A,#FFh
- AND A,[_pmmusram_bgm_wait]
- JRL Z,_goBGM
- LD A,[_pmmusram_sfx_mvol]
- CP A,#00h
- JRS Z,_setBGMaudio
- LD A,#02h
- AND A,[_pmmusram_aud_ena]
- JRS NZ,_checkSFX
- _setBGMaudio:
- LD HL,[_pmmusram_bgm_frq]
- LD [204Ah],HL ; TMR3_PRE = HL
- LD HL,[_pmmusram_bgm_pvt]
- LD A,[_pmmusram_bgm_pvol]
- BIT A,#04h
- JRS Z,_BGM_noSHRpivot
- LD BA,HL
- SRL B
- RR A
- SRL B
- RR A
- SRL B
- RR A
- SRL B
- RR A
- SRL B
- RR A
- LD HL,BA
- LD A,[_pmmusram_bgm_pvol]
- _BGM_noSHRpivot:
- LD [204Ch],HL ; TMR3_PVT = HL
- AND A,#03h
- LD [BR:71h],A ; AUD_VOL = A
- _checkSFX:
- LD A,#02h
- AND A,[_pmmusram_aud_ena]
- JRL Z,_goEND
- _decwaitSFX:
- LD HL,_pmmusram_sfx_wait
- DEC [HL]
- JRL NZ,_goEND
- _goSFX:
- LD IX,[_pmmusram_sfx_ppr]
- LD A,[_pmmusram_sfx_ppr+2]
- LD XP,A
- LD BA,[IX]
- LD [_pmmusram_sfx_wait],A
- LD [_pmmusram_aud_cfg],B
- BIT B,#04h
- JRS Z,_SFXnovol
- LD A,B
- LD B,#00h
- AND A,#03h
- LD HL,_pmmusram_sfx_tvol
- ADD HL,BA
- LD A,[HL]
- LD [_pmmusram_sfx_pvol],A
- _SFXnovol:
- LD B,#00h
- LD A,[_pmmusram_aud_cfg]
- SRL A
- SRL A
- SRL A
- LD HL,_pmmusic_cmdextableadd
- ADD HL,BA
- LD A,[HL]
- LD HL,IX
- ADD HL,BA
- LD [_pmmusram_sfx_ppr],HL
- JRS NC,_sfx_noinc1
- LD HL,_pmmusram_sfx_ppr+2
- INC [HL]
- _sfx_noinc1:
- _SFX_Cwriteram:
- LD A,#08h
- AND A,[_pmmusram_aud_cfg]
- JRS Z,_SFX_Csetfreq
- INC IX
- INC IX
- JRS NZ,_SFX_Rwriteram
- LD A,XP
- INC A
- LD XP,A
- _SFX_Rwriteram:
- LD HL,[_pmmusram_ram_ptr]
- LD B,#00h
- LD A,[IX+01h]
- ADD HL,BA
- LD [HL],[IX]
- _SFX_Csetfreq:
- LD A,#10h
- AND A,[_pmmusram_aud_cfg]
- JRS Z,_SFX_Csetpivot
- INC IX
- INC IX
- JRS NZ,_SFX_Rsetfreq
- LD A,XP
- INC A
- LD XP,A
- _SFX_Rsetfreq:
- LD BA,[IX]
- LD [_pmmusram_sfx_frq],BA
- _SFX_Csetpivot:
- LD A,#20h
- AND A,[_pmmusram_aud_cfg]
- JRS Z,_SFX_Cnextend
- INC IX
- INC IX
- JRS NZ,_SFX_Rsetpivot
- LD A,XP
- INC A
- LD XP,A
- _SFX_Rsetpivot:
- LD BA,[IX]
- LD [_pmmusram_sfx_pvt],BA
- _SFX_Cnextend:
- LD A,#40h
- AND A,[_pmmusram_aud_cfg]
- JRS Z,_SFX_Cloop
- INC IX
- INC IX
- JRS NZ,_SFX_Rnextend
- LD A,XP
- INC A
- LD XP,A
- _SFX_Rnextend:
- PUSH SC
- PUSH BA
- LD SC,#C0h
- LD A,#01h
- AND A,[_pmmusram_aud_ena]
- LD [_pmmusram_aud_ena],A
- JRS NZ,_endsfx
- PUSH EP
- LD EP,#00h
- AND [BR:23h],#DFh
- AND [BR:38h],#FBh
- AND [BR:48h],#FBh
- POP EP
- _endsfx:
- POP BA
- POP SC
- _SFX_Cloop:
- LD A,#80h
- AND A,[_pmmusram_aud_cfg]
- JRS Z,_SFX_Cdone
- INC IX
- INC IX
- JRS NZ,_SFX_Rloop
- LD A,XP
- INC A
- LD XP,A
- _SFX_Rloop:
- LD HL,[IX]
- AND H,#0Ch
- CP L,#00h
- JRS NZ,_SFX_Rloop_loop
- LD A,H
- LD B,#00h
- LD HL,_pmmusram_sfx_loop0
- ADD HL,BA
- LD BA,[_pmmusram_sfx_ppr]
- LD [HL],BA
- INC HL
- INC HL
- LD A,[_pmmusram_sfx_ppr+2]
- LD [HL],A
- INC HL
- XOR A,A
- LD [HL],A
- JRS _SFX_Cdone
- _SFX_Rloop_loop:
- LD A,H
- LD B,#00h
- LD HL,_pmmusram_sfx_loop0+3
- ADD HL,BA
- LD A,[IX]
- CP A,[HL]
- JRS Z,_SFX_Cdone
- INC [HL]
- DEC HL
- LD A,[HL]
- LD [_pmmusram_sfx_ppr+2],A
- DEC HL
- DEC HL
- LD BA,[HL]
- LD [_pmmusram_sfx_ppr],BA
- _SFX_Cdone:
- LD A,#FFh
- AND A,[_pmmusram_sfx_wait]
- JRL Z,_goSFX
- LD A,[_pmmusram_sfx_mvol]
- CP A,#00h
- JRS Z,_goEND
- _setSFXaudio:
- LD HL,[_pmmusram_sfx_frq]
- LD [204Ah],HL ; TMR3_PRE = HL
- LD HL,[_pmmusram_sfx_pvt]
- LD A,[_pmmusram_sfx_pvol]
- BIT A,#04h
- JRS Z,_SFX_noSHRpivot
- LD BA,HL
- SRL B
- RR A
- SRL B
- RR A
- SRL B
- RR A
- SRL B
- RR A
- SRL B
- RR A
- LD HL,BA
- LD A,[_pmmusram_sfx_pvol]
- _SFX_noSHRpivot:
- LD [204Ch],HL ; TMR3_PVT = HL
- AND A,#03h
- LD [BR:71h],A ; AUD_VOL = A
- _goEND:
- POP IP
- POP EP
- POP IX
- POP HL
- POP BA
- LD [BR:27h],#20h
- RETE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement