mirror of https://github.com/pret/pokecrystal.git
prep for next commit
This commit is contained in:
parent
ef93cdf313
commit
95ac2a8da6
228
constants.asm
228
constants.asm
|
@ -3115,3 +3115,231 @@ MUSIC_BATTLE_TOWER_THEME EQU 99
|
|||
MUSIC_SUICUNE_BATTLE EQU 100
|
||||
MUSIC_BATTLE_TOWER_LOBBY EQU 101
|
||||
MUSIC_MOBILE_CENTER EQU 102
|
||||
|
||||
; sound
|
||||
_4CH1 EQU $c0
|
||||
_3CH1 EQU $80
|
||||
_2CH1 EQU $40
|
||||
_1CH1 EQU $00
|
||||
_3CH2 EQU $81
|
||||
_2CH2 EQU $41
|
||||
_1CH2 EQU $01
|
||||
_2CH3 EQU $42
|
||||
_1CH3 EQU $02
|
||||
_1CH4 EQU $03
|
||||
|
||||
_4CH5 EQU $c4
|
||||
_3CH5 EQU $84
|
||||
_2CH5 EQU $44
|
||||
_1CH5 EQU $04
|
||||
_3CH6 EQU $85
|
||||
_2CH6 EQU $45
|
||||
_1CH6 EQU $05
|
||||
_2CH7 EQU $46
|
||||
_1CH7 EQU $06
|
||||
_1CH8 EQU $07
|
||||
|
||||
_CH2 EQU $01
|
||||
_CH3 EQU $02
|
||||
_CH4 EQU $03
|
||||
_CH5 EQU $04
|
||||
_CH6 EQU $05
|
||||
_CH7 EQU $06
|
||||
_CH8 EQU $07
|
||||
|
||||
note: MACRO
|
||||
db \1
|
||||
ENDM
|
||||
; eventually replace with this:
|
||||
; note: MACRO
|
||||
; db NOTE_\1 + NOTE_\2
|
||||
; ENDM
|
||||
|
||||
NOTE_RST EQU $00
|
||||
NOTE_C EQU $10
|
||||
NOTE_C# EQU $20
|
||||
NOTE_D EQU $30
|
||||
NOTE_D# EQU $40
|
||||
NOTE_E EQU $50
|
||||
NOTE_F EQU $60
|
||||
NOTE_F# EQU $70
|
||||
NOTE_G EQU $80
|
||||
NOTE_G# EQU $90
|
||||
NOTE_A EQU $a0
|
||||
NOTE_A# EQU $b0
|
||||
NOTE_B EQU $c0
|
||||
|
||||
; 16ths
|
||||
NOTE_1 EQU $00
|
||||
NOTE_2 EQU $01
|
||||
NOTE_3 EQU $02
|
||||
NOTE_4 EQU $03
|
||||
NOTE_5 EQU $04
|
||||
NOTE_6 EQU $05
|
||||
NOTE_7 EQU $06
|
||||
NOTE_8 EQU $07
|
||||
NOTE_9 EQU $08
|
||||
NOTE_10 EQU $09
|
||||
NOTE_11 EQU $0a
|
||||
NOTE_12 EQU $0b
|
||||
NOTE_13 EQU $0c
|
||||
NOTE_14 EQU $0d
|
||||
NOTE_15 EQU $0e
|
||||
NOTE_16 EQU $0f
|
||||
|
||||
octave: MACRO
|
||||
db $d0 + \1
|
||||
ENDM
|
||||
notetype: MACRO
|
||||
db $d8
|
||||
db \1
|
||||
db \2
|
||||
ENDM
|
||||
forceoctave: MACRO
|
||||
db $d9
|
||||
db \1
|
||||
ENDM
|
||||
tempo: MACRO
|
||||
db $da
|
||||
db \1
|
||||
db \2
|
||||
ENDM
|
||||
dutycycle: MACRO
|
||||
db $db
|
||||
db \1
|
||||
ENDM
|
||||
intensity: MACRO
|
||||
db $dc
|
||||
db \1
|
||||
ENDM
|
||||
soundinput: MACRO
|
||||
db $dd
|
||||
db \1
|
||||
ENDM
|
||||
unknownmusic0xde: MACRO
|
||||
db $de
|
||||
db \1
|
||||
ENDM
|
||||
unknownmusic0xdf: MACRO
|
||||
db $df
|
||||
ENDM
|
||||
unknownmusic0xe0: MACRO
|
||||
db $e0
|
||||
db \1
|
||||
db \2
|
||||
db \3
|
||||
ENDM
|
||||
vibrato: MACRO
|
||||
db $e1
|
||||
db \1
|
||||
db \2
|
||||
ENDM
|
||||
unknownmusic0xe2: MACRO
|
||||
db $e2
|
||||
db \1
|
||||
ENDM
|
||||
togglenoise: MACRO
|
||||
db $e3
|
||||
ENDM
|
||||
panning: MACRO
|
||||
db $e4
|
||||
db \1
|
||||
ENDM
|
||||
volume: MACRO
|
||||
db $e5
|
||||
db \1
|
||||
ENDM
|
||||
tone: MACRO
|
||||
db $e6
|
||||
dw \1
|
||||
ENDM
|
||||
unknownmusic0xe7: MACRO
|
||||
db $e7
|
||||
db \1
|
||||
ENDM
|
||||
unknownmusic0xe8: MACRO
|
||||
db $e8
|
||||
db \1
|
||||
ENDM
|
||||
globaltempo : MACRO
|
||||
db $e9
|
||||
dw \1
|
||||
ENDM
|
||||
restartchannel: MACRO
|
||||
db $ea
|
||||
dw \1
|
||||
ENDM
|
||||
newsong: MACRO
|
||||
db $eb
|
||||
dw \1
|
||||
ENDM
|
||||
sfxpriorityon: MACRO
|
||||
db $ec
|
||||
ENDM
|
||||
sfxpriorityoff: MACRO
|
||||
db $ed
|
||||
ENDM
|
||||
unknownmusic0xee: MACRO
|
||||
db $ee
|
||||
dw \1
|
||||
ENDM
|
||||
stereopanning: MACRO
|
||||
db $ef
|
||||
db \1
|
||||
ENDM
|
||||
sfxtogglenoise: MACRO
|
||||
db $f0
|
||||
db \1
|
||||
ENDM
|
||||
music0xf1: MACRO
|
||||
db $f1
|
||||
ENDM
|
||||
music0xf2: MACRO
|
||||
db $f2
|
||||
ENDM
|
||||
music0xf3: MACRO
|
||||
db $f3
|
||||
ENDM
|
||||
music0xf4: MACRO
|
||||
db $f4
|
||||
ENDM
|
||||
music0xf5: MACRO
|
||||
db $f5
|
||||
ENDM
|
||||
music0xf6: MACRO
|
||||
db $f6
|
||||
ENDM
|
||||
music0xf7: MACRO
|
||||
db $f7
|
||||
ENDM
|
||||
music0xf8: MACRO
|
||||
db $f8
|
||||
ENDM
|
||||
unknownmusic0xf9: MACRO
|
||||
db $f9
|
||||
ENDM
|
||||
setcondition: MACRO
|
||||
db $fa
|
||||
db \1
|
||||
ENDM
|
||||
jumpif: MACRO
|
||||
db $fb
|
||||
db \1
|
||||
dw \2
|
||||
ENDM
|
||||
jumpchannel: MACRO
|
||||
db $fc
|
||||
dw \1
|
||||
ENDM
|
||||
loopchannel: MACRO
|
||||
db $fd
|
||||
db \1
|
||||
dw \2
|
||||
ENDM
|
||||
callchannel: MACRO
|
||||
db $fe
|
||||
dw \1
|
||||
ENDM
|
||||
endchannel: MACRO
|
||||
db $ff
|
||||
ENDM
|
43
main.asm
43
main.asm
|
@ -1287,15 +1287,15 @@ Function3927: ; 3927
|
|||
|
||||
INCBIN "baserom.gbc",$392d,$3b86 - $392d
|
||||
|
||||
LoadMusicHeader: ; 3b86
|
||||
; store music header in ram
|
||||
LoadMusicByte: ; 3b86
|
||||
; load music data into CurMusicByte
|
||||
; input:
|
||||
; a: bank
|
||||
; de: address
|
||||
ld [$ff00+$9d], a
|
||||
ld [$2000], a ; bankswitch
|
||||
ld a, [de]
|
||||
ld [MusicHeaderBuffer], a
|
||||
ld [CurMusicByte], a
|
||||
ld a, $3a ; manual bank restore
|
||||
ld [$ff00+$9d], a
|
||||
ld [$2000], a ; bankswitch
|
||||
|
@ -1335,15 +1335,18 @@ StartMusic: ; 3b97
|
|||
INCBIN "baserom.gbc",$3bbc,$3c23 - $3bbc
|
||||
|
||||
StartSFX: ; 3c23
|
||||
; not sure why this was written differently from StartMusic
|
||||
; sfx id order is by priority (highest to lowest)
|
||||
; to disable this, remove the check!
|
||||
; input: de = sfx id
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
push af
|
||||
call CheckSFX ; is something already playing?
|
||||
; is something already playing?
|
||||
call CheckSFX
|
||||
jr nc, .asm_3c32
|
||||
ld a, [CurSFX] ; i guess sfx order is by priority
|
||||
; only play sfx if it has priority
|
||||
ld a, [CurSFX]
|
||||
cp e
|
||||
jr c, .quit
|
||||
.asm_3c32
|
||||
|
@ -74421,14 +74424,14 @@ SetLRTracks: ; e8b1b
|
|||
; bc = Channels ($c101)
|
||||
; seems to be redundant since this is overwritten by stereo data later
|
||||
push de
|
||||
ld a, [CurMusicChannel]
|
||||
ld a, [CurChannel]
|
||||
and a, $03 ; bit 0-1
|
||||
ld e, a
|
||||
ld d, $00
|
||||
call GetLRTracks ; hl = mono / stereo table
|
||||
add hl, de ; + channel #
|
||||
ld a, [hl] ; get result
|
||||
ld hl, Channel1LR - Channel1
|
||||
ld hl, Channel1Tracks - Channel1
|
||||
add hl, bc
|
||||
ld [hl], a ; set tracks
|
||||
pop de
|
||||
|
@ -74451,7 +74454,7 @@ LoadMusic: ; e8b30
|
|||
ld e, [hl]
|
||||
inc hl
|
||||
ld d, [hl] ; music header address
|
||||
call GetByteFromMusicHeader ; store first byte of music header in [a]
|
||||
call FarLoadMusicByte ; store first byte of music header in [a]
|
||||
rlca
|
||||
rlca
|
||||
and a, $03 ; get number of channels
|
||||
|
@ -74556,7 +74559,7 @@ LoadSFX: ; e8c04
|
|||
ld e, [hl] ; get address
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
call GetByteFromMusicHeader ; get # channels
|
||||
call FarLoadMusicByte ; get # channels
|
||||
rlca
|
||||
rlca
|
||||
and a, $03 ; bit 0-1
|
||||
|
@ -74582,10 +74585,10 @@ INCBIN "baserom.gbc",$e8ca6,$e8d1b - $e8ca6
|
|||
LoadChannel: ; e8d1b
|
||||
; prep channel for use
|
||||
; get pointer to current channel
|
||||
call GetByteFromMusicHeader
|
||||
call FarLoadMusicByte
|
||||
inc de
|
||||
and a, $07 ; bit 0-2 (current channel)
|
||||
ld [CurMusicChannel], a
|
||||
ld [CurChannel], a
|
||||
ld c, a
|
||||
ld b, $00
|
||||
ld hl, ChannelPointers
|
||||
|
@ -74601,10 +74604,10 @@ LoadChannel: ; e8d1b
|
|||
; load music pointer
|
||||
ld hl, Channel1MusicAddress - Channel1
|
||||
add hl, bc
|
||||
call GetByteFromMusicHeader
|
||||
call FarLoadMusicByte
|
||||
ld [hli], a
|
||||
inc de
|
||||
call GetByteFromMusicHeader
|
||||
call FarLoadMusicByte
|
||||
ld [hl], a
|
||||
inc de
|
||||
; load music id
|
||||
|
@ -74637,27 +74640,27 @@ ChannelInit: ; e8d5b
|
|||
ld [hli], a
|
||||
dec e
|
||||
jr nz, .loop
|
||||
ld hl, Channel1NoteLength - Channel1
|
||||
ld hl, Channel1Tempo - Channel1
|
||||
add hl, bc
|
||||
xor a
|
||||
ld [hli], a
|
||||
inc a
|
||||
ld [hl], a ; default note length $100
|
||||
ld hl, Channel1Tempo - Channel1
|
||||
ld hl, Channel1NoteLength - Channel1
|
||||
add hl, bc
|
||||
ld [hl], a ; default tempo $01 (fast)
|
||||
pop de
|
||||
ret
|
||||
; e8d76
|
||||
|
||||
GetByteFromMusicHeader: ; e8d76
|
||||
FarLoadMusicByte: ; e8d76
|
||||
; input:
|
||||
; de = address of current spot in music header
|
||||
; output:
|
||||
; a
|
||||
ld a, [MusicBank]
|
||||
call LoadMusicHeader
|
||||
ld a, [MusicHeaderBuffer]
|
||||
call LoadMusicByte
|
||||
ld a, [CurMusicByte]
|
||||
ret
|
||||
; e8d80
|
||||
|
||||
|
@ -74711,7 +74714,7 @@ PlayTrainerEncounterMusic: ; e900a
|
|||
; input: e = trainer type
|
||||
; turn music off for one frame
|
||||
xor a
|
||||
ld [MusicLength], a ; $00 = infinite
|
||||
ld [MusicFade], a ; $00 = infinite
|
||||
push de
|
||||
ld de, $0000
|
||||
call StartMusic
|
||||
|
|
255
wram.asm
255
wram.asm
|
@ -1,17 +1,7 @@
|
|||
SECTION "audio",BSS[$c101]
|
||||
; channel structure:
|
||||
; $00: music id lo
|
||||
; $01: music id hi
|
||||
;
|
||||
; $03: channel flags? bit 0 = on/off
|
||||
;
|
||||
; $06: address of music data
|
||||
;
|
||||
; $19: note length lo
|
||||
; $1a: note length hi
|
||||
; $1b: lr tracks (bit corresponds to track #)
|
||||
;
|
||||
; $2d: tempo
|
||||
SECTION "audio",BSS[$c100]
|
||||
MusicPlaying: ; c100
|
||||
; nonzero if playing
|
||||
ds 1
|
||||
|
||||
Channels:
|
||||
Channel1:
|
||||
|
@ -19,21 +9,154 @@ Channel1MusicID: ; c101
|
|||
ds 2
|
||||
Channel1MusicBank: ; c103
|
||||
ds 1
|
||||
; $03 = channel flags?
|
||||
Channel1Flags: ; c104
|
||||
; 0: on/off
|
||||
; 1: subroutine
|
||||
; 2:
|
||||
; 3:
|
||||
; 4: noise sampling on/off
|
||||
; 5:
|
||||
; 6:
|
||||
; 7:
|
||||
ds 1
|
||||
Channel1Flags2: ; c105
|
||||
; 0: vibrato on/off
|
||||
; 1:
|
||||
; 2: duty cycle on/off
|
||||
; 3:
|
||||
; 4:
|
||||
; 5:
|
||||
; 6:
|
||||
; 7:
|
||||
ds 1
|
||||
Channel1Flags3: ; c106
|
||||
; 0: vibrato up/down
|
||||
; 1:
|
||||
; 2:
|
||||
; 3:
|
||||
; 4:
|
||||
; 5:
|
||||
; 6:
|
||||
; 7:
|
||||
ds 1
|
||||
; note/octave????
|
||||
ds 2
|
||||
Channel1MusicAddress: ; c107
|
||||
ds 2
|
||||
ds 17
|
||||
Channel1NoteLength: ; c11a
|
||||
Channel1LastMusicAddress: ; c109
|
||||
ds 2
|
||||
Channel1LR: ; c11c
|
||||
; could have been meant as a third-level address
|
||||
; unused? ; c10b
|
||||
ds 1
|
||||
ds 17
|
||||
Channel1Tempo: ; c12e
|
||||
; unused? ; c10c
|
||||
ds 1
|
||||
ds 4
|
||||
Channel1NoteFlags: ; c10d
|
||||
; 0:
|
||||
; 1:
|
||||
; 2:
|
||||
; 3:
|
||||
; 4:
|
||||
; 5: rest
|
||||
; 6:
|
||||
; 7:
|
||||
ds 1
|
||||
Channel1Condition: ; c10e
|
||||
; used for conditional jumps
|
||||
ds 1
|
||||
Channel1DutyCycle: ; c10f
|
||||
; uses top 2 bits only
|
||||
; 0: 12.5%
|
||||
; 1: 25%
|
||||
; 2: 50%
|
||||
; 3: 75%
|
||||
ds 1
|
||||
Channel1Intensity: ; c110
|
||||
; hi: pressure
|
||||
; lo: velocity
|
||||
ds 1
|
||||
Channel1Frequency: ; c111
|
||||
; 11 bits
|
||||
ds 2
|
||||
Channel1Pitch: ; c113
|
||||
; 0: rest
|
||||
; 1: C
|
||||
; 2: C#
|
||||
; 3: D
|
||||
; 4: D#
|
||||
; 5: E
|
||||
; 6: F
|
||||
; 7: F#
|
||||
; 8: G
|
||||
; 9: G#
|
||||
; a: A
|
||||
; b: A#
|
||||
; c: B
|
||||
ds 1
|
||||
Channel1Octave: ; c114
|
||||
; 0: highest
|
||||
; 7: lowest
|
||||
ds 1
|
||||
Channel1StartingOctave ; c115
|
||||
; raises existing octaves by this value
|
||||
; used for repeating phrases in a higher octave to save space
|
||||
ds 1
|
||||
Channel1NoteDuration: ; c116
|
||||
; number of frames remaining in the current note
|
||||
ds 1
|
||||
; c117
|
||||
ds 1
|
||||
; c118
|
||||
ds 1
|
||||
Channel1LoopCount ; c119
|
||||
ds 1
|
||||
Channel1Tempo: ; c11a
|
||||
ds 2
|
||||
Channel1Tracks: ; c11c
|
||||
; hi: l
|
||||
; lo: r
|
||||
ds 1
|
||||
; c11d
|
||||
ds 1
|
||||
|
||||
Channel1VibratoDelayCount: ; c11e
|
||||
; initialized at the value in VibratoDelay
|
||||
; decrements each frame
|
||||
; at 0, vibrato starts
|
||||
ds 1
|
||||
Channel1VibratoDelay: ; c11f
|
||||
; number of frames a note plays until vibrato starts
|
||||
ds 1
|
||||
Channel1VibratoExtent: ; c120
|
||||
; difference in
|
||||
ds 1
|
||||
Channel1VibratoRate: ; c121
|
||||
; counts down from a max of 15 frames
|
||||
; over which the pitch is alternated
|
||||
; hi: init frames
|
||||
; lo: frame count
|
||||
ds 1
|
||||
|
||||
; c122
|
||||
ds 1
|
||||
; c123
|
||||
ds 1
|
||||
; c124
|
||||
ds 1
|
||||
; c125
|
||||
ds 1
|
||||
; c126
|
||||
ds 1
|
||||
ds 7
|
||||
Channel1NoteLength: ; c12e
|
||||
; # frames per 16th note
|
||||
ds 1
|
||||
; c12f
|
||||
ds 1
|
||||
; c130
|
||||
ds 1
|
||||
; c131
|
||||
ds 1
|
||||
; c132
|
||||
ds 1
|
||||
; end
|
||||
|
||||
Channel2: ; c133
|
||||
ds 50
|
||||
|
@ -52,13 +175,25 @@ Channel7: ; c22d
|
|||
Channel8: ; c25f
|
||||
ds 50
|
||||
|
||||
ds 7
|
||||
|
||||
MusicHeaderBuffer: ; c298
|
||||
; c291
|
||||
ds 1
|
||||
CurMusicChannel: ; c299
|
||||
; c292
|
||||
ds 1
|
||||
; c293
|
||||
ds 1
|
||||
; c294
|
||||
ds 1
|
||||
; c295
|
||||
ds 1
|
||||
; c296
|
||||
ds 1
|
||||
; c297
|
||||
ds 1
|
||||
|
||||
CurMusicByte: ; c298
|
||||
ds 1
|
||||
CurChannel: ; c299
|
||||
ds 1
|
||||
Volume: ; c29a
|
||||
; corresponds to $ff24
|
||||
; Channel control / ON-OFF / Volume (R/W)
|
||||
|
@ -67,27 +202,69 @@ Volume: ; c29a
|
|||
; bit 3 - Vin->SO1 ON/OFF
|
||||
; bit 2-0 - SO1 output level (volume) (# 0-7)
|
||||
ds 1
|
||||
|
||||
ds 2
|
||||
SoundOutput: ; c29b
|
||||
; corresponds to $ff25
|
||||
; bit 4-7: ch1-4 so2 on/off
|
||||
; bit 0-3: ch1-4 so1 on/off
|
||||
ds 1
|
||||
SoundInput: ; c29c
|
||||
; corresponds to $ff26
|
||||
; bit 7: global on/off
|
||||
; bit 0: ch1 on/off
|
||||
; bit 1: ch2 on/off
|
||||
; bit 2: ch3 on/off
|
||||
; bit 3: ch4 on/off
|
||||
ds 1
|
||||
|
||||
MusicID:
|
||||
MusicIDLo: ; c29d
|
||||
ds 1
|
||||
MusicIDHi: ; c29e
|
||||
ds 1
|
||||
|
||||
MusicBank: ; c29f
|
||||
ds 1
|
||||
|
||||
ds 7
|
||||
|
||||
MusicLength: ; c2a7
|
||||
; fades out when counter hits this value
|
||||
; $00 = infinite
|
||||
NoiseSampleAddress:
|
||||
NoiseSampleAddressLo: ; c2a0
|
||||
ds 1
|
||||
NoiseSampleAddressHi: ; c2a1
|
||||
ds 1
|
||||
; noise delay? ; c2a2
|
||||
ds 1
|
||||
; c2a3
|
||||
ds 1
|
||||
MusicNoiseSampleSet: ; c2a4
|
||||
ds 1
|
||||
SFXNoiseSampleSet: ; c2a5
|
||||
ds 1
|
||||
; c2a6
|
||||
ds 1
|
||||
MusicFade: ; c2a7
|
||||
; fades volume over x frames
|
||||
; bit 7: fade in/out
|
||||
; bit 0-5: number of frames for each volume level
|
||||
; $00 = none (default)
|
||||
ds 1
|
||||
MusicFadeCount: ; c2a8
|
||||
ds 1
|
||||
MusicFadeID:
|
||||
MusicFadeIDLo: ; c2a9
|
||||
ds 1
|
||||
MusicFadeIDHi: ; c2aa
|
||||
ds 1
|
||||
ds 9
|
||||
LastVolume: ; c2b4
|
||||
; preserves volume of a song playing so cries can have their own volume
|
||||
ds 1
|
||||
ds 1
|
||||
SFXPriority: ; c2b6
|
||||
; if nonzero, turn off music when playing sfx
|
||||
ds 1
|
||||
ds 6
|
||||
CryTracks ; c2bd
|
||||
; plays only in left or right track depending on what side the monster is on
|
||||
; both tracks active outside of battle
|
||||
ds 1
|
||||
ds 1
|
||||
|
||||
ds 23
|
||||
|
||||
CurSFX: ; c2bf
|
||||
; id of sfx currently playing
|
||||
ds 1
|
||||
|
|
Loading…
Reference in New Issue