mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
audio flag constants
This commit is contained in:
parent
7d8cb98c76
commit
0549e3413f
233
audio/engine.asm
233
audio/engine.asm
@ -102,7 +102,7 @@ _UpdateSound:: ; e805c
|
|||||||
; is the channel active?
|
; is the channel active?
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jp z, .nextchannel
|
jp z, .nextchannel
|
||||||
; check time left in the current note
|
; check time left in the current note
|
||||||
ld hl, Channel1NoteDuration - Channel1
|
ld hl, Channel1NoteDuration - Channel1
|
||||||
@ -112,6 +112,7 @@ _UpdateSound:: ; e805c
|
|||||||
jr c, .noteover
|
jr c, .noteover
|
||||||
dec [hl]
|
dec [hl]
|
||||||
jr .asm_e8093
|
jr .asm_e8093
|
||||||
|
|
||||||
.noteover
|
.noteover
|
||||||
; reset vibrato delay
|
; reset vibrato delay
|
||||||
ld hl, Channel1VibratoDelay - Channel1
|
ld hl, Channel1VibratoDelay - Channel1
|
||||||
@ -123,7 +124,7 @@ _UpdateSound:: ; e805c
|
|||||||
; turn vibrato off for now
|
; turn vibrato off for now
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
res 1, [hl]
|
res SOUND_UNKN_09, [hl]
|
||||||
; get next note
|
; get next note
|
||||||
call ParseMusic
|
call ParseMusic
|
||||||
.asm_e8093
|
.asm_e8093
|
||||||
@ -156,21 +157,21 @@ _UpdateSound:: ; e805c
|
|||||||
; are any sfx channels active?
|
; are any sfx channels active?
|
||||||
; if so, mute
|
; if so, mute
|
||||||
ld hl, Channel5Flags
|
ld hl, Channel5Flags
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jr nz, .restnote
|
jr nz, .restnote
|
||||||
ld hl, Channel6Flags
|
ld hl, Channel6Flags
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jr nz, .restnote
|
jr nz, .restnote
|
||||||
ld hl, Channel7Flags
|
ld hl, Channel7Flags
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jr nz, .restnote
|
jr nz, .restnote
|
||||||
ld hl, Channel8Flags
|
ld hl, Channel8Flags
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jr z, .next
|
jr z, .next
|
||||||
.restnote
|
.restnote
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 5, [hl] ; Rest
|
set NOTE_REST, [hl] ; Rest
|
||||||
.next
|
.next
|
||||||
; are we in a sfx channel right now?
|
; are we in a sfx channel right now?
|
||||||
ld a, [CurChannel]
|
ld a, [CurChannel]
|
||||||
@ -178,7 +179,7 @@ _UpdateSound:: ; e805c
|
|||||||
jr nc, .asm_e80ee
|
jr nc, .asm_e80ee
|
||||||
ld hl, Channel5Flags - Channel1
|
ld hl, Channel5Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jr nz, .asm_e80fc
|
jr nz, .asm_e80fc
|
||||||
.asm_e80ee
|
.asm_e80ee
|
||||||
call UpdateChannels
|
call UpdateChannels
|
||||||
@ -231,6 +232,7 @@ UpdateChannels: ; e8125
|
|||||||
ld l, a
|
ld l, a
|
||||||
jp [hl]
|
jp [hl]
|
||||||
|
|
||||||
|
|
||||||
.ChannelFnPtrs
|
.ChannelFnPtrs
|
||||||
dw .Channel1
|
dw .Channel1
|
||||||
dw .Channel2
|
dw .Channel2
|
||||||
@ -250,28 +252,29 @@ UpdateChannels: ; e8125
|
|||||||
.Channel5
|
.Channel5
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 3, [hl]
|
bit NOTE_UNKN_3, [hl]
|
||||||
jr z, .asm_e8159
|
jr z, .asm_e8159
|
||||||
;
|
;
|
||||||
ld a, [SoundInput]
|
ld a, [SoundInput]
|
||||||
ld [rNR10], a
|
ld [rNR10], a
|
||||||
.asm_e8159
|
.asm_e8159
|
||||||
bit 5, [hl] ; rest
|
bit NOTE_REST, [hl] ; rest
|
||||||
jr nz, .ch1rest
|
jr nz, .ch1rest
|
||||||
bit 4, [hl]
|
bit NOTE_UNKN_4, [hl]
|
||||||
jr nz, .asm_e81a2
|
jr nz, .asm_e81a2
|
||||||
bit 1, [hl]
|
bit NOTE_UNKN_1, [hl]
|
||||||
jr nz, .asm_e816b
|
jr nz, .asm_e816b
|
||||||
bit 6, [hl]
|
bit NOTE_UNKN_6, [hl]
|
||||||
jr nz, .asm_e8184
|
jr nz, .asm_e8184
|
||||||
jr .asm_e8175
|
jr .asm_e8175
|
||||||
|
|
||||||
.asm_e816b
|
.asm_e816b
|
||||||
ld a, [wCurTrackFrequency]
|
ld a, [wCurTrackFrequency]
|
||||||
ld [rNR13], a
|
ld [rNR13], a
|
||||||
ld a, [wCurTrackFrequency + 1]
|
ld a, [wCurTrackFrequency + 1]
|
||||||
ld [rNR14], a
|
ld [rNR14], a
|
||||||
.asm_e8175
|
.asm_e8175
|
||||||
bit 0, [hl]
|
bit NOTE_UNKN_0, [hl]
|
||||||
ret z
|
ret z
|
||||||
ld a, [wCurTrackDuty]
|
ld a, [wCurTrackDuty]
|
||||||
ld d, a
|
ld d, a
|
||||||
@ -318,13 +321,13 @@ UpdateChannels: ; e8125
|
|||||||
.Channel6
|
.Channel6
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 5, [hl] ; rest
|
bit NOTE_REST, [hl] ; rest
|
||||||
jr nz, .ch2rest
|
jr nz, .ch2rest
|
||||||
bit 4, [hl]
|
bit NOTE_UNKN_4, [hl]
|
||||||
jr nz, .asm_e8204
|
jr nz, .asm_e8204
|
||||||
bit 6, [hl]
|
bit NOTE_UNKN_6, [hl]
|
||||||
jr nz, .asm_e81e6
|
jr nz, .asm_e81e6
|
||||||
bit 0, [hl]
|
bit NOTE_UNKN_0, [hl]
|
||||||
ret z
|
ret z
|
||||||
ld a, [wCurTrackDuty]
|
ld a, [wCurTrackDuty]
|
||||||
ld d, a
|
ld d, a
|
||||||
@ -378,11 +381,11 @@ UpdateChannels: ; e8125
|
|||||||
.Channel7
|
.Channel7
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 5, [hl] ; rest
|
bit NOTE_REST, [hl] ; rest
|
||||||
jr nz, .ch3rest
|
jr nz, .ch3rest
|
||||||
bit 4, [hl]
|
bit NOTE_UNKN_4, [hl]
|
||||||
jr nz, .asm_e824d
|
jr nz, .asm_e824d
|
||||||
bit 6, [hl]
|
bit NOTE_UNKN_6, [hl]
|
||||||
jr nz, .asm_e823a
|
jr nz, .asm_e823a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -479,9 +482,9 @@ endr
|
|||||||
.Channel8
|
.Channel8
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 5, [hl] ; rest
|
bit NOTE_REST, [hl] ; rest
|
||||||
jr nz, .ch4rest
|
jr nz, .ch4rest
|
||||||
bit 4, [hl]
|
bit NOTE_UNKN_4, [hl]
|
||||||
jr nz, .asm_e82d4
|
jr nz, .asm_e82d4
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -514,16 +517,16 @@ endr
|
|||||||
_CheckSFX: ; e82e7
|
_CheckSFX: ; e82e7
|
||||||
; return carry if any sfx channels are active
|
; return carry if any sfx channels are active
|
||||||
ld hl, Channel5Flags
|
ld hl, Channel5Flags
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jr nz, .sfxon
|
jr nz, .sfxon
|
||||||
ld hl, Channel6Flags
|
ld hl, Channel6Flags
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jr nz, .sfxon
|
jr nz, .sfxon
|
||||||
ld hl, Channel7Flags
|
ld hl, Channel7Flags
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jr nz, .sfxon
|
jr nz, .sfxon
|
||||||
ld hl, Channel8Flags
|
ld hl, Channel8Flags
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jr nz, .sfxon
|
jr nz, .sfxon
|
||||||
and a
|
and a
|
||||||
ret
|
ret
|
||||||
@ -547,9 +550,11 @@ PlayDanger: ; e8307
|
|||||||
cp 16 ; halfway
|
cp 16 ; halfway
|
||||||
jr z, .asm_e831e
|
jr z, .asm_e831e
|
||||||
jr .asm_e8335
|
jr .asm_e8335
|
||||||
|
|
||||||
.asm_e831e
|
.asm_e831e
|
||||||
ld hl, Tablee8354
|
ld hl, Tablee8354
|
||||||
jr .updatehw
|
jr .updatehw
|
||||||
|
|
||||||
.asm_e8323
|
.asm_e8323
|
||||||
ld hl, Tablee8350
|
ld hl, Tablee8350
|
||||||
.updatehw
|
.updatehw
|
||||||
@ -639,6 +644,7 @@ FadeMusic: ; e8358
|
|||||||
dec a
|
dec a
|
||||||
jr .updatevolume
|
jr .updatevolume
|
||||||
|
|
||||||
|
|
||||||
.novolume
|
.novolume
|
||||||
; make sure volume is off
|
; make sure volume is off
|
||||||
xor a
|
xor a
|
||||||
@ -695,6 +701,7 @@ FadeMusic: ; e8358
|
|||||||
; inc volume
|
; inc volume
|
||||||
inc a
|
inc a
|
||||||
jr .updatevolume
|
jr .updatevolume
|
||||||
|
|
||||||
.maxvolume
|
.maxvolume
|
||||||
; we're done
|
; we're done
|
||||||
xor a
|
xor a
|
||||||
@ -715,7 +722,7 @@ LoadNote: ; e83d1
|
|||||||
; check mute??
|
; check mute??
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 1, [hl]
|
bit SOUND_UNKN_09, [hl]
|
||||||
ret z
|
ret z
|
||||||
; get note duration
|
; get note duration
|
||||||
ld hl, Channel1NoteDuration - Channel1
|
ld hl, Channel1NoteDuration - Channel1
|
||||||
@ -750,7 +757,7 @@ LoadNote: ; e83d1
|
|||||||
; ????
|
; ????
|
||||||
ld hl, Channel1Flags3 - Channel1
|
ld hl, Channel1Flags3 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 1, [hl]
|
set SOUND_UNKN_11, [hl]
|
||||||
; get frequency
|
; get frequency
|
||||||
ld hl, Channel1Frequency - Channel1
|
ld hl, Channel1Frequency - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@ -773,11 +780,12 @@ LoadNote: ; e83d1
|
|||||||
sub d
|
sub d
|
||||||
ld d, a
|
ld d, a
|
||||||
jr .asm_e843e
|
jr .asm_e843e
|
||||||
|
|
||||||
.asm_e8420
|
.asm_e8420
|
||||||
; ????
|
; ????
|
||||||
ld hl, Channel1Flags3 - Channel1
|
ld hl, Channel1Flags3 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
res 1, [hl]
|
res SOUND_UNKN_11, [hl]
|
||||||
; get frequency
|
; get frequency
|
||||||
ld hl, Channel1Frequency - Channel1
|
ld hl, Channel1Frequency - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@ -813,6 +821,7 @@ LoadNote: ; e83d1
|
|||||||
jr z, .quit
|
jr z, .quit
|
||||||
dec d
|
dec d
|
||||||
jr .loop
|
jr .loop
|
||||||
|
|
||||||
.quit
|
.quit
|
||||||
ld a, e ; result
|
ld a, e ; result
|
||||||
add [hl]
|
add [hl]
|
||||||
@ -839,7 +848,7 @@ Functione8466: ; e8466
|
|||||||
; unknowns: wCurTrackDuty, wCurTrackFrequency
|
; unknowns: wCurTrackDuty, wCurTrackFrequency
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 2, [hl] ; duty
|
bit SOUND_DUTY, [hl] ; duty
|
||||||
jr z, .next
|
jr z, .next
|
||||||
ld hl, Channel1Field0x1c - Channel1
|
ld hl, Channel1Field0x1c - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@ -851,11 +860,11 @@ Functione8466: ; e8466
|
|||||||
ld [wCurTrackDuty], a
|
ld [wCurTrackDuty], a
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 0, [hl]
|
set NOTE_UNKN_0, [hl]
|
||||||
.next
|
.next
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 4, [hl]
|
bit SOUND_CRY_PITCH, [hl]
|
||||||
jr z, .vibrato
|
jr z, .vibrato
|
||||||
ld hl, Channel1CryPitch - Channel1
|
ld hl, Channel1CryPitch - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@ -877,7 +886,7 @@ Functione8466: ; e8466
|
|||||||
; is vibrato on?
|
; is vibrato on?
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 0, [hl] ; vibrato
|
bit SOUND_VIBRATO, [hl] ; vibrato
|
||||||
jr z, .quit
|
jr z, .quit
|
||||||
; is vibrato active for this note yet?
|
; is vibrato active for this note yet?
|
||||||
; is the delay over?
|
; is the delay over?
|
||||||
@ -903,6 +912,7 @@ Functione8466: ; e8466
|
|||||||
.subexit
|
.subexit
|
||||||
dec [hl]
|
dec [hl]
|
||||||
jr .quit
|
jr .quit
|
||||||
|
|
||||||
.toggle
|
.toggle
|
||||||
; refresh count
|
; refresh count
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
@ -915,11 +925,11 @@ Functione8466: ; e8466
|
|||||||
; toggle vibrato up/down
|
; toggle vibrato up/down
|
||||||
ld hl, Channel1Flags3 - Channel1
|
ld hl, Channel1Flags3 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 0, [hl] ; vibrato up/down
|
bit SOUND_VIBRATO_DIR, [hl] ; vibrato up/down
|
||||||
jr z, .down
|
jr z, .down
|
||||||
; up
|
; up
|
||||||
; vibrato down
|
; vibrato down
|
||||||
res 0, [hl]
|
res SOUND_VIBRATO_DIR, [hl]
|
||||||
; get the delay
|
; get the delay
|
||||||
ld a, d
|
ld a, d
|
||||||
and $f ; lo
|
and $f ; lo
|
||||||
@ -930,9 +940,10 @@ Functione8466: ; e8466
|
|||||||
jr nc, .asm_e84ef
|
jr nc, .asm_e84ef
|
||||||
ld a, 0
|
ld a, 0
|
||||||
jr .asm_e84ef
|
jr .asm_e84ef
|
||||||
|
|
||||||
.down
|
.down
|
||||||
; vibrato up
|
; vibrato up
|
||||||
set 0, [hl]
|
set SOUND_VIBRATO_DIR, [hl]
|
||||||
; get the delay
|
; get the delay
|
||||||
ld a, d
|
ld a, d
|
||||||
and $f0 ; hi
|
and $f0 ; hi
|
||||||
@ -946,7 +957,7 @@ Functione8466: ; e8466
|
|||||||
;
|
;
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 6, [hl]
|
set NOTE_UNKN_6, [hl]
|
||||||
.quit
|
.quit
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -956,7 +967,7 @@ Functione84f9: ; e84f9
|
|||||||
; quit if ????
|
; quit if ????
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 1, [hl]
|
bit SOUND_UNKN_09, [hl]
|
||||||
ret z
|
ret z
|
||||||
; de = Frequency
|
; de = Frequency
|
||||||
ld hl, Channel1Frequency - Channel1
|
ld hl, Channel1Frequency - Channel1
|
||||||
@ -967,7 +978,7 @@ Functione84f9: ; e84f9
|
|||||||
;
|
;
|
||||||
ld hl, Channel1Flags3 - Channel1
|
ld hl, Channel1Flags3 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 1, [hl]
|
bit SOUND_UNKN_11, [hl]
|
||||||
jr z, .next
|
jr z, .next
|
||||||
;
|
;
|
||||||
ld hl, Channel1Field0x23 - Channel1
|
ld hl, Channel1Field0x23 - Channel1
|
||||||
@ -1005,6 +1016,7 @@ Functione84f9: ; e84f9
|
|||||||
cp e
|
cp e
|
||||||
jp c, .quit1
|
jp c, .quit1
|
||||||
jr .quit2
|
jr .quit2
|
||||||
|
|
||||||
.next
|
.next
|
||||||
ld a, e
|
ld a, e
|
||||||
ld hl, Channel1Field0x23 - Channel1
|
ld hl, Channel1Field0x23 - Channel1
|
||||||
@ -1040,10 +1052,10 @@ Functione84f9: ; e84f9
|
|||||||
.quit1
|
.quit1
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
res 1, [hl]
|
res SOUND_UNKN_09, [hl]
|
||||||
ld hl, Channel1Flags3 - Channel1
|
ld hl, Channel1Flags3 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
res 1, [hl]
|
res SOUND_UNKN_11, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.quit2
|
.quit2
|
||||||
@ -1054,8 +1066,8 @@ Functione84f9: ; e84f9
|
|||||||
ld [hl], d
|
ld [hl], d
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 1, [hl]
|
set NOTE_UNKN_1, [hl]
|
||||||
set 0, [hl]
|
set NOTE_UNKN_0, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; e858c
|
; e858c
|
||||||
@ -1064,7 +1076,7 @@ HandleNoise: ; e858c
|
|||||||
; is noise sampling on?
|
; is noise sampling on?
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 4, [hl] ; noise sampling
|
bit SOUND_NOISE, [hl] ; noise sampling
|
||||||
ret z
|
ret z
|
||||||
; are we in a sfx channel?
|
; are we in a sfx channel?
|
||||||
ld a, [CurChannel]
|
ld a, [CurChannel]
|
||||||
@ -1072,10 +1084,10 @@ HandleNoise: ; e858c
|
|||||||
jr nz, .next
|
jr nz, .next
|
||||||
; is ch8 on? (noise)
|
; is ch8 on? (noise)
|
||||||
ld hl, Channel8Flags
|
ld hl, Channel8Flags
|
||||||
bit 0, [hl] ; on?
|
bit SOUND_CHANNEL_ON, [hl] ; on?
|
||||||
jr z, .next
|
jr z, .next
|
||||||
; is ch8 playing noise?
|
; is ch8 playing noise?
|
||||||
bit 4, [hl]
|
bit SOUND_NOISE, [hl]
|
||||||
ret nz ; quit if so
|
ret nz ; quit if so
|
||||||
;
|
;
|
||||||
.next
|
.next
|
||||||
@ -1132,7 +1144,7 @@ ReadNoiseSample: ; e85af
|
|||||||
|
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 4, [hl]
|
set NOTE_UNKN_4, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.quit
|
.quit
|
||||||
@ -1144,7 +1156,7 @@ ParseMusic: ; e85e1
|
|||||||
; parses until a note is read or the song is ended
|
; parses until a note is read or the song is ended
|
||||||
call GetMusicByte ; store next byte in a
|
call GetMusicByte ; store next byte in a
|
||||||
cp $ff ; is the song over?
|
cp $ff ; is the song over?
|
||||||
jr z, .readff
|
jr z, .endchannel
|
||||||
cp $d0 ; is it a note?
|
cp $d0 ; is it a note?
|
||||||
jr c, .readnote
|
jr c, .readnote
|
||||||
; then it's a command
|
; then it's a command
|
||||||
@ -1157,11 +1169,11 @@ ParseMusic: ; e85e1
|
|||||||
; special notes
|
; special notes
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 3, [hl]
|
bit SOUND_SFX, [hl]
|
||||||
jp nz, Functione8698
|
jp nz, Functione8698
|
||||||
bit 5, [hl] ; rest
|
bit SOUND_REST, [hl] ; rest
|
||||||
jp nz, Functione8698
|
jp nz, Functione8698
|
||||||
bit 4, [hl] ; noise sample
|
bit SOUND_NOISE, [hl] ; noise sample
|
||||||
jp nz, GetNoiseSample
|
jp nz, GetNoiseSample
|
||||||
; normal note
|
; normal note
|
||||||
; set note duration (bottom nybble)
|
; set note duration (bottom nybble)
|
||||||
@ -1193,22 +1205,24 @@ ParseMusic: ; e85e1
|
|||||||
; ????
|
; ????
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 4, [hl]
|
set NOTE_UNKN_4, [hl]
|
||||||
jp LoadNote
|
jp LoadNote
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.rest
|
.rest
|
||||||
; note = rest
|
; note = rest
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 5, [hl] ; Rest
|
set NOTE_REST, [hl] ; Rest
|
||||||
ret
|
ret
|
||||||
|
|
||||||
;
|
;
|
||||||
.readff
|
.endchannel
|
||||||
; $ff is reached in music data
|
; $ff is reached in music data
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 1, [hl] ; in a subroutine?
|
bit SOUND_SUBROUTINE, [hl] ; in a subroutine?
|
||||||
jr nz, .readcommand ; execute
|
jr nz, .readcommand ; execute
|
||||||
ld a, [CurChannel]
|
ld a, [CurChannel]
|
||||||
cp $4 ; channels 0-3?
|
cp $4 ; channels 0-3?
|
||||||
@ -1216,12 +1230,12 @@ ParseMusic: ; e85e1
|
|||||||
; ????
|
; ????
|
||||||
ld hl, Channel5Flags - Channel1
|
ld hl, Channel5Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jr nz, .ok
|
jr nz, .ok
|
||||||
.chan_5to8
|
.chan_5to8
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 5, [hl]
|
bit SOUND_REST, [hl]
|
||||||
call nz, RestoreVolume
|
call nz, RestoreVolume
|
||||||
; end music
|
; end music
|
||||||
ld a, [CurChannel]
|
ld a, [CurChannel]
|
||||||
@ -1235,11 +1249,11 @@ ParseMusic: ; e85e1
|
|||||||
; turn channel off
|
; turn channel off
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
res 0, [hl]
|
res SOUND_CHANNEL_ON, [hl]
|
||||||
; note = rest
|
; note = rest
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 5, [hl]
|
set NOTE_REST, [hl]
|
||||||
; clear music id & bank
|
; clear music id & bank
|
||||||
ld hl, Channel1MusicID - Channel1
|
ld hl, Channel1MusicID - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@ -1276,7 +1290,7 @@ Functione8698: ; e8698
|
|||||||
; turn noise sampling on
|
; turn noise sampling on
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 4, [hl] ; noise sample
|
set NOTE_UNKN_4, [hl] ; noise sample
|
||||||
; update note duration
|
; update note duration
|
||||||
ld a, [CurMusicByte]
|
ld a, [CurMusicByte]
|
||||||
call SetNoteDuration ; top nybble doesnt matter?
|
call SetNoteDuration ; top nybble doesnt matter?
|
||||||
@ -1321,10 +1335,11 @@ GetNoiseSample: ; e86c5
|
|||||||
bit 2, a ; are we in a sfx channel?
|
bit 2, a ; are we in a sfx channel?
|
||||||
jr nz, .sfx
|
jr nz, .sfx
|
||||||
ld hl, Channel8Flags
|
ld hl, Channel8Flags
|
||||||
bit 0, [hl] ; is ch8 on? (noise)
|
bit SOUND_CHANNEL_ON, [hl] ; is ch8 on? (noise)
|
||||||
ret nz
|
ret nz
|
||||||
ld a, [MusicNoiseSampleSet]
|
ld a, [MusicNoiseSampleSet]
|
||||||
jr .next
|
jr .next
|
||||||
|
|
||||||
.sfx
|
.sfx
|
||||||
ld a, [SFXNoiseSampleSet]
|
ld a, [SFXNoiseSampleSet]
|
||||||
.next
|
.next
|
||||||
@ -1380,6 +1395,7 @@ endr
|
|||||||
ld h, [hl]
|
ld h, [hl]
|
||||||
ld l, a
|
ld l, a
|
||||||
jp [hl]
|
jp [hl]
|
||||||
|
|
||||||
; e8720
|
; e8720
|
||||||
|
|
||||||
MusicCommands: ; e8720
|
MusicCommands: ; e8720
|
||||||
@ -1454,7 +1470,7 @@ Music_EndChannel: ; e8781
|
|||||||
; reset subroutine flag
|
; reset subroutine flag
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
res 1, [hl]
|
res SOUND_SUBROUTINE, [hl]
|
||||||
; copy LastMusicAddress to MusicAddress
|
; copy LastMusicAddress to MusicAddress
|
||||||
ld hl, Channel1LastMusicAddress - Channel1
|
ld hl, Channel1LastMusicAddress - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@ -1500,7 +1516,7 @@ Music_CallChannel: ; e8796
|
|||||||
; set subroutine flag
|
; set subroutine flag
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 1, [hl]
|
set SOUND_SUBROUTINE, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; e87bc
|
; e87bc
|
||||||
@ -1534,13 +1550,13 @@ Music_LoopChannel: ; e87cc
|
|||||||
call GetMusicByte
|
call GetMusicByte
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 2, [hl] ; has the loop been initiated?
|
bit SOUND_LOOPING, [hl] ; has the loop been initiated?
|
||||||
jr nz, .checkloop
|
jr nz, .checkloop
|
||||||
and a ; loop counter 0 = infinite
|
and a ; loop counter 0 = infinite
|
||||||
jr z, .loop
|
jr z, .loop
|
||||||
; initiate loop
|
; initiate loop
|
||||||
dec a
|
dec a
|
||||||
set 2, [hl] ; set loop flag
|
set SOUND_LOOPING, [hl] ; set loop flag
|
||||||
ld hl, Channel1LoopCount - Channel1
|
ld hl, Channel1LoopCount - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], a ; store loop counter
|
ld [hl], a ; store loop counter
|
||||||
@ -1569,7 +1585,7 @@ Music_LoopChannel: ; e87cc
|
|||||||
; reset loop flag
|
; reset loop flag
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
res 2, [hl]
|
res SOUND_LOOPING, [hl]
|
||||||
; skip to next command
|
; skip to next command
|
||||||
ld hl, Channel1MusicAddress - Channel1
|
ld hl, Channel1MusicAddress - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@ -1662,8 +1678,8 @@ MusicEE; e883e
|
|||||||
and $3 ; ch0-3
|
and $3 ; ch0-3
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
; hl = wc2b8 + channel id
|
; hl = Channel1JumpCondition + channel id
|
||||||
ld hl, wc2b8
|
ld hl, Channel1JumpCondition
|
||||||
add hl, de
|
add hl, de
|
||||||
; if set, jump
|
; if set, jump
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
@ -1723,7 +1739,7 @@ MusicE2: ; e8873
|
|||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 3, [hl]
|
set SOUND_UNKN_0B, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; e8882
|
; e8882
|
||||||
@ -1740,11 +1756,11 @@ Music_Vibrato: ; e8882
|
|||||||
; set vibrato flag?
|
; set vibrato flag?
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 0, [hl]
|
set SOUND_VIBRATO, [hl]
|
||||||
; start at lower frequency (extent is positive)
|
; start at lower frequency (extent is positive)
|
||||||
ld hl, Channel1Flags3 - Channel1
|
ld hl, Channel1Flags3 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
res 0, [hl]
|
res SOUND_VIBRATO_DIR, [hl]
|
||||||
; get delay
|
; get delay
|
||||||
call GetMusicByte
|
call GetMusicByte
|
||||||
; update delay
|
; update delay
|
||||||
@ -1809,7 +1825,7 @@ MusicE0: ; e88bd
|
|||||||
ld [hl], d
|
ld [hl], d
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 1, [hl]
|
set SOUND_UNKN_09, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; e88e4
|
; e88e4
|
||||||
@ -1819,7 +1835,7 @@ Music_Tone: ; e88e4
|
|||||||
; params: 2
|
; params: 2
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 4, [hl]
|
set SOUND_CRY_PITCH, [hl]
|
||||||
ld hl, Channel1CryPitch + 1 - Channel1
|
ld hl, Channel1CryPitch + 1 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
call GetMusicByte
|
call GetMusicByte
|
||||||
@ -1835,7 +1851,7 @@ MusicE7: ; e88f7
|
|||||||
; params: 1
|
; params: 1
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 6, [hl]
|
set SOUND_UNKN_0E, [hl]
|
||||||
call GetMusicByte
|
call GetMusicByte
|
||||||
ld hl, Channel1Field0x29 - Channel1
|
ld hl, Channel1Field0x29 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@ -1850,7 +1866,7 @@ MusicDE: ; e8906
|
|||||||
;
|
;
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 2, [hl] ; duty cycle
|
set SOUND_DUTY, [hl] ; duty cycle
|
||||||
;
|
;
|
||||||
call GetMusicByte
|
call GetMusicByte
|
||||||
rrca
|
rrca
|
||||||
@ -1872,7 +1888,7 @@ MusicE8: ; e891e
|
|||||||
; params: 1
|
; params: 1
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 5, [hl]
|
set SOUND_UNKN_0D, [hl]
|
||||||
call GetMusicByte
|
call GetMusicByte
|
||||||
ld hl, Channel1Field0x2a - Channel1
|
ld hl, Channel1Field0x2a - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@ -1886,13 +1902,13 @@ Music_ToggleSFX: ; e892d
|
|||||||
; params: none
|
; params: none
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 3, [hl]
|
bit SOUND_SFX, [hl]
|
||||||
jr z, .on
|
jr z, .on
|
||||||
res 3, [hl]
|
res SOUND_SFX, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.on
|
.on
|
||||||
set 3, [hl]
|
set SOUND_SFX, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; e893b
|
; e893b
|
||||||
@ -1906,15 +1922,15 @@ Music_ToggleNoise: ; e893b
|
|||||||
; check if noise sampling is on
|
; check if noise sampling is on
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 4, [hl]
|
bit SOUND_NOISE, [hl]
|
||||||
jr z, .on
|
jr z, .on
|
||||||
; turn noise sampling off
|
; turn noise sampling off
|
||||||
res 4, [hl]
|
res SOUND_NOISE, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.on
|
.on
|
||||||
; turn noise sampling on
|
; turn noise sampling on
|
||||||
set 4, [hl]
|
set SOUND_NOISE, [hl]
|
||||||
call GetMusicByte
|
call GetMusicByte
|
||||||
ld [MusicNoiseSampleSet], a
|
ld [MusicNoiseSampleSet], a
|
||||||
ret
|
ret
|
||||||
@ -1929,15 +1945,15 @@ Music_SFXToggleNoise: ; e894f
|
|||||||
; check if noise sampling is on
|
; check if noise sampling is on
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit 4, [hl]
|
bit SOUND_NOISE, [hl]
|
||||||
jr z, .on
|
jr z, .on
|
||||||
; turn noise sampling off
|
; turn noise sampling off
|
||||||
res 4, [hl]
|
res SOUND_NOISE, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.on
|
.on
|
||||||
; turn noise sampling on
|
; turn noise sampling on
|
||||||
set 4, [hl]
|
set SOUND_NOISE, [hl]
|
||||||
call GetMusicByte
|
call GetMusicByte
|
||||||
ld [SFXNoiseSampleSet], a
|
ld [SFXNoiseSampleSet], a
|
||||||
ret
|
ret
|
||||||
@ -1971,7 +1987,7 @@ Music_SoundStatus: ; e8977
|
|||||||
ld [SoundInput], a
|
ld [SoundInput], a
|
||||||
ld hl, Channel1NoteFlags - Channel1
|
ld hl, Channel1NoteFlags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 3, [hl]
|
set NOTE_UNKN_3, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; e8984
|
; e8984
|
||||||
@ -2101,6 +2117,7 @@ Music_GlobalTempo: ; e89e1
|
|||||||
;positive
|
;positive
|
||||||
ld d, 0
|
ld d, 0
|
||||||
jr .ok
|
jr .ok
|
||||||
|
|
||||||
.negative
|
.negative
|
||||||
ld d, -1
|
ld d, -1
|
||||||
.ok
|
.ok
|
||||||
@ -2266,6 +2283,7 @@ GetFrequency: ; e8a5d
|
|||||||
rr e
|
rr e
|
||||||
inc a
|
inc a
|
||||||
jr .loop
|
jr .loop
|
||||||
|
|
||||||
.ok
|
.ok
|
||||||
ld a, d
|
ld a, d
|
||||||
and $7 ; top 3 bits for frequency (11 total)
|
and $7 ; top 3 bits for frequency (11 total)
|
||||||
@ -2353,6 +2371,7 @@ SetGlobalTempo: ; e8ac7
|
|||||||
ld bc, Channel4
|
ld bc, Channel4
|
||||||
call SetTempo
|
call SetTempo
|
||||||
jr .end
|
jr .end
|
||||||
|
|
||||||
.sfxchannels
|
.sfxchannels
|
||||||
ld bc, Channel5
|
ld bc, Channel5
|
||||||
call SetTempo
|
call SetTempo
|
||||||
@ -2390,7 +2409,7 @@ StartChannel: ; e8b11
|
|||||||
call SetLRTracks
|
call SetLRTracks
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 0, [hl] ; turn channel on
|
set SOUND_CHANNEL_ON, [hl] ; turn channel on
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; e8b1b
|
; e8b1b
|
||||||
@ -2448,10 +2467,10 @@ _PlayMusic:: ; e8b30
|
|||||||
jr nz, .loop
|
jr nz, .loop
|
||||||
xor a
|
xor a
|
||||||
ld [wc2b5], a
|
ld [wc2b5], a
|
||||||
ld [wc2b8], a
|
ld [Channel1JumpCondition], a
|
||||||
ld [wc2b9], a
|
ld [Channel2JumpCondition], a
|
||||||
ld [wc2ba], a
|
ld [Channel3JumpCondition], a
|
||||||
ld [wc2bb], a
|
ld [Channel4JumpCondition], a
|
||||||
ld [NoiseSampleAddressLo], a
|
ld [NoiseSampleAddressLo], a
|
||||||
ld [NoiseSampleAddressHi], a
|
ld [NoiseSampleAddressHi], a
|
||||||
ld [wNoiseSampleDelay], a
|
ld [wNoiseSampleDelay], a
|
||||||
@ -2502,11 +2521,11 @@ endr
|
|||||||
|
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 5, [hl]
|
set SOUND_REST, [hl]
|
||||||
|
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 4, [hl]
|
set SOUND_CRY_PITCH, [hl]
|
||||||
|
|
||||||
ld hl, Channel1CryPitch - Channel1
|
ld hl, Channel1CryPitch - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@ -2579,9 +2598,9 @@ _PlaySFX:: ; e8c04
|
|||||||
; clear channels if they aren't already
|
; clear channels if they aren't already
|
||||||
call MusicOff
|
call MusicOff
|
||||||
ld hl, Channel5Flags
|
ld hl, Channel5Flags
|
||||||
bit 0, [hl] ; ch5 on?
|
bit SOUND_CHANNEL_ON, [hl] ; ch5 on?
|
||||||
jr z, .ch6
|
jr z, .ch6
|
||||||
res 0, [hl] ; turn it off
|
res SOUND_CHANNEL_ON, [hl] ; turn it off
|
||||||
xor a
|
xor a
|
||||||
ld [rNR11], a ; length/wavepattern = 0
|
ld [rNR11], a ; length/wavepattern = 0
|
||||||
ld a, $8
|
ld a, $8
|
||||||
@ -2595,9 +2614,9 @@ _PlaySFX:: ; e8c04
|
|||||||
ld [rNR10], a ; sweep = 0
|
ld [rNR10], a ; sweep = 0
|
||||||
.ch6
|
.ch6
|
||||||
ld hl, Channel6Flags
|
ld hl, Channel6Flags
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jr z, .ch7
|
jr z, .ch7
|
||||||
res 0, [hl] ; turn it off
|
res SOUND_CHANNEL_ON, [hl] ; turn it off
|
||||||
xor a
|
xor a
|
||||||
ld [rNR21], a ; length/wavepattern = 0
|
ld [rNR21], a ; length/wavepattern = 0
|
||||||
ld a, $8
|
ld a, $8
|
||||||
@ -2608,9 +2627,9 @@ _PlaySFX:: ; e8c04
|
|||||||
ld [rNR24], a ; restart sound (freq hi = 0)
|
ld [rNR24], a ; restart sound (freq hi = 0)
|
||||||
.ch7
|
.ch7
|
||||||
ld hl, Channel7Flags
|
ld hl, Channel7Flags
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jr z, .ch8
|
jr z, .ch8
|
||||||
res 0, [hl] ; turn it off
|
res SOUND_CHANNEL_ON, [hl] ; turn it off
|
||||||
xor a
|
xor a
|
||||||
ld [rNR30], a ; sound mode #3 off
|
ld [rNR30], a ; sound mode #3 off
|
||||||
ld [rNR31], a ; length/wavepattern = 0
|
ld [rNR31], a ; length/wavepattern = 0
|
||||||
@ -2622,9 +2641,9 @@ _PlaySFX:: ; e8c04
|
|||||||
ld [rNR34], a ; restart sound (freq hi = 0)
|
ld [rNR34], a ; restart sound (freq hi = 0)
|
||||||
.ch8
|
.ch8
|
||||||
ld hl, Channel8Flags
|
ld hl, Channel8Flags
|
||||||
bit 0, [hl]
|
bit SOUND_CHANNEL_ON, [hl]
|
||||||
jr z, .chscleared
|
jr z, .chscleared
|
||||||
res 0, [hl] ; turn it off
|
res SOUND_CHANNEL_ON, [hl] ; turn it off
|
||||||
xor a
|
xor a
|
||||||
ld [rNR41], a ; length/wavepattern = 0
|
ld [rNR41], a ; length/wavepattern = 0
|
||||||
ld a, $8
|
ld a, $8
|
||||||
@ -2664,7 +2683,7 @@ _PlaySFX:: ; e8c04
|
|||||||
call LoadChannel ; bc = current channel
|
call LoadChannel ; bc = current channel
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 3, [hl]
|
set SOUND_SFX, [hl]
|
||||||
call StartChannel
|
call StartChannel
|
||||||
pop af
|
pop af
|
||||||
dec a
|
dec a
|
||||||
@ -2720,7 +2739,7 @@ endr
|
|||||||
|
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 3, [hl]
|
set SOUND_SFX, [hl]
|
||||||
|
|
||||||
push de
|
push de
|
||||||
; get tracks for this channel
|
; get tracks for this channel
|
||||||
@ -2759,7 +2778,7 @@ endr
|
|||||||
|
|
||||||
ld hl, Channel1Flags2 - Channel1
|
ld hl, Channel1Flags2 - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 7, [hl]
|
set SOUND_UNKN_0F, [hl]
|
||||||
|
|
||||||
.skip
|
.skip
|
||||||
pop de
|
pop de
|
||||||
@ -2767,7 +2786,7 @@ endr
|
|||||||
; turn channel on
|
; turn channel on
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set 0, [hl] ; on
|
set SOUND_CHANNEL_ON, [hl] ; on
|
||||||
|
|
||||||
; done?
|
; done?
|
||||||
pop af
|
pop af
|
||||||
@ -2801,7 +2820,7 @@ endr
|
|||||||
ld b, [hl] ; bc = channel pointer
|
ld b, [hl] ; bc = channel pointer
|
||||||
ld hl, Channel1Flags - Channel1
|
ld hl, Channel1Flags - Channel1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
res 0, [hl] ; channel off
|
res SOUND_CHANNEL_ON, [hl] ; channel off
|
||||||
call ChannelInit
|
call ChannelInit
|
||||||
; load music pointer
|
; load music pointer
|
||||||
ld hl, Channel1MusicAddress - Channel1
|
ld hl, Channel1MusicAddress - Channel1
|
||||||
|
@ -31,3 +31,4 @@ INCLUDE "constants/tilemap_constants.asm"
|
|||||||
INCLUDE "constants/cgb_constants.asm"
|
INCLUDE "constants/cgb_constants.asm"
|
||||||
INCLUDE "constants/battle_tower_constants.asm"
|
INCLUDE "constants/battle_tower_constants.asm"
|
||||||
INCLUDE "constants/cry_constants.asm"
|
INCLUDE "constants/cry_constants.asm"
|
||||||
|
INCLUDE "constants/audio_constants.asm"
|
||||||
|
62
constants/audio_constants.asm
Executable file
62
constants/audio_constants.asm
Executable file
@ -0,0 +1,62 @@
|
|||||||
|
|
||||||
|
|
||||||
|
; pitch
|
||||||
|
const_def
|
||||||
|
const __
|
||||||
|
const C_
|
||||||
|
const C#
|
||||||
|
const D_
|
||||||
|
const D#
|
||||||
|
const E_
|
||||||
|
const F_
|
||||||
|
const F#
|
||||||
|
const G_
|
||||||
|
const G#
|
||||||
|
const A_
|
||||||
|
const A#
|
||||||
|
const B_
|
||||||
|
|
||||||
|
; channel
|
||||||
|
const_def
|
||||||
|
const CHAN1
|
||||||
|
const CHAN2
|
||||||
|
const CHAN3
|
||||||
|
const CHAN4
|
||||||
|
NUM_MUSIC_CHANS EQU const_value
|
||||||
|
NUM_NOISE_CHANS EQU const_value
|
||||||
|
const CHAN5
|
||||||
|
const CHAN6
|
||||||
|
const CHAN7
|
||||||
|
const CHAN8
|
||||||
|
NUM_CHANNELS EQU const_value
|
||||||
|
|
||||||
|
; Flags1
|
||||||
|
SOUND_CHANNEL_ON EQU 0
|
||||||
|
SOUND_SUBROUTINE EQU 1
|
||||||
|
SOUND_LOOPING EQU 2
|
||||||
|
SOUND_SFX EQU 3
|
||||||
|
SOUND_NOISE EQU 4
|
||||||
|
SOUND_REST EQU 5
|
||||||
|
|
||||||
|
; Flags2
|
||||||
|
|
||||||
|
SOUND_VIBRATO EQU 0
|
||||||
|
SOUND_UNKN_09 EQU 1
|
||||||
|
SOUND_DUTY EQU 2
|
||||||
|
SOUND_UNKN_0B EQU 3
|
||||||
|
SOUND_CRY_PITCH EQU 4
|
||||||
|
SOUND_UNKN_0D EQU 5
|
||||||
|
SOUND_UNKN_0E EQU 6
|
||||||
|
SOUND_UNKN_0F EQU 7
|
||||||
|
|
||||||
|
; Flags3
|
||||||
|
SOUND_VIBRATO_DIR EQU 0
|
||||||
|
SOUND_UNKN_11 EQU 1
|
||||||
|
|
||||||
|
; NoteFlags
|
||||||
|
NOTE_UNKN_0 EQU 0
|
||||||
|
NOTE_UNKN_1 EQU 1
|
||||||
|
NOTE_UNKN_3 EQU 3
|
||||||
|
NOTE_UNKN_4 EQU 4
|
||||||
|
NOTE_REST EQU 5
|
||||||
|
NOTE_UNKN_6 EQU 6
|
@ -23,35 +23,6 @@ cry_header: macro
|
|||||||
dw \1, \2, \3
|
dw \1, \2, \3
|
||||||
endm
|
endm
|
||||||
|
|
||||||
; pitch
|
|
||||||
__ EQU 0
|
|
||||||
C_ EQU 1
|
|
||||||
C# EQU 2
|
|
||||||
D_ EQU 3
|
|
||||||
D# EQU 4
|
|
||||||
E_ EQU 5
|
|
||||||
F_ EQU 6
|
|
||||||
F# EQU 7
|
|
||||||
G_ EQU 8
|
|
||||||
G# EQU 9
|
|
||||||
A_ EQU 10
|
|
||||||
A# EQU 11
|
|
||||||
B_ EQU 12
|
|
||||||
|
|
||||||
; channel
|
|
||||||
const_def
|
|
||||||
const CHAN1
|
|
||||||
const CHAN2
|
|
||||||
const CHAN3
|
|
||||||
const CHAN4
|
|
||||||
NUM_MUSIC_CHANS EQU const_value
|
|
||||||
NUM_NOISE_CHANS EQU const_value
|
|
||||||
const CHAN5
|
|
||||||
const CHAN6
|
|
||||||
const CHAN7
|
|
||||||
const CHAN8
|
|
||||||
NUM_CHANNELS EQU const_value
|
|
||||||
|
|
||||||
enum_start $d8
|
enum_start $d8
|
||||||
enum notetype_cmd
|
enum notetype_cmd
|
||||||
octave: macro
|
octave: macro
|
||||||
|
10
wram.asm
10
wram.asm
@ -88,7 +88,7 @@ channel_struct: MACRO
|
|||||||
\1MusicID:: dw
|
\1MusicID:: dw
|
||||||
\1MusicBank:: db
|
\1MusicBank:: db
|
||||||
\1Flags:: db ; 0:on/off 1:subroutine 3:sfx 4:noise 5:rest
|
\1Flags:: db ; 0:on/off 1:subroutine 3:sfx 4:noise 5:rest
|
||||||
\1Flags2:: db ; 0:vibrato on/off 2:duty
|
\1Flags2:: db ; 0:vibrato on/off 2:duty 4:cry pitch
|
||||||
\1Flags3:: db ; 0:vibrato up/down
|
\1Flags3:: db ; 0:vibrato up/down
|
||||||
\1MusicAddress:: dw
|
\1MusicAddress:: dw
|
||||||
\1LastMusicAddress:: dw
|
\1LastMusicAddress:: dw
|
||||||
@ -293,10 +293,10 @@ SFXPriority:: ; c2b6
|
|||||||
; if nonzero, turn off music when playing sfx
|
; if nonzero, turn off music when playing sfx
|
||||||
ds 1
|
ds 1
|
||||||
ds 1
|
ds 1
|
||||||
wc2b8:: ds 1
|
Channel1JumpCondition:: ds 1
|
||||||
wc2b9:: ds 1
|
Channel2JumpCondition:: ds 1
|
||||||
wc2ba:: ds 1
|
Channel3JumpCondition:: ds 1
|
||||||
wc2bb:: ds 1
|
Channel4JumpCondition:: ds 1
|
||||||
wc2bc:: ds 1
|
wc2bc:: ds 1
|
||||||
CryTracks:: ; c2bd
|
CryTracks:: ; c2bd
|
||||||
; plays only in left or right track depending on what side the monster is on
|
; plays only in left or right track depending on what side the monster is on
|
||||||
|
Loading…
Reference in New Issue
Block a user