From 91dc3c9f9c8fd529bb6e8307b58b96efa0bec67e Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 3 Jul 2020 11:52:16 -0400 Subject: Remove unused Yellow music --- audio/music/yellow/meetjessiejames.asm | 308 -------------- audio/music/yellow/surfingpikachu.asm | 690 -------------------------------- audio/music/yellow/yellowintro.asm | 484 ---------------------- audio/music/yellow/yellowunusedsong.asm | 326 --------------- 4 files changed, 1808 deletions(-) delete mode 100644 audio/music/yellow/meetjessiejames.asm delete mode 100644 audio/music/yellow/surfingpikachu.asm delete mode 100644 audio/music/yellow/yellowintro.asm delete mode 100644 audio/music/yellow/yellowunusedsong.asm (limited to 'audio') diff --git a/audio/music/yellow/meetjessiejames.asm b/audio/music/yellow/meetjessiejames.asm deleted file mode 100644 index d1f9f795..00000000 --- a/audio/music/yellow/meetjessiejames.asm +++ /dev/null @@ -1,308 +0,0 @@ -Music_MeetJessieJames_Ch1:: - tempo 144 - volume 7, 7 - duty_cycle 3 - vibrato 8, 1, 4 - note_type 12, 11, 2 - octave 3 - note G#, 1 - note G_, 1 - note F#, 2 - note F_, 2 - note E_, 2 - note D#, 2 - note D_, 2 - note C#, 2 - note C_, 2 - note_type 12, 11, 6 - note D#, 12 - note C_, 4 - -Music_MeetJessieJames_branch_83187:: - note_type 12, 11, 2 - octave 4 - note D_, 16 - rest 12 - note_type 12, 11, 4 - octave 3 - note A#, 4 - rest 16 - rest 8 - note_type 12, 11, 2 - octave 2 - note A_, 2 - octave 3 - note A#, 2 - note A_, 4 - note D_, 1 - note D#, 1 - note D#, 2 - note D#, 2 - note D_, 2 - note D#, 2 - note D_, 2 - note D#, 2 - note F_, 2 - note D_, 1 - note D#, 1 - note D#, 2 - note D#, 2 - note D_, 2 - octave 2 - note A#, 4 - note_type 12, 11, 4 - octave 3 - note B_, 4 - note_type 12, 11, 2 - note D_, 1 - note D#, 1 - note D#, 2 - note D#, 2 - note D_, 2 - note D#, 2 - note D_, 2 - note D#, 2 - note F_, 2 - note D_, 1 - note D#, 1 - note D#, 2 - note D#, 2 - note D_, 2 - octave 2 - note A#, 2 - octave 3 - note B_, 2 - note_type 12, 11, 4 - note A#, 4 - sound_loop 0, Music_MeetJessieJames_branch_83187 - - -Music_MeetJessieJames_Ch2:: - duty_cycle 3 - vibrato 6, 1, 5 - note_type 12, 12, 2 - octave 4 - note D_, 1 - note C#, 1 - note C_, 2 - octave 3 - note B_, 2 - note A#, 2 - note A_, 2 - note G#, 2 - note G_, 2 - note F#, 2 - note_type 12, 12, 7 - note A_, 12 - octave 4 - note C#, 4 - -Music_MeetJessieJames_branch_831df:: - note_type 12, 12, 2 - octave 3 - note C#, 1 - note D_, 1 - note D_, 2 - note D_, 2 - note C#, 2 - note D_, 2 - note C#, 2 - note D_, 2 - note E_, 2 - note C#, 1 - note D_, 1 - note D_, 2 - note D_, 2 - note C#, 2 - octave 2 - note A_, 4 - note_type 12, 12, 5 - octave 4 - note C#, 4 - note_type 12, 12, 2 - note D_, 1 - octave 3 - note D_, 1 - note D_, 2 - note D_, 2 - note C#, 2 - note D_, 2 - note C#, 2 - note D_, 2 - note E_, 2 - note C#, 1 - note D_, 1 - note D_, 2 - note D_, 2 - note C#, 2 - note_type 12, 12, 6 - octave 4 - note D_, 8 - note_type 12, 12, 2 - note D#, 6 - note F_, 4 - note D#, 4 - octave 3 - note A#, 2 - octave 4 - note D#, 6 - note F_, 4 - note D#, 2 - note_type 12, 12, 5 - note D_, 4 - note_type 12, 12, 2 - note D#, 6 - note F_, 4 - note D#, 4 - octave 3 - note A#, 2 - octave 4 - note D#, 4 - note F_, 4 - note_type 12, 12, 5 - note D#, 8 - sound_loop 0, Music_MeetJessieJames_branch_831df - - -Music_MeetJessieJames_Ch3:: - note_type 12, 1, 0 - rest 16 - rest 8 - octave 4 - note D_, 2 - octave 3 - note A_, 2 - octave 4 - note C_, 2 - note D#, 2 - -Music_MeetJessieJames_branch_83235:: - note D_, 1 - rest 1 - note A_, 1 - rest 1 - note D_, 1 - rest 1 - note A_, 1 - rest 1 - note D_, 1 - rest 1 - note A_, 1 - rest 1 - note D_, 1 - rest 1 - note A_, 1 - rest 1 - note D_, 1 - rest 1 - note A_, 1 - rest 1 - note D_, 1 - rest 1 - note A_, 1 - rest 1 - note D_, 1 - rest 1 - note A#, 2 - note A_, 2 - note D#, 2 - note D_, 1 - rest 1 - note A_, 1 - rest 1 - note D_, 1 - rest 1 - note A_, 1 - rest 1 - note D_, 1 - rest 1 - note A_, 1 - rest 1 - note D_, 1 - rest 1 - note A_, 1 - rest 1 - note D_, 1 - rest 1 - note A_, 1 - rest 1 - note D_, 1 - rest 1 - note A_, 1 - rest 1 - note D_, 1 - rest 1 - octave 3 - note A_, 2 - octave 4 - note C_, 2 - note D_, 2 - note D#, 1 - rest 1 - note A#, 1 - rest 1 - note D#, 1 - rest 1 - note A#, 1 - rest 1 - note D#, 1 - rest 1 - note A#, 1 - rest 1 - note D#, 1 - rest 1 - note A#, 1 - rest 1 - note D#, 1 - rest 1 - note A#, 1 - rest 1 - note D#, 1 - rest 1 - note A#, 1 - rest 1 - note D#, 1 - rest 1 - octave 3 - note A#, 1 - rest 1 - octave 4 - note C#, 1 - rest 1 - note E_, 1 - rest 1 - note D#, 1 - rest 1 - note A#, 1 - rest 1 - note D#, 1 - rest 1 - note A#, 1 - rest 1 - note D#, 1 - rest 1 - note A#, 1 - rest 1 - note D#, 1 - rest 1 - note A#, 1 - rest 1 - note D#, 1 - rest 1 - note A#, 1 - rest 1 - note D#, 1 - rest 1 - note A#, 1 - rest 1 - note D#, 1 - rest 1 - octave 3 - note A#, 1 - rest 1 - octave 4 - note C#, 1 - rest 1 - note E_, 1 - rest 1 - sound_loop 0, Music_MeetJessieJames_branch_83235 diff --git a/audio/music/yellow/surfingpikachu.asm b/audio/music/yellow/surfingpikachu.asm deleted file mode 100644 index 8e161443..00000000 --- a/audio/music/yellow/surfingpikachu.asm +++ /dev/null @@ -1,690 +0,0 @@ -Music_SurfingPikachu_Ch1:: - tempo 117 - volume 7, 7 - duty_cycle 3 - vibrato 8, 1, 4 - note_type 12, 11, 3 - octave 3 - note E_, 6 - note_type 12, 11, 2 - note F#, 2 - note_type 12, 11, 3 - note E_, 6 - note_type 12, 11, 2 - note F#, 16 - rest 2 - note_type 12, 11, 3 - note E_, 6 - note_type 12, 11, 2 - note A_, 2 - note_type 12, 11, 3 - note E_, 6 - note_type 12, 11, 2 - note A_, 14 - note_type 12, 11, 2 - note D#, 2 - note C#, 1 - note D#, 1 - octave 2 - note B_, 6 - octave 3 - note E_, 4 - note E_, 4 - note E_, 8 - note G#, 4 - note G#, 4 - note G#, 2 - -Music_SurfingPikachu_branch_82d1a:: - note_type 12, 11, 3 - octave 3 - note G#, 4 - note E_, 4 - note F#, 4 - note E_, 2 - note A_, 2 - note G#, 2 - note F#, 2 - note G#, 2 - note F#, 2 - note E_, 2 - note D#, 2 - note E_, 2 - note D#, 2 - note C#, 6 - note F#, 2 - note A_, 8 - octave 2 - note B_, 6 - octave 3 - note E_, 2 - note G#, 8 - note G#, 4 - note E_, 4 - note F#, 4 - note E_, 2 - note A_, 2 - note G#, 2 - note F#, 2 - note G#, 2 - note A_, 2 - note G#, 2 - note F#, 2 - note E_, 2 - note G#, 2 - note F#, 6 - note E_, 2 - note F#, 1 - rest 3 - note A_, 4 - duty_cycle 0 - note_type 12, 11, 2 - note G#, 1 - note F#, 1 - note G#, 2 - note B_, 2 - note A_, 2 - note G#, 2 - note F#, 2 - note E_, 2 - note D#, 2 - note F#, 2 - note F#, 2 - note D#, 2 - note F#, 2 - note B_, 2 - note A_, 2 - note G#, 2 - note F#, 2 - note B_, 1 - note A#, 1 - note B_, 2 - note G#, 2 - note E_, 2 - note G#, 2 - note G_, 2 - note G#, 2 - note A_, 2 - octave 4 - note C#, 2 - note C_, 2 - note C#, 3 - octave 3 - note F#, 1 - note A_, 2 - note G#, 2 - note F#, 2 - note A_, 2 - note E_, 3 - note E_, 1 - note B_, 2 - note A_, 2 - note G#, 6 - note E_, 1 - note F_, 1 - note F#, 2 - note F#, 2 - note D#, 2 - note F#, 2 - note B_, 2 - note A_, 2 - note G#, 2 - note F#, 2 - note B_, 1 - note A#, 1 - note B_, 2 - note G#, 2 - note E_, 2 - note G#, 2 - note G_, 2 - note G#, 2 - note A_, 2 - octave 4 - note C#, 2 - note C_, 2 - note C#, 3 - octave 3 - note F#, 1 - note A_, 2 - note G#, 2 - note A_, 2 - octave 4 - note D#, 2 - note E_, 2 - note E_, 1 - note D#, 1 - note E_, 1 - note D#, 1 - note E_, 1 - note D#, 1 - note E_, 8 - duty_cycle 3 - sound_loop 0, Music_SurfingPikachu_branch_82d1a - - -Music_SurfingPikachu_Ch2:: - duty_cycle 3 - vibrato 6, 1, 5 - note_type 12, 12, 4 - octave 3 - note B_, 6 - note_type 12, 12, 2 - octave 4 - note E_, 2 - note_type 12, 12, 4 - octave 3 - note B_, 6 - note_type 12, 12, 2 - octave 4 - note E_, 2 - note_type 12, 11, 2 - octave 3 - note B_, 2 - octave 4 - note C#, 2 - note D#, 2 - note C#, 2 - octave 3 - note B_, 2 - note A_, 2 - note G#, 2 - note F#, 2 - note_type 12, 12, 4 - octave 4 - note C#, 6 - note_type 12, 12, 2 - note F#, 2 - note_type 12, 12, 4 - note C#, 6 - note_type 12, 12, 2 - note F#, 2 - note_type 12, 11, 2 - note C#, 2 - note D#, 2 - note E_, 2 - note D#, 2 - note C#, 2 - octave 3 - note B_, 2 - note A_, 2 - note G#, 2 - note_type 12, 12, 2 - note E_, 6 - note B_, 4 - note B_, 4 - note B_, 8 - note B_, 4 - note B_, 4 - note B_, 2 - -Music_SurfingPikachu_branch_82de0:: - note_type 12, 12, 6 - octave 4 - note E_, 4 - octave 3 - note B_, 4 - note A_, 4 - octave 4 - note C#, 4 - octave 3 - note B_, 6 - note A_, 2 - note G#, 8 - note F#, 6 - note A_, 2 - octave 4 - note C#, 8 - octave 3 - note E_, 6 - note G#, 2 - note B_, 8 - octave 4 - note E_, 4 - octave 3 - note B_, 4 - note A_, 4 - octave 4 - note C#, 4 - octave 3 - note B_, 6 - octave 4 - note D#, 2 - note E_, 8 - note D#, 6 - note C#, 2 - note D#, 1 - rest 3 - note F#, 4 - note E_, 10 - note_type 12, 12, 6 - duty_cycle 2 - note E_, 2 - note D#, 2 - note C#, 2 - octave 3 - note B_, 6 - octave 4 - note C#, 2 - note D#, 4 - octave 3 - note B_, 4 - octave 4 - note E_, 6 - note F#, 2 - note G#, 8 - note A_, 6 - note G#, 2 - note A_, 4 - note F#, 4 - note G#, 10 - note E_, 2 - note D#, 2 - note C#, 2 - octave 3 - note B_, 6 - octave 4 - note C#, 2 - note D#, 4 - octave 3 - note B_, 4 - octave 4 - note E_, 6 - note F#, 2 - note G#, 8 - note A_, 4 - note F#, 4 - note D#, 4 - octave 5 - note C#, 4 - octave 4 - note B_, 8 - note_type 12, 12, 2 - octave 5 - note E_, 4 - note_type 12, 12, 6 - duty_cycle 3 - octave 3 - note B_, 1 - note A#, 1 - note B_, 1 - octave 4 - note C#, 1 - sound_loop 0, Music_SurfingPikachu_branch_82de0 - - -Music_SurfingPikachu_Ch3:: - note_type 12, 1, 0 - octave 4 - note B_, 6 - octave 5 - note C#, 1 - rest 1 - octave 4 - note B_, 6 - octave 5 - note C#, 1 - rest 1 - octave 4 - note B_, 1 - rest 1 - note A_, 1 - rest 1 - note G#, 1 - rest 1 - note A_, 1 - rest 1 - note B_, 1 - rest 1 - octave 5 - note C#, 1 - rest 1 - note D#, 1 - rest 1 - note C#, 1 - rest 1 - octave 4 - note A_, 6 - octave 5 - note C#, 1 - rest 1 - octave 4 - note A_, 6 - octave 5 - note C#, 1 - rest 1 - octave 4 - note A_, 1 - rest 1 - note G#, 1 - rest 1 - note F#, 1 - rest 1 - note E_, 1 - rest 1 - note F#, 1 - rest 1 - note G#, 1 - rest 1 - note A_, 1 - rest 1 - note G#, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note C#, 1 - rest 1 - note D#, 1 - rest 1 - -Music_SurfingPikachu_branch_82ea0:: - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note F#, 1 - rest 1 - note A_, 1 - rest 1 - note F#, 1 - rest 1 - note A_, 1 - rest 1 - note F#, 1 - rest 1 - octave 5 - note C#, 1 - note C_, 1 - note C#, 1 - rest 1 - octave 4 - note F#, 1 - rest 1 - note E_, 1 - rest 1 - note G#, 1 - rest 1 - note E_, 1 - rest 1 - note G#, 1 - rest 1 - note E_, 1 - rest 1 - octave 5 - note E_, 1 - note D#, 1 - note E_, 1 - rest 1 - octave 4 - note D#, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note F#, 1 - rest 1 - note A_, 1 - rest 1 - note F#, 1 - rest 1 - note A_, 1 - rest 1 - note B_, 1 - rest 1 - note A_, 1 - rest 1 - note G#, 1 - rest 1 - note F#, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note C#, 1 - rest 1 - note D_, 1 - rest 1 - note D#, 1 - rest 1 - note F#, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note F#, 1 - rest 1 - note D#, 1 - rest 1 - note F#, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note F#, 1 - rest 1 - note E_, 1 - rest 1 - note G#, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note G#, 1 - rest 1 - note E_, 1 - rest 1 - note G#, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note G#, 1 - rest 1 - note F#, 1 - rest 1 - note A_, 1 - rest 1 - note C#, 1 - rest 1 - note A_, 1 - rest 1 - note F#, 1 - rest 1 - note A_, 1 - rest 1 - note C#, 1 - rest 1 - note A_, 1 - rest 1 - note B_, 1 - note A#, 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note F#, 1 - rest 1 - note G#, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note C#, 1 - rest 1 - note D_, 1 - rest 1 - note D#, 1 - rest 1 - note F#, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note F#, 1 - rest 1 - note D#, 1 - rest 1 - note F#, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note F#, 1 - rest 1 - note E_, 1 - rest 1 - note G#, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note G#, 1 - rest 1 - note E_, 1 - rest 1 - note G#, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note G#, 1 - rest 1 - note F#, 1 - rest 1 - note A_, 1 - rest 1 - note C#, 1 - rest 1 - note A_, 1 - rest 1 - note F#, 1 - rest 1 - note A_, 1 - rest 1 - note F#, 1 - rest 1 - note D#, 1 - rest 1 - note B_, 1 - rest 1 - note B_, 1 - rest 1 - note A_, 1 - rest 1 - note A_, 1 - rest 1 - note G#, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note C#, 1 - rest 1 - note D#, 1 - rest 1 - sound_loop 0, Music_SurfingPikachu_branch_82ea0 diff --git a/audio/music/yellow/yellowintro.asm b/audio/music/yellow/yellowintro.asm deleted file mode 100644 index bb741a22..00000000 --- a/audio/music/yellow/yellowintro.asm +++ /dev/null @@ -1,484 +0,0 @@ -Music_YellowIntro_Ch1:: - tempo 116 - volume 7, 7 - duty_cycle 3 - vibrato 8, 1, 4 - note_type 12, 11, 2 - octave 3 - note G#, 2 - note B_, 4 - note B_, 4 - note B_, 4 - note B_, 4 - note B_, 4 - note B_, 3 - note A#, 1 - note B_, 2 - note B_, 10 - note_type 12, 11, 6 - octave 4 - note C#, 1 - note C_, 1 - note C#, 10 - octave 3 - note G#, 1 - note G_, 1 - note G#, 4 - note B_, 4 - octave 4 - note E_, 4 - note F#, 8 - note E_, 8 - octave 3 - note A_, 4 - note B_, 4 - octave 4 - note C#, 4 - octave 3 - note B_, 4 - note G#, 6 - note_type 12, 11, 2 - note B_, 2 - note_type 12, 11, 6 - note G#, 6 - note_type 12, 11, 2 - note B_, 2 - note_type 12, 11, 6 - octave 4 - note E_, 6 - note_type 12, 11, 2 - note G#, 2 - note_type 12, 11, 6 - note E_, 6 - note_type 12, 11, 2 - note G#, 2 - note_type 12, 11, 6 - octave 3 - note A_, 4 - note F#, 4 - note A_, 4 - note B_, 4 - note F#, 4 - note G#, 4 - note A_, 2 - note G#, 2 - note F#, 2 - note D#, 2 - note_type 12, 11, 3 - note B_, 2 - octave 4 - note E_, 4 - note E_, 4 - note E_, 4 - note E_, 2 - note C#, 2 - note F#, 4 - note F#, 3 - note D#, 1 - note F#, 2 - note F#, 8 - note_type 12, 11, 6 - note F#, 1 - note F_, 1 - note F#, 8 - octave 3 - note B_, 1 - note A#, 1 - note B_, 8 - octave 4 - note F#, 1 - note F_, 1 - note F#, 2 - note_type 12, 11, 3 - note F#, 1 - note E_, 1 - note D#, 1 - note C#, 1 - note_type 12, 11, 2 - octave 3 - note B_, 16 - sound_ret - - -Music_YellowIntro_Ch2:: - duty_cycle 2 - vibrato 6, 1, 5 - note_type 12, 12, 2 - octave 3 - note B_, 2 - octave 4 - note E_, 4 - note E_, 4 - note E_, 4 - note E_, 4 - note E_, 4 - note E_, 3 - note D#, 1 - note E_, 2 - note E_, 4 - note_type 12, 12, 5 - note G#, 1 - note G_, 1 - note G#, 10 - octave 3 - note B_, 1 - note A#, 1 - note B_, 6 - note_type 12, 12, 7 - octave 4 - note E_, 4 - note G#, 4 - note B_, 4 - octave 5 - note C#, 16 - octave 4 - note A_, 4 - note G#, 4 - note F#, 4 - note E_, 4 - octave 3 - note B_, 6 - note_type 12, 12, 2 - octave 4 - note E_, 2 - note_type 12, 12, 7 - octave 3 - note B_, 6 - note_type 12, 12, 2 - octave 4 - note E_, 2 - note_type 12, 12, 7 - note G#, 6 - note_type 12, 12, 2 - note B_, 2 - note_type 12, 12, 7 - note G#, 6 - note_type 12, 12, 2 - note B_, 2 - note_type 12, 12, 7 - note C#, 4 - octave 3 - note A_, 4 - octave 4 - note C#, 4 - note D#, 4 - note E_, 2 - note D#, 2 - note C#, 2 - note D#, 4 - note D#, 2 - note C#, 2 - octave 3 - note B_, 2 - note_type 12, 12, 3 - octave 4 - note E_, 2 - note G#, 4 - note G#, 4 - note G#, 4 - note G#, 2 - note F#, 2 - note A_, 4 - note A_, 3 - note F#, 1 - note A_, 2 - note A_, 4 - note_type 12, 12, 7 - note B_, 1 - note A#, 1 - note B_, 8 - note B_, 1 - note A#, 1 - note B_, 8 - note B_, 1 - note A#, 1 - note B_, 6 - note_type 12, 12, 3 - note B_, 1 - note A_, 1 - note G#, 1 - note F#, 1 - note_type 12, 12, 2 - note E_, 16 - sound_ret - - -Music_YellowIntro_Ch3:: - note_type 12, 1, 0 - octave 4 - note E_, 1 - rest 1 - note G#, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note G#, 1 - rest 1 - note E_, 1 - rest 1 - note G#, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note G#, 1 - rest 1 - note E_, 1 - rest 1 - note G#, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note G#, 1 - rest 1 - note E_, 1 - rest 1 - octave 3 - note B_, 1 - rest 1 - octave 4 - note C#, 1 - rest 1 - note D#, 1 - rest 1 - note G#, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note G#, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note G#, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note G#, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note F#, 1 - rest 1 - note A_, 1 - rest 1 - note C#, 1 - rest 1 - note A_, 1 - rest 1 - note F#, 1 - rest 1 - note A_, 1 - rest 1 - note C#, 1 - rest 1 - note A_, 1 - rest 1 - note A_, 1 - rest 1 - octave 5 - note C#, 1 - rest 1 - octave 4 - note F#, 1 - rest 1 - octave 5 - note C#, 1 - rest 1 - octave 4 - note A_, 1 - rest 1 - octave 5 - note C#, 1 - rest 1 - octave 4 - note F#, 1 - rest 1 - octave 5 - note C#, 1 - rest 1 - octave 4 - note B_, 1 - rest 1 - octave 5 - note E_, 1 - rest 1 - octave 4 - note G#, 1 - rest 1 - octave 5 - note E_, 1 - rest 1 - octave 4 - note B_, 1 - rest 1 - octave 5 - note E_, 1 - rest 1 - octave 4 - note G#, 1 - rest 1 - octave 5 - note E_, 1 - rest 1 - octave 4 - note G#, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note G#, 1 - rest 1 - note E_, 1 - rest 1 - note G#, 1 - rest 1 - note B_, 1 - rest 1 - note A_, 1 - rest 1 - octave 5 - note C#, 1 - rest 1 - octave 4 - note F#, 1 - rest 1 - octave 5 - note C#, 1 - rest 1 - octave 4 - note A_, 1 - rest 1 - octave 5 - note C#, 1 - rest 1 - octave 4 - note F#, 1 - rest 1 - octave 5 - note C#, 1 - rest 1 - octave 4 - note A_, 1 - rest 1 - octave 5 - note C#, 1 - rest 1 - octave 4 - note F#, 1 - rest 1 - octave 5 - note C#, 1 - rest 1 - octave 4 - note A_, 1 - rest 1 - octave 5 - note C#, 1 - rest 1 - octave 4 - note B_, 1 - rest 1 - note A_, 1 - rest 1 - note G#, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note G#, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note G#, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note G#, 1 - rest 1 - note B_, 1 - rest 1 - note E_, 1 - rest 1 - note B_, 1 - rest 1 - note A_, 1 - rest 1 - octave 5 - note E_, 1 - rest 1 - octave 4 - note E_, 1 - rest 1 - octave 5 - note E_, 1 - rest 1 - octave 4 - note A_, 1 - rest 1 - octave 5 - note E_, 1 - rest 1 - octave 4 - note E_, 1 - rest 1 - octave 5 - note E_, 1 - rest 1 - octave 4 - note A_, 1 - rest 1 - octave 5 - note F#, 1 - rest 1 - octave 4 - note F#, 1 - rest 1 - octave 5 - note C#, 1 - rest 3 - note F#, 1 - rest 1 - octave 4 - note F#, 1 - note G#, 1 - note A_, 1 - octave 5 - note C#, 1 - note E_, 1 - rest 15 - sound_ret diff --git a/audio/music/yellow/yellowunusedsong.asm b/audio/music/yellow/yellowunusedsong.asm deleted file mode 100644 index f1e4d18f..00000000 --- a/audio/music/yellow/yellowunusedsong.asm +++ /dev/null @@ -1,326 +0,0 @@ -Music_YellowUnusedSong_Ch1:: - tempo 140 - volume 7, 7 - duty_cycle 3 - vibrato 8, 1, 4 - note_type 8, 11, 2 - octave 3 - note A_, 6 - note A_, 2 - note A_, 2 - note A_, 2 - note A#, 6 - note A#, 6 - note G_, 6 - note G_, 6 - note A_, 6 - note E_, 6 - note A_, 6 - note A_, 2 - note A_, 2 - note A_, 2 - note A#, 6 - note A#, 6 - note A_, 6 - note G_, 6 - note A_, 12 - -Music_YellowUnusedSong_branch_82fde:: - note A_, 6 - note A_, 2 - note A_, 2 - note A_, 2 - note A#, 6 - note A#, 6 - note G_, 6 - note G_, 6 - note A_, 6 - note E_, 6 - note A_, 6 - note A_, 2 - note A_, 2 - note A_, 2 - note A#, 6 - note A#, 6 - note G_, 6 - octave 4 - note D#, 6 - note D_, 12 - rest 16 - rest 16 - rest 16 - rest 16 - rest 16 - rest 16 - octave 3 - note A_, 6 - note A_, 2 - note A_, 2 - note A_, 2 - note A#, 6 - note A#, 6 - note G_, 6 - note G_, 6 - note A_, 6 - note E_, 6 - note A_, 6 - note A_, 2 - note A_, 2 - note A_, 2 - note A#, 6 - note A#, 6 - note A_, 6 - note G_, 6 - note A_, 12 - sound_loop 0, Music_YellowUnusedSong_branch_82fde - - -Music_YellowUnusedSong_Ch2:: - duty_cycle 2 - note_type 8, 12, 2 - octave 4 - note D_, 6 - note D_, 2 - note D_, 2 - note D_, 2 - note D#, 6 - note D#, 6 - note C_, 6 - note C_, 6 - note D_, 6 - octave 3 - note A_, 6 - octave 4 - note D_, 6 - note D_, 2 - note D_, 2 - note D_, 2 - note D#, 6 - note D#, 6 - note D_, 6 - note A#, 6 - note A_, 12 - -Music_YellowUnusedSong_branch_8302a:: - note D_, 6 - note D_, 2 - note D_, 2 - note D_, 2 - note D#, 6 - note D#, 6 - note C_, 6 - note C_, 6 - note D_, 6 - octave 3 - note A_, 6 - octave 4 - note D_, 6 - note D_, 2 - note D_, 2 - note D_, 2 - note D#, 6 - note D#, 6 - note C_, 6 - note G#, 6 - note G_, 12 - note_type 8, 9, 0 - octave 3 - note D#, 16 - note D#, 8 - note D#, 16 - note D#, 8 - octave 2 - note A#, 16 - note A#, 8 - octave 3 - note D#, 12 - note F_, 12 - note_type 8, 12, 2 - octave 4 - note D_, 6 - note D_, 2 - note D_, 2 - note D_, 2 - note D#, 6 - note D#, 6 - note C_, 6 - note C_, 6 - note D_, 6 - octave 3 - note A_, 6 - octave 4 - note D_, 6 - note D_, 2 - note D_, 2 - note D_, 2 - note D#, 6 - note D#, 6 - note D_, 6 - note A#, 6 - note A_, 12 - sound_loop 0, Music_YellowUnusedSong_branch_8302a - - -Music_YellowUnusedSong_Ch3:: - note_type 12, 1, 0 - vibrato 2, 1, 5 - rest 16 - rest 12 - octave 4 - note C_, 4 - note D_, 8 - note D#, 8 - note G_, 8 - note A#, 8 - -Music_YellowUnusedSong_branch_83075:: - note A_, 8 - note A#, 8 - note G_, 8 - note A_, 4 - note D_, 4 - note A_, 8 - note A#, 8 - octave 5 - note C#, 8 - note D_, 8 - note D#, 16 - note D#, 16 - octave 4 - note A#, 16 - octave 5 - note D#, 8 - note F_, 8 - octave 4 - note D_, 16 - note D_, 16 - octave 4 - note D_, 8 - note D#, 8 - note G_, 8 - note A#, 8 - sound_loop 0, Music_YellowUnusedSong_branch_83075 - - -Music_YellowUnusedSong_Ch4:: - drum_speed 12 - drum_note 3, 4 - drum_speed 8 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_speed 12 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_speed 8 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_speed 12 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 4 - drum_note 3, 4 - -Music_YellowUnusedSong_branch_830c3:: - drum_note 3, 4 - drum_speed 8 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_speed 12 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_speed 8 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_speed 12 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_speed 8 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_speed 12 - drum_note 3, 4 - drum_speed 8 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_speed 12 - drum_note 3, 4 - drum_speed 8 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_speed 12 - drum_note 3, 4 - drum_speed 8 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_speed 12 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 4 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 4 - drum_speed 8 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_speed 12 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 4 - drum_speed 8 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_speed 12 - drum_note 3, 4 - drum_note 3, 4 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 2 - drum_note 3, 4 - drum_note 3, 4 - sound_loop 0, Music_YellowUnusedSong_branch_830c3 -- cgit v1.3.1-sl0p From 9878f01e29b1443d6c894c1332cbf381fa12646e Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 3 Jul 2020 16:37:47 -0400 Subject: Organize macros/ like pokecrystal While doing so I replaced the StopAllMusic macro with a SFX_STOP_ALL_MUSIC constant and applied it throughout the code. --- audio/play_battle_music.asm | 4 +- audio/pokedex_rating_sfx.asm | 2 +- constants.asm | 1 + constants/audio_constants.asm | 26 ++ constants/map_data_constants.asm | 5 + constants/map_object_constants.asm | 14 + constants/music_constants.asm | 2 + constants/sprite_data_constants.asm | 6 - data/tilesets/tileset_headers.asm | 8 + engine/battle/core.asm | 2 +- engine/events/hidden_objects/bills_house_pc.asm | 2 +- engine/events/hidden_objects/safari_game.asm | 2 +- engine/items/item_effects.asm | 4 +- engine/link/cable_club.asm | 4 +- engine/movie/credits.asm | 2 +- engine/movie/evolution.asm | 4 +- engine/movie/oak_speech/oak_speech.asm | 8 +- engine/overworld/elevator.asm | 4 +- engine/overworld/healing_machine.asm | 4 +- home.asm | 4 +- home/overworld.asm | 2 +- macros.asm | 16 +- macros/asm_macros.asm | 192 ---------- macros/audio_macros.asm | 214 ----------- macros/code.asm | 9 + macros/coords.asm | 65 ++++ macros/data.asm | 62 ++++ macros/data_macros.asm | 253 ------------- macros/enum.asm | 43 +++ macros/event_macros.asm | 441 ---------------------- macros/farcall.asm | 37 ++ macros/predef.asm | 49 +++ macros/scripts/audio.asm | 186 ++++++++++ macros/scripts/events.asm | 471 ++++++++++++++++++++++++ macros/scripts/maps.asm | 184 +++++++++ macros/scripts/text.asm | 78 ++++ macros/text_macros.asm | 80 ---- scripts/CeruleanCity.asm | 4 +- scripts/OaksLab.asm | 4 +- scripts/PalletTown.asm | 4 +- scripts/PewterPokecenter.asm | 3 +- scripts/PokemonTower2F.asm | 4 +- scripts/Route22.asm | 10 +- scripts/SSAnne2F.asm | 4 +- scripts/SSAnneCaptainsRoom.asm | 2 +- scripts/SilphCo7F.asm | 4 +- scripts/VermilionDock.asm | 2 +- 47 files changed, 1296 insertions(+), 1235 deletions(-) create mode 100644 constants/map_object_constants.asm delete mode 100755 macros/asm_macros.asm delete mode 100755 macros/audio_macros.asm create mode 100755 macros/code.asm create mode 100644 macros/coords.asm create mode 100755 macros/data.asm delete mode 100755 macros/data_macros.asm create mode 100644 macros/enum.asm delete mode 100755 macros/event_macros.asm create mode 100644 macros/farcall.asm create mode 100644 macros/predef.asm create mode 100755 macros/scripts/audio.asm create mode 100755 macros/scripts/events.asm create mode 100644 macros/scripts/maps.asm create mode 100755 macros/scripts/text.asm delete mode 100755 macros/text_macros.asm (limited to 'audio') diff --git a/audio/play_battle_music.asm b/audio/play_battle_music.asm index 35dd19ad..f8bfcd19 100644 --- a/audio/play_battle_music.asm +++ b/audio/play_battle_music.asm @@ -2,9 +2,9 @@ PlayBattleMusic:: xor a ld [wAudioFadeOutControl], a ld [wLowHealthAlarm], a - dec a + dec a ; SFX_STOP_ALL_MUSIC ld [wNewSoundID], a - call PlaySound ; stop music + call PlaySound call DelayFrame ld c, BANK(Music_GymLeaderBattle) ld a, [wGymLeaderNo] diff --git a/audio/pokedex_rating_sfx.asm b/audio/pokedex_rating_sfx.asm index a218d5e6..f3aace8a 100644 --- a/audio/pokedex_rating_sfx.asm +++ b/audio/pokedex_rating_sfx.asm @@ -10,7 +10,7 @@ PlayPokedexRatingSfx:: jr .getSfxPointer .gotSfxPointer push bc - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySoundWaitForCurrent pop bc diff --git a/constants.asm b/constants.asm index 996458a4..cd306680 100644 --- a/constants.asm +++ b/constants.asm @@ -29,6 +29,7 @@ INCLUDE "constants/palette_constants.asm" INCLUDE "constants/list_constants.asm" INCLUDE "constants/map_constants.asm" INCLUDE "constants/map_data_constants.asm" +INCLUDE "constants/map_object_constants.asm" INCLUDE "constants/hide_show_constants.asm" INCLUDE "constants/credits_constants.asm" INCLUDE "constants/audio_constants.asm" diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm index bb2bb7f2..38719f92 100644 --- a/constants/audio_constants.asm +++ b/constants/audio_constants.asm @@ -1,3 +1,29 @@ +; pitch + const_def + const C_ ; 0 + const C# ; 1 + const D_ ; 2 + const D# ; 3 + const E_ ; 4 + const F_ ; 5 + const F# ; 6 + const G_ ; 7 + const G# ; 8 + const A_ ; 9 + const A# ; A + const B_ ; B + +; channel + const_def + const Ch1 ; 0 + const Ch2 ; 1 + const Ch3 ; 2 + const Ch4 ; 3 + const Ch5 ; 4 + const Ch6 ; 5 + const Ch7 ; 6 + const Ch8 ; 7 + ; HW sound channel register base addresses HW_CH1_BASE EQU (rNR10 % $100) HW_CH2_BASE EQU ((rNR21 % $100) - 1) diff --git a/constants/map_data_constants.asm b/constants/map_data_constants.asm index 154c4163..4b98bdb3 100755 --- a/constants/map_data_constants.asm +++ b/constants/map_data_constants.asm @@ -7,3 +7,8 @@ EAST EQU 1 WEST EQU 2 SOUTH EQU 4 NORTH EQU 8 + +; tileset environments +INDOOR EQU 0 +CAVE EQU 1 +OUTDOOR EQU 2 diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm new file mode 100644 index 00000000..f5fc952b --- /dev/null +++ b/constants/map_object_constants.asm @@ -0,0 +1,14 @@ +; different kinds of people events +ITEM EQU $80 +TRAINER EQU $40 + +WALK EQU $FE +STAY EQU $FF + +DOWN EQU $D0 +UP EQU $D1 +LEFT EQU $D2 +RIGHT EQU $D3 +NONE EQU $FF + +BOULDER_MOVEMENT_BYTE_2 EQU $10 diff --git a/constants/music_constants.asm b/constants/music_constants.asm index 9f726fb7..7bbe5c62 100644 --- a/constants/music_constants.asm +++ b/constants/music_constants.asm @@ -238,3 +238,5 @@ MAX_SFX_ID_2 EQUS "SFX_SILPH_SCOPE" music_const SFX_SLOTS_NEW_SPIN, SFX_Slots_New_Spin music_const SFX_SHOOTING_STAR, SFX_Shooting_Star MAX_SFX_ID_3 EQUS "SFX_SHOOTING_STAR" + +SFX_STOP_ALL_MUSIC EQU $ff diff --git a/constants/sprite_data_constants.asm b/constants/sprite_data_constants.asm index d5788cb1..48a34446 100644 --- a/constants/sprite_data_constants.asm +++ b/constants/sprite_data_constants.asm @@ -1,9 +1,3 @@ -; different kinds of people events -ITEM EQU $80 -TRAINER EQU $40 - -BOULDER_MOVEMENT_BYTE_2 EQU $10 - ; sprite facing directions SPRITE_FACING_DOWN EQU $00 SPRITE_FACING_UP EQU $04 diff --git a/data/tilesets/tileset_headers.asm b/data/tilesets/tileset_headers.asm index d8e0d9b4..8f825330 100755 --- a/data/tilesets/tileset_headers.asm +++ b/data/tilesets/tileset_headers.asm @@ -1,3 +1,11 @@ +tileset: MACRO + db BANK(\2) ; BANK(GFX) + dw \1, \2, \3 ; Block, GFX, Coll + db \4, \5, \6 ; counter tiles + db \7 ; grass tile + db \8 ; permission (indoor, cave, outdoor) +ENDM + Tilesets: tileset Overworld_Block, Overworld_GFX, Overworld_Coll, $FF,$FF,$FF, $52, OUTDOOR tileset RedsHouse1_Block, RedsHouse1_GFX, RedsHouse1_Coll, $FF,$FF,$FF, $FF, INDOOR diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 86c3f5e5..647436ff 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -958,7 +958,7 @@ TrainerDefeatedText: PlayBattleVictoryMusic: push af - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySoundWaitForCurrent ld c, BANK(Music_DefeatedTrainer) diff --git a/engine/events/hidden_objects/bills_house_pc.asm b/engine/events/hidden_objects/bills_house_pc.asm index 1ffb6954..836aace0 100644 --- a/engine/events/hidden_objects/bills_house_pc.asm +++ b/engine/events/hidden_objects/bills_house_pc.asm @@ -52,7 +52,7 @@ BillsHouseInitiatedText:: TX_FAR _BillsHouseInitiatedText TX_BLINK TX_ASM - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld c, 16 diff --git a/engine/events/hidden_objects/safari_game.asm b/engine/events/hidden_objects/safari_game.asm index 785bab7f..68fc943f 100644 --- a/engine/events/hidden_objects/safari_game.asm +++ b/engine/events/hidden_objects/safari_game.asm @@ -27,7 +27,7 @@ SafariZoneGameOver: call EnableAutoTextBoxDrawing xor a ld [wAudioFadeOutControl], a - dec a + dec a ; SFX_STOP_ALL_MUSIC call PlaySound ld c, BANK(SFX_Safari_Zone_PA) ld a, SFX_SAFARI_ZONE_PA diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index e1723118..1214a3f8 100755 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1844,8 +1844,8 @@ PlayedFluteHadEffectText: and a jr nz, .done ; play out-of-battle pokeflute music - ld a, $ff - call PlaySound ; turn off music + ld a, SFX_STOP_ALL_MUSIC + call PlaySound ld a, SFX_POKEFLUTE ld c, BANK(SFX_Pokeflute) call PlayMusic diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 141ed396..8aadf1e5 100755 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -139,7 +139,7 @@ CableClub_DoBattleOrTradeAgain: call Serial_ExchangeBytes ld a, (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK) ld [rIE], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC call PlaySound ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK @@ -261,7 +261,7 @@ CableClub_DoBattleOrTradeAgain: ld [wUnusedCF8D + 1], a xor a ld [wTradeCenterPointerTableIndex], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC call PlaySound ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK diff --git a/engine/movie/credits.asm b/engine/movie/credits.asm index f6900602..dd735df6 100755 --- a/engine/movie/credits.asm +++ b/engine/movie/credits.asm @@ -21,7 +21,7 @@ HallOfFamePC: ld a, %11000000 ld [rBGP], a call EnableLCD - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC call PlaySoundWaitForCurrent ld c, BANK(Music_Credits) ld a, MUSIC_CREDITS diff --git a/engine/movie/evolution.asm b/engine/movie/evolution.asm index 731735c5..af2ed13b 100755 --- a/engine/movie/evolution.asm +++ b/engine/movie/evolution.asm @@ -9,7 +9,7 @@ EvolveMon: xor a ld [wLowHealthAlarm], a ld [wChannelSoundIDs + Ch5], a - dec a + dec a ; SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld a, $1 @@ -67,7 +67,7 @@ EvolveMon: ld a, [wEvoNewSpecies] .done ld [wWholeScreenPaletteMonSpecies], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld a, [wWholeScreenPaletteMonSpecies] diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index b1acfb65..fdcb4778 100755 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -32,8 +32,8 @@ SetDefaultNames: jp CopyData OakSpeech: - ld a, $FF - call PlaySound ; stop music + ld a, SFX_STOP_ALL_MUSIC + call PlaySound ld a, BANK(Music_Routes2) ld c, a ld a, MUSIC_ROUTES2 @@ -133,9 +133,9 @@ OakSpeech: ld [wAudioSavedROMBank], a ld a, 10 ld [wAudioFadeOutControl], a - ld a, $FF + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a - call PlaySound ; stop music + call PlaySound pop af ld [H_LOADEDROMBANK], a ld [MBC1RomBank], a diff --git a/engine/overworld/elevator.asm b/engine/overworld/elevator.asm index d36e2f2c..05ca08c9 100755 --- a/engine/overworld/elevator.asm +++ b/engine/overworld/elevator.asm @@ -4,7 +4,7 @@ ShakeElevator:: ld de, SCREEN_HEIGHT * $20 call ShakeElevatorRedrawRow call Delay3 - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC call PlaySound ld a, [hSCY] ld d, a @@ -27,7 +27,7 @@ ShakeElevator:: jr nz, .shakeLoop ld a, d ld [hSCY], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC call PlaySound ld c, BANK(SFX_Safari_Zone_PA) ld a, SFX_SAFARI_ZONE_PA diff --git a/engine/overworld/healing_machine.asm b/engine/overworld/healing_machine.asm index 510f963b..836af44d 100755 --- a/engine/overworld/healing_machine.asm +++ b/engine/overworld/healing_machine.asm @@ -17,7 +17,7 @@ AnimateHealingMachine: call CopyHealingMachineOAM ld a, 4 ld [wAudioFadeOutControl], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound .waitLoop @@ -38,7 +38,7 @@ AnimateHealingMachine: cp BANK(Audio3_UpdateMusic) ld [wAudioSavedROMBank], a jr nz, .next - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld a, BANK(Music_PkmnHealed) diff --git a/home.asm b/home.asm index bb581454..07cb6c0e 100644 --- a/home.asm +++ b/home.asm @@ -939,7 +939,7 @@ FadeOutAudio:: ld b, a xor a ld [wAudioFadeOutControl], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld a, [wAudioSavedROMBank] @@ -2506,7 +2506,7 @@ PlayTrainerMusic:: ret nz xor a ld [wAudioFadeOutControl], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC call PlaySound ld a, BANK(Music_MeetEvilTrainer) ld [wAudioROMBank], a diff --git a/home/overworld.asm b/home/overworld.asm index 460ce11e..cc8c498c 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -772,7 +772,7 @@ HandleBlackOut:: StopMusic:: ld [wAudioFadeOutControl], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound .wait diff --git a/macros.asm b/macros.asm index b779ec5f..a092d25c 100644 --- a/macros.asm +++ b/macros.asm @@ -1,5 +1,11 @@ -INCLUDE "macros/asm_macros.asm" -INCLUDE "macros/data_macros.asm" -INCLUDE "macros/text_macros.asm" -INCLUDE "macros/audio_macros.asm" -INCLUDE "macros/event_macros.asm" +INCLUDE "macros/enum.asm" +INCLUDE "macros/predef.asm" +INCLUDE "macros/farcall.asm" +INCLUDE "macros/data.asm" +INCLUDE "macros/code.asm" +INCLUDE "macros/coords.asm" + +INCLUDE "macros/scripts/audio.asm" +INCLUDE "macros/scripts/maps.asm" +INCLUDE "macros/scripts/events.asm" +INCLUDE "macros/scripts/text.asm" diff --git a/macros/asm_macros.asm b/macros/asm_macros.asm deleted file mode 100755 index d3f00b0c..00000000 --- a/macros/asm_macros.asm +++ /dev/null @@ -1,192 +0,0 @@ - -lb: MACRO ; r, hi, lo - ld \1, ((\2) & $ff) << 8 + ((\3) & $ff) -ENDM - -homecall: MACRO - ld a, [H_LOADEDROMBANK] - push af - ld a, BANK(\1) - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a - call \1 - pop af - ld [H_LOADEDROMBANK], a - ld [MBC1RomBank], a -ENDM - -farcall EQUS "callba" - -callba: MACRO - ld b, BANK(\1) - ld hl, \1 - call Bankswitch -ENDM - -callab: MACRO - ld hl, \1 - ld b, BANK(\1) - call Bankswitch -ENDM - -jpba: MACRO - ld b, BANK(\1) - ld hl, \1 - jp Bankswitch -ENDM - -jpab: MACRO - ld hl, \1 - ld b, BANK(\1) - jp Bankswitch -ENDM - -validateCoords: MACRO - IF \1 >= SCREEN_WIDTH - fail "x coord out of range" - ENDC - IF \2 >= SCREEN_HEIGHT - fail "y coord out of range" - ENDC -ENDM - -;\1 = r -;\2 = X -;\3 = Y -;\4 = which tilemap (optional) -coord: MACRO - validateCoords \2, \3 - IF _NARG >= 4 - ld \1, \4 + SCREEN_WIDTH * \3 + \2 - ELSE - ld \1, wTileMap + SCREEN_WIDTH * \3 + \2 - ENDC -ENDM - -;\1 = X -;\2 = Y -;\3 = which tilemap (optional) -aCoord: MACRO - validateCoords \1, \2 - IF _NARG >= 3 - ld a, [\3 + SCREEN_WIDTH * \2 + \1] - ELSE - ld a, [wTileMap + SCREEN_WIDTH * \2 + \1] - ENDC -ENDM - -;\1 = X -;\2 = Y -;\3 = which tilemap (optional) -Coorda: MACRO - validateCoords \1, \2 - IF _NARG >= 3 - ld [\3 + SCREEN_WIDTH * \2 + \1], a - ELSE - ld [wTileMap + SCREEN_WIDTH * \2 + \1], a - ENDC -ENDM - -;\1 = X -;\2 = Y -;\3 = which tilemap (optional) -dwCoord: MACRO - validateCoords \1, \2 - IF _NARG >= 3 - dw \3 + SCREEN_WIDTH * \2 + \1 - ELSE - dw wTileMap + SCREEN_WIDTH * \2 + \1 - ENDC -ENDM - -;\1 = r -;\2 = X -;\3 = Y -;\4 = map width -overworldMapCoord: MACRO - ld \1, wOverworldMap + ((\2) + 3) + (((\3) + 3) * ((\4) + (3 * 2))) -ENDM - -; macro for two nibbles -dn: MACRO - db (\1 << 4 | \2) -ENDM - -; macro for putting a byte then a word -dbw: MACRO - db \1 - dw \2 -ENDM - -dba: MACRO - dbw BANK(\1), \1 -ENDM - -dwb: MACRO - dw \1 - db \2 -ENDM - -dab: MACRO - dwb \1, BANK(\1) -ENDM - -dbbw: MACRO - db \1, \2 - dw \3 -ENDM - -; Predef macro. -predef_const: MACRO - const \1PredefID -ENDM - -add_predef: MACRO -\1Predef:: - db BANK(\1) - dw \1 -ENDM - -predef_id: MACRO - ld a, (\1Predef - PredefPointers) / 3 -ENDM - -predef: MACRO - predef_id \1 - call Predef -ENDM - -predef_jump: MACRO - predef_id \1 - jp Predef -ENDM - -tx_pre_const: MACRO - const \1_id -ENDM - -add_tx_pre: MACRO -\1_id:: dw \1 -ENDM - -db_tx_pre: MACRO - db (\1_id - TextPredefs) / 2 + 1 -ENDM - -tx_pre_id: MACRO - ld a, (\1_id - TextPredefs) / 2 + 1 -ENDM - -tx_pre: MACRO - tx_pre_id \1 - call PrintPredefTextID -ENDM - -tx_pre_jump: MACRO - tx_pre_id \1 - jp PrintPredefTextID -ENDM - -ldPal: MACRO - ld \1, \2 << 6 | \3 << 4 | \4 << 2 | \5 -ENDM diff --git a/macros/audio_macros.asm b/macros/audio_macros.asm deleted file mode 100755 index 95b9ecbc..00000000 --- a/macros/audio_macros.asm +++ /dev/null @@ -1,214 +0,0 @@ - -StopAllMusic: MACRO - ld a, $ff - call PlaySound -ENDM - -Ch1 EQU 0 -Ch2 EQU 1 -Ch3 EQU 2 -Ch4 EQU 3 -Ch5 EQU 4 -Ch6 EQU 5 -Ch7 EQU 6 -Ch8 EQU 7 - -audio_header: MACRO - db (_NARG - 2) << 6 | \2 - dw \1_\2 - IF _NARG > 2 - db \3 - dw \1_\3 - ENDC - IF _NARG > 3 - db \4 - dw \1_\4 - ENDC - IF _NARG > 4 - db \5 - dw \1_\5 - ENDC -ENDM - -; arguments: length [0, 7], pitch change [-7, 7] -; length: length of time between pitch shifts -; sometimes used with a value >7 in which case the MSB is ignored -; pitch change: positive value means increase in pitch, negative value means decrease in pitch -; small magnitude means quick change, large magnitude means slow change -; in signed magnitude representation, so a value of 8 is the same as (negative) 0 -pitch_sweep: MACRO - db $10 - IF \2 < 0 - db (\1 << 4) | (%1000 | (\2 * -1)) - ELSE - db (\1 << 4) | \2 - ENDC -ENDM - -; arguments: length [0, 15], volume [0, 15], fade [-7, 7], frequency -; fade: positive value means decrease in volume, negative value means increase in volume -; small magnitude means quick change, large magnitude means slow change -; in signed magnitude representation, so a value of 8 is the same as (negative) 0 -square_note: MACRO - db $20 | \1 - IF \3 < 0 - db (\2 << 4) | (%1000 | (\3 * -1)) - ELSE - db (\2 << 4) | \3 - ENDC - dw \4 -ENDM - -; arguments: length [0, 15], volume [0, 15], fade [-7, 7], frequency -; fade: positive value means decrease in volume, negative value means increase in volume -; small magnitude means quick change, large magnitude means slow change -; in signed magnitude representation, so a value of 8 is the same as (negative) 0 -noise_note: MACRO - db $20 | \1 - IF \3 < 0 - db (\2 << 4) | (%1000 | (\3 * -1)) - ELSE - db (\2 << 4) | \3 - ENDC - db \4 -ENDM - -C_ EQU $0 -C# EQU $1 -D_ EQU $2 -D# EQU $3 -E_ EQU $4 -F_ EQU $5 -F# EQU $6 -G_ EQU $7 -G# EQU $8 -A_ EQU $9 -A# EQU $A -B_ EQU $B - -; arguments: pitch, length [1, 16] -note: MACRO - db (\1 << 4) | (\2 - 1) -ENDM - -; arguments: instrument [1, 19], length [1, 16] -drum_note: MACRO - db $B0 | (\2 - 1) - db \1 -ENDM - -; arguments: instrument, length [1, 16] -; like drum_note but one 1 byte instead of 2 -; can only be used with instruments 1-10, excluding 2 -; unused -drum_note_short: MACRO - db (\1 << 4) | (\2 - 1) -ENDM - -; arguments: length [1, 16] -rest: MACRO - db $C0 | (\1 - 1) -ENDM - -; arguments: speed [0, 15], volume [0, 15], fade [-7, 7] -; fade: positive value means decrease in volume, negative value means increase in volume -; small magnitude means quick change, large magnitude means slow change -; in signed magnitude representation, so a value of 8 is the same as (negative) 0 -note_type: MACRO - db $D0 | \1 - IF \3 < 0 - db (\2 << 4) | (%1000 | (\3 * -1)) - ELSE - db (\2 << 4) | \3 - ENDC -ENDM - -; arguments: speed [0, 15] -drum_speed: MACRO - db $D0 | \1 -ENDM - -; arguments: octave [1, 8] -octave: MACRO - db $E8 - \1 -ENDM - -; when enabled, effective frequency used is incremented by 1 -toggle_perfect_pitch: MACRO - db $E8 -ENDM - -; arguments: delay [0, 255], depth [0, 15], rate [0, 15] -; delay: time delay until vibrato effect begins -; depth: amplitude of vibrato wave -; rate: frequency of vibrato wave -vibrato: MACRO - db $EA - db \1 - db (\2 << 4) | \3 -ENDM - -; arguments: length [1, 256], octave [1, 8], pitch -pitch_slide: MACRO - db $EB - db \1 - 1 - db ((8 - \2) << 4) | \3 -ENDM - -; arguments: duty cycle [0, 3] (12.5%, 25%, 50%, 75%) -duty_cycle: MACRO - db $EC - db \1 -ENDM - -; arguments: tempo [0, $ffff] -; used to calculate note delay counters -; so a smaller value means music plays faster -; ideally should be set to $100 or less to guarantee no overflow -; if larger than $100, large note speed or note length values might cause overflow -; stored in big endian -tempo: MACRO - db $ED - db \1 / $100 - db \1 % $100 -ENDM - -; arguments: left output enable mask, right output enable mask -stereo_panning: MACRO - db $EE - db (\1 << 4) | \2 -ENDM - -; arguments: left master volume [0, 7], right master volume [0, 7] -volume: MACRO - db $F0 - db (\1 << 4) | \2 -ENDM - -; when enabled, the sfx data is interpreted as music data -execute_music: MACRO - db $F8 -ENDM - -; arguments: duty cycle 1, duty cycle 2, duty cycle 3, duty cycle 4 -duty_cycle_pattern: MACRO - db $FC - db \1 << 6 | \2 << 4 | \3 << 2 | \4 -ENDM - -; arguments: address -sound_call: MACRO - db $FD - dw \1 -ENDM - -; arguments: count, address -sound_loop: MACRO - db $FE - db \1 - dw \2 -ENDM - -sound_ret: MACRO - db $FF -ENDM diff --git a/macros/code.asm b/macros/code.asm new file mode 100755 index 00000000..8b7d6184 --- /dev/null +++ b/macros/code.asm @@ -0,0 +1,9 @@ +; Syntactic sugar macros + +lb: MACRO ; r, hi, lo + ld \1, ((\2) & $ff) << 8 + ((\3) & $ff) +ENDM + +ldPal: MACRO + ld \1, \2 << 6 | \3 << 4 | \4 << 2 | \5 +ENDM diff --git a/macros/coords.asm b/macros/coords.asm new file mode 100644 index 00000000..302260d7 --- /dev/null +++ b/macros/coords.asm @@ -0,0 +1,65 @@ +validateCoords: MACRO + IF \1 >= SCREEN_WIDTH + fail "x coord out of range" + ENDC + IF \2 >= SCREEN_HEIGHT + fail "y coord out of range" + ENDC +ENDM + +;\1 = r +;\2 = X +;\3 = Y +;\4 = which tilemap (optional) +coord: MACRO + validateCoords \2, \3 + IF _NARG >= 4 + ld \1, \4 + SCREEN_WIDTH * \3 + \2 + ELSE + ld \1, wTileMap + SCREEN_WIDTH * \3 + \2 + ENDC +ENDM + +;\1 = X +;\2 = Y +;\3 = which tilemap (optional) +aCoord: MACRO + validateCoords \1, \2 + IF _NARG >= 3 + ld a, [\3 + SCREEN_WIDTH * \2 + \1] + ELSE + ld a, [wTileMap + SCREEN_WIDTH * \2 + \1] + ENDC +ENDM + +;\1 = X +;\2 = Y +;\3 = which tilemap (optional) +Coorda: MACRO + validateCoords \1, \2 + IF _NARG >= 3 + ld [\3 + SCREEN_WIDTH * \2 + \1], a + ELSE + ld [wTileMap + SCREEN_WIDTH * \2 + \1], a + ENDC +ENDM + +;\1 = X +;\2 = Y +;\3 = which tilemap (optional) +dwCoord: MACRO + validateCoords \1, \2 + IF _NARG >= 3 + dw \3 + SCREEN_WIDTH * \2 + \1 + ELSE + dw wTileMap + SCREEN_WIDTH * \2 + \1 + ENDC +ENDM + +;\1 = r +;\2 = X +;\3 = Y +;\4 = map width +overworldMapCoord: MACRO + ld \1, wOverworldMap + ((\2) + 3) + (((\3) + 3) * ((\4) + (3 * 2))) +ENDM diff --git a/macros/data.asm b/macros/data.asm new file mode 100755 index 00000000..54d1d561 --- /dev/null +++ b/macros/data.asm @@ -0,0 +1,62 @@ +; Value macros + +percent EQUS "* $ff / 100" + +bcd2: MACRO + dn ((\1) / 1000) % 10, ((\1) / 100) % 10 + dn ((\1) / 10) % 10, (\1) % 10 +ENDM + +bcd3: MACRO + dn ((\1) / 100000) % 10, ((\1) / 10000) % 10 + dn ((\1) / 1000) % 10, ((\1) / 100) % 10 + dn ((\1) / 10) % 10, (\1) % 10 +ENDM + +coins equs "bcd2" +money equs "bcd3" + +RGB: MACRO + dw (\3 << 10 | \2 << 5 | \1) +ENDM + +tmlearn: MACRO +x = 0 + REPT _NARG +IF \1 != 0 +x = x | (1 << ((\1 - 1) % 8)) +ENDC + SHIFT + ENDR + db x +ENDM + + +; Constant data (db, dw, dl) macros + +dn: MACRO ; nybbles + db (\1 << 4 | \2) +ENDM + +dbw: MACRO + db \1 + dw \2 +ENDM + +dba: MACRO + dbw BANK(\1), \1 +ENDM + +dwb: MACRO + dw \1 + db \2 +ENDM + +dab: MACRO + dwb \1, BANK(\1) +ENDM + +dbbw: MACRO + db \1, \2 + dw \3 +ENDM diff --git a/macros/data_macros.asm b/macros/data_macros.asm deleted file mode 100755 index 794b75f7..00000000 --- a/macros/data_macros.asm +++ /dev/null @@ -1,253 +0,0 @@ - -; Constant enumeration is useful for monsters, items, moves, etc. -const_def: MACRO -if _NARG >= 1 -const_value = \1 -else -const_value = 0 -endc -ENDM - -const: MACRO -\1 EQU const_value -const_value = const_value + 1 -ENDM - -; data format macros - -percent EQUS "* $ff / 100" - -bcd2: MACRO - dn ((\1) / 1000) % 10, ((\1) / 100) % 10 - dn ((\1) / 10) % 10, (\1) % 10 -ENDM - -bcd3: MACRO - dn ((\1) / 100000) % 10, ((\1) / 10000) % 10 - dn ((\1) / 1000) % 10, ((\1) / 100) % 10 - dn ((\1) / 10) % 10, (\1) % 10 -ENDM - -coins equs "bcd2" -money equs "bcd3" - -;\1 = Map Width -;\2 = Rows above (Y-blocks) -;\3 = X movement (X-blocks) -EVENT_DISP: MACRO - dw (wOverworldMap + 7 + (\1) + ((\1) + 6) * ((\2) >> 1) + ((\3) >> 1)) ; Ev.Disp - db \2,\3 ;Y,X -ENDM - -FLYWARP_DATA: MACRO - EVENT_DISP \1,\2,\3 - db ((\2) & $01) ;sub-block Y - db ((\3) & $01) ;sub-block X -ENDM - -; external map entry macro -EMAP: MACRO ; emap x-coordinate,y-coordinate,textpointer -; the appearance of towns and routes in the town map, indexed by map id - ; nybble: y-coordinate - ; nybble: x-coordinate - ; word : pointer to map name - dn \2, \1 - dw \3 -ENDM - -; internal map entry macro -IMAP: MACRO ; imap mapid_less_than,x-coordinate,y-coordinate,textpointer -; the appearance of buildings and dungeons in the town map - ; byte : maximum map id subject to this rule - ; nybble: y-coordinate - ; nybble: x-coordinate - ; word : pointer to map name - db \1 + 1 - dn \3, \2 - dw \4 -ENDM - -; tilesets' headers macro -tileset: MACRO - db BANK(\2) ; BANK(GFX) - dw \1, \2, \3 ; Block, GFX, Coll - db \4, \5, \6 ; counter tiles - db \7 ; grass tile - db \8 ; permission (indoor, cave, outdoor) -ENDM - -INDOOR EQU 0 -CAVE EQU 1 -OUTDOOR EQU 2 - -RGB: MACRO - dw (\3 << 10 | \2 << 5 | \1) -ENDM - -WALK EQU $FE -STAY EQU $FF - -DOWN EQU $D0 -UP EQU $D1 -LEFT EQU $D2 -RIGHT EQU $D3 -NONE EQU $FF - -;\1 sprite id -;\2 x position -;\3 y position -;\4 movement (WALK/STAY) -;\5 range or direction -;\6 text id -;\7 items only: item id -;\7 trainers only: trainer class/pokemon id -;\8 trainers only: trainer number/pokemon level -object: MACRO - db \1 - db \3 + 4 - db \2 + 4 - db \4 - db \5 - IF (_NARG > 7) - db TRAINER | \6 - db \7 - db \8 - ELSE - IF (_NARG > 6) - db ITEM | \6 - db \7 - ELSE - db \6 - ENDC - ENDC -ENDM - -;\1 x position -;\2 y position -;\3 destination warp id -;\4 destination map (-1 = wLastMap) -warp: MACRO - db \2, \1, \3, \4 -ENDM - -;\1 x position -;\2 y position -;\3 sign id -sign: MACRO - db \2, \1, \3 -ENDM - -;\1 x position -;\2 y position -;\3 map width -warp_to: MACRO - EVENT_DISP \3, \2, \1 -ENDM - -map_header: MACRO -;\1: map name -;\2: map id -;\3: tileset -;\4: connections: combo of NORTH, SOUTH, WEST, and/or EAST, or 0 for none -CURRENT_MAP_WIDTH = \2_WIDTH -CURRENT_MAP_HEIGHT = \2_HEIGHT -CURRENT_MAP_OBJECT EQUS "\1_Object" -\1_h:: - db \3 - db CURRENT_MAP_HEIGHT, CURRENT_MAP_WIDTH - dw \1_Blocks - dw \1_TextPointers - dw \1_Script - db \4 -ENDM - -end_map_header: MACRO - dw CURRENT_MAP_OBJECT -PURGE CURRENT_MAP_WIDTH -PURGE CURRENT_MAP_HEIGHT -PURGE CURRENT_MAP_OBJECT -ENDM - -; Connections go in order: north, south, west, east -connection: MACRO -;\1: direction -;\2: map name -;\3: map id -;\4: offset of the target map relative to the current map -; (x offset for east/west, y offset for north/south) - -; Calculate tile offsets for source (current) and target maps -_src = 0 -_tgt = (\4) + 3 -if _tgt < 2 -_src = -_tgt -_tgt = 0 -endc - -if "\1" == "north" -_blk = \3_WIDTH * (\3_HEIGHT - 3) + _src -_map = _tgt -_win = (\3_WIDTH + 6) * \3_HEIGHT + 1 -_y = \3_HEIGHT * 2 - 1 -_x = (\4) * -2 -_len = CURRENT_MAP_WIDTH + 3 - (\4) -if _len > \3_WIDTH -_len = \3_WIDTH -endc - -elif "\1" == "south" -_blk = _src -_map = (CURRENT_MAP_WIDTH + 6) * (CURRENT_MAP_HEIGHT + 3) + _tgt -_win = \3_WIDTH + 7 -_y = 0 -_x = (\4) * -2 -_len = CURRENT_MAP_WIDTH + 3 - (\4) -if _len > \3_WIDTH -_len = \3_WIDTH -endc - -elif "\1" == "west" -_blk = (\3_WIDTH * _src) + \3_WIDTH - 3 -_map = (CURRENT_MAP_WIDTH + 6) * _tgt -_win = (\3_WIDTH + 6) * 2 - 6 -_y = (\4) * -2 -_x = \3_WIDTH * 2 - 1 -_len = CURRENT_MAP_HEIGHT + 3 - (\4) -if _len > \3_HEIGHT -_len = \3_HEIGHT -endc - -elif "\1" == "east" -_blk = (\3_WIDTH * _src) -_map = (CURRENT_MAP_WIDTH + 6) * _tgt + CURRENT_MAP_WIDTH + 3 -_win = \3_WIDTH + 7 -_y = (\4) * -2 -_x = 0 -_len = CURRENT_MAP_HEIGHT + 3 - (\4) -if _len > \3_HEIGHT -_len = \3_HEIGHT -endc - -else -fail "Invalid direction for 'connection'." -endc - - db \3 - dw \2_Blocks + _blk - dw wOverworldMap + _map - db _len - _src - db \3_WIDTH - db _y, _x - dw wOverworldMap + _win -ENDM - -tmlearn: MACRO -x = 0 - REPT _NARG -IF \1 != 0 -x = x | (1 << ((\1 - 1) % 8)) -ENDC - SHIFT - ENDR - db x -ENDM diff --git a/macros/enum.asm b/macros/enum.asm new file mode 100644 index 00000000..8fe5b534 --- /dev/null +++ b/macros/enum.asm @@ -0,0 +1,43 @@ +; Enumerate variables + +enum_start: MACRO +if _NARG >= 1 +__enum__ = \1 +else +__enum__ = 0 +endc +if _NARG >= 2 +__enumdir__ = \2 +else +__enumdir__ = 1 +endc +ENDM + +enum: MACRO +\1 EQU __enum__ +__enum__ = __enum__ + __enumdir__ +ENDM + +enum_set: MACRO +__enum__ = \1 +ENDM + +; Enumerate constants + +const_def: MACRO +if _NARG >= 1 +const_value = \1 +else +const_value = 0 +endc +ENDM + +const: MACRO +\1 EQU const_value +const_value = const_value + 1 +ENDM + +shift_const: MACRO +\1 EQU (1 << const_value) +const_value = const_value + 1 +ENDM diff --git a/macros/event_macros.asm b/macros/event_macros.asm deleted file mode 100755 index 20027209..00000000 --- a/macros/event_macros.asm +++ /dev/null @@ -1,441 +0,0 @@ -;\1 = event index -;\2 = return result in carry instead of zero flag -CheckEvent: MACRO -event_byte = ((\1) / 8) - ld a, [wEventFlags + event_byte] - - IF _NARG > 1 - IF ((\1) % 8) == 7 - add a - ELSE - REPT ((\1) % 8) + 1 - rrca - ENDR - ENDC - ELSE - bit (\1) % 8, a - ENDC - ENDM - -;\1 = event index -CheckEventReuseA: MACRO - IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld a, [wEventFlags + event_byte] - ENDC - - bit (\1) % 8, a - ENDM - -;\1 = event index -;\2 = event index of the last event used before the branch -CheckEventAfterBranchReuseA: MACRO -event_byte = ((\2) / 8) - IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld a, [wEventFlags + event_byte] - ENDC - - bit (\1) % 8, a - ENDM - -;\1 = reg -;\2 = event index -;\3 = event index this event is relative to (optional, this is needed when there is a fixed flag address) -EventFlagBit: MACRO - IF _NARG > 2 - ld \1, ((\3) % 8) + ((\2) - (\3)) - ELSE - ld \1, (\2) % 8 - ENDC - ENDM - -;\1 = reg -;\2 = event index -EventFlagAddress: MACRO -event_byte = ((\2) / 8) - ld \1, wEventFlags + event_byte - ENDM - -;\1 = event index -CheckEventHL: MACRO -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - bit (\1) % 8, [hl] - ENDM - -;\1 = event index -CheckEventReuseHL: MACRO -IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - ENDC - - bit (\1) % 8, [hl] - ENDM - -; dangerous, only use when HL is guaranteed to be the desired value -;\1 = event index -CheckEventForceReuseHL: MACRO -event_byte = ((\1) / 8) - bit (\1) % 8, [hl] - ENDM - -;\1 = event index -;\2 = event index of the last event used before the branch -CheckEventAfterBranchReuseHL: MACRO -event_byte = ((\2) / 8) -IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - ENDC - - bit (\1) % 8, [hl] - ENDM - -;\1 = event index -CheckAndSetEvent: MACRO -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - bit (\1) % 8, [hl] - set (\1) % 8, [hl] - ENDM - -;\1 = event index -CheckAndResetEvent: MACRO -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - bit (\1) % 8, [hl] - res (\1) % 8, [hl] - ENDM - -;\1 = event index -CheckAndSetEventA: MACRO - ld a, [wEventFlags + ((\1) / 8)] - bit (\1) % 8, a - set (\1) % 8, a - ld [wEventFlags + ((\1) / 8)], a - ENDM - -;\1 = event index -CheckAndResetEventA: MACRO - ld a, [wEventFlags + ((\1) / 8)] - bit (\1) % 8, a - res (\1) % 8, a - ld [wEventFlags + ((\1) / 8)], a - ENDM - -;\1 = event index -SetEvent: MACRO -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - set (\1) % 8, [hl] - ENDM - -;\1 = event index -SetEventReuseHL: MACRO - IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - ENDC - - set (\1) % 8, [hl] - ENDM - -;\1 = event index -;\2 = event index of the last event used before the branch -SetEventAfterBranchReuseHL: MACRO -event_byte = ((\2) / 8) -IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - ENDC - - set (\1) % 8, [hl] - ENDM - -; dangerous, only use when HL is guaranteed to be the desired value -;\1 = event index -SetEventForceReuseHL: MACRO -event_byte = ((\1) / 8) - set (\1) % 8, [hl] - ENDM - -;\1 = event index -;\2 = event index -;\3, \4, ... = additional (optional) event indices -SetEvents: MACRO - SetEvent \1 - rept (_NARG + -1) - SetEventReuseHL \2 - shift - endr - ENDM - -;\1 = event index -ResetEvent: MACRO -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - res (\1) % 8, [hl] - ENDM - -;\1 = event index -ResetEventReuseHL: MACRO - IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - ENDC - - res (\1) % 8, [hl] - ENDM - -;\1 = event index -;\2 = event index of the last event used before the branch -ResetEventAfterBranchReuseHL: MACRO -event_byte = ((\2) / 8) -IF event_byte != ((\1) / 8) -event_byte = ((\1) / 8) - ld hl, wEventFlags + event_byte - ENDC - - res (\1) % 8, [hl] - ENDM - -; dangerous, only use when HL is guaranteed to be the desired value -;\1 = event index -ResetEventForceReuseHL: MACRO -event_byte = ((\1) / 8) - res (\1) % 8, [hl] - ENDM - -;\1 = event index -;\2 = event index -;\3 = event index (optional) -ResetEvents: MACRO - ResetEvent \1 - rept (_NARG + -1) - ResetEventReuseHL \2 - shift - endr - ENDM - -;\1 = event index -;\2 = number of bytes away from the base address (optional, for matching the ROM) -dbEventFlagBit: MACRO - IF _NARG > 1 - db ((\1) % 8) + ((\2) * 8) - ELSE - db ((\1) % 8) - ENDC - ENDM - -;\1 = event index -;\2 = number of bytes away from the base address (optional, for matching the ROM) -dwEventFlagAddress: MACRO - IF _NARG > 1 - dw wEventFlags + ((\1) / 8) - (\2) - ELSE - dw wEventFlags + ((\1) / 8) - ENDC - ENDM - -;\1 = start -;\2 = end -SetEventRange: MACRO -event_start_byte = ((\1) / 8) -event_end_byte = ((\2) / 8) - - IF event_end_byte < event_start_byte - FAIL "Incorrect argument order in SetEventRange." - ENDC - - IF event_start_byte == event_end_byte - ld a, [wEventFlags + event_start_byte] - or (1 << (((\2) % 8) + 1)) - (1 << ((\1) % 8)) - ld [wEventFlags + event_start_byte], a - ELSE -event_fill_start = event_start_byte + 1 -event_fill_count = event_end_byte - event_start_byte - 1 - - IF ((\1) % 8) == 0 -event_fill_start = event_fill_start + -1 -event_fill_count = event_fill_count + 1 - ELSE - ld a, [wEventFlags + event_start_byte] - or $ff - ((1 << ((\1) % 8)) - 1) - ld [wEventFlags + event_start_byte], a - ENDC - - IF ((\2) % 8) == 7 -event_fill_count = event_fill_count + 1 - ENDC - - IF event_fill_count == 1 - ld hl, wEventFlags + event_fill_start - ld [hl], $ff - ENDC - - IF event_fill_count > 1 - ld a, $ff - ld hl, wEventFlags + event_fill_start - - REPT event_fill_count + -1 - ld [hli], a - ENDR - - ld [hl], a - ENDC - - IF ((\2) % 8) == 0 - ld hl, wEventFlags + event_end_byte - set 0, [hl] - ELSE - IF ((\2) % 8) != 7 - ld a, [wEventFlags + event_end_byte] - or (1 << (((\2) % 8) + 1)) - 1 - ld [wEventFlags + event_end_byte], a - ENDC - ENDC - ENDC - ENDM - -;\1 = start -;\2 = end -;\3 = assume a is 0 if present -ResetEventRange: MACRO -event_start_byte = ((\1) / 8) -event_end_byte = ((\2) / 8) - - IF event_end_byte < event_start_byte - FAIL "Incorrect argument order in ResetEventRange." - ENDC - - IF event_start_byte == event_end_byte - ld a, [wEventFlags + event_start_byte] - and ~((1 << (((\2) % 8) + 1)) - (1 << ((\1) % 8))) & $ff - ld [wEventFlags + event_start_byte], a - ELSE -event_fill_start = event_start_byte + 1 -event_fill_count = event_end_byte - event_start_byte - 1 - - IF ((\1) % 8) == 0 -event_fill_start = event_fill_start + -1 -event_fill_count = event_fill_count + 1 - ELSE - ld a, [wEventFlags + event_start_byte] - and ~($ff - ((1 << ((\1) % 8)) - 1)) & $ff - ld [wEventFlags + event_start_byte], a - ENDC - - IF ((\2) % 8) == 7 -event_fill_count = event_fill_count + 1 - ENDC - - IF event_fill_count == 1 - ld hl, wEventFlags + event_fill_start - ld [hl], 0 - ENDC - - IF event_fill_count > 1 - ld hl, wEventFlags + event_fill_start - - ; force xor a if we just to wrote to it above - IF (_NARG < 3) || (((\1) % 8) != 0) - xor a - ENDC - - REPT event_fill_count + -1 - ld [hli], a - ENDR - - ld [hl], a - ENDC - - IF ((\2) % 8) == 0 - ld hl, wEventFlags + event_end_byte - res 0, [hl] - ELSE - IF ((\2) % 8) != 7 - ld a, [wEventFlags + event_end_byte] - and ~((1 << (((\2) % 8) + 1)) - 1) & $ff - ld [wEventFlags + event_end_byte], a - ENDC - ENDC - ENDC - ENDM - -; returns whether both events are set in Z flag -; This is counter-intuitive because the other event checks set the Z flag when -; the event is not set, but this sets the Z flag when the event is set. -;\1 = event index 1 -;\2 = event index 2 -;\3 = try to reuse a (optional) -CheckBothEventsSet: MACRO - IF ((\1) / 8) == ((\2) / 8) - IF (_NARG < 3) || (((\1) / 8) != event_byte) -event_byte = ((\1) / 8) - ld a, [wEventFlags + ((\1) / 8)] - ENDC - and (1 << ((\1) % 8)) | (1 << ((\2) % 8)) - cp (1 << ((\1) % 8)) | (1 << ((\2) % 8)) - ELSE - ; This case doesn't happen in the original ROM. - IF ((\1) % 8) == ((\2) % 8) - push hl - ld a, [wEventFlags + ((\1) / 8)] - ld hl, wEventFlags + ((\2) / 8) - and [hl] - cpl - bit ((\1) % 8), a - pop hl - ELSE - push bc - ld a, [wEventFlags + ((\1) / 8)] - and (1 << ((\1) % 8)) - ld b, a - ld a, [wEventFlags + ((\2) / 8)] - and (1 << ((\2) % 8)) - or b - cp (1 << ((\1) % 8)) | (1 << ((\2) % 8)) - pop bc - ENDC - ENDC - ENDM - -; returns the complement of whether either event is set in Z flag -;\1 = event index 1 -;\2 = event index 2 -CheckEitherEventSet: MACRO - IF ((\1) / 8) == ((\2) / 8) - ld a, [wEventFlags + ((\1) / 8)] - and (1 << ((\1) % 8)) | (1 << ((\2) % 8)) - ELSE - ; This case doesn't happen in the original ROM. - IF ((\1) % 8) == ((\2) % 8) - push hl - ld a, [wEventFlags + ((\1) / 8)] - ld hl, wEventFlags + ((\2) / 8) - or [hl] - bit ((\1) % 8), a - pop hl - ELSE - push bc - ld a, [wEventFlags + ((\1) / 8)] - and (1 << ((\1) % 8)) - ld b, a - ld a, [wEventFlags + ((\2) / 8)] - and (1 << ((\2) % 8)) - or b - pop bc - ENDC - ENDC - ENDM - -; for handling fixed event bits when events are inserted/removed -;\1 = event index -;\2 = fixed flag bit -AdjustEventBit: MACRO - IF ((\1) % 8) != (\2) - add ((\1) % 8) - (\2) - ENDC - ENDM diff --git a/macros/farcall.asm b/macros/farcall.asm new file mode 100644 index 00000000..fc208e3d --- /dev/null +++ b/macros/farcall.asm @@ -0,0 +1,37 @@ +farcall EQUS "callba" + +callba: MACRO + ld b, BANK(\1) + ld hl, \1 + call Bankswitch +ENDM + +callab: MACRO + ld hl, \1 + ld b, BANK(\1) + call Bankswitch +ENDM + +jpba: MACRO + ld b, BANK(\1) + ld hl, \1 + jp Bankswitch +ENDM + +jpab: MACRO + ld hl, \1 + ld b, BANK(\1) + jp Bankswitch +ENDM + +homecall: MACRO + ld a, [H_LOADEDROMBANK] + push af + ld a, BANK(\1) + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a + call \1 + pop af + ld [H_LOADEDROMBANK], a + ld [MBC1RomBank], a +ENDM diff --git a/macros/predef.asm b/macros/predef.asm new file mode 100644 index 00000000..fda42004 --- /dev/null +++ b/macros/predef.asm @@ -0,0 +1,49 @@ +predef_const: MACRO + const \1PredefID +ENDM + +add_predef: MACRO +\1Predef:: + db BANK(\1) + dw \1 +ENDM + +predef_id: MACRO + ld a, (\1Predef - PredefPointers) / 3 +ENDM + +predef: MACRO + predef_id \1 + call Predef +ENDM + +predef_jump: MACRO + predef_id \1 + jp Predef +ENDM + +tx_pre_const: MACRO + const \1_id +ENDM + +add_tx_pre: MACRO +\1_id:: dw \1 +ENDM + +db_tx_pre: MACRO + db (\1_id - TextPredefs) / 2 + 1 +ENDM + +tx_pre_id: MACRO + ld a, (\1_id - TextPredefs) / 2 + 1 +ENDM + +tx_pre: MACRO + tx_pre_id \1 + call PrintPredefTextID +ENDM + +tx_pre_jump: MACRO + tx_pre_id \1 + jp PrintPredefTextID +ENDM diff --git a/macros/scripts/audio.asm b/macros/scripts/audio.asm new file mode 100755 index 00000000..8a250c63 --- /dev/null +++ b/macros/scripts/audio.asm @@ -0,0 +1,186 @@ +audio_header: MACRO + db (_NARG - 2) << 6 | \2 + dw \1_\2 + IF _NARG > 2 + db \3 + dw \1_\3 + ENDC + IF _NARG > 3 + db \4 + dw \1_\4 + ENDC + IF _NARG > 4 + db \5 + dw \1_\5 + ENDC +ENDM + +; arguments: length [0, 7], pitch change [-7, 7] +; length: length of time between pitch shifts +; sometimes used with a value >7 in which case the MSB is ignored +; pitch change: positive value means increase in pitch, negative value means decrease in pitch +; small magnitude means quick change, large magnitude means slow change +; in signed magnitude representation, so a value of 8 is the same as (negative) 0 +pitch_sweep: MACRO + db $10 + IF \2 < 0 + db (\1 << 4) | (%1000 | (\2 * -1)) + ELSE + db (\1 << 4) | \2 + ENDC +ENDM + +; arguments: length [0, 15], volume [0, 15], fade [-7, 7], frequency +; fade: positive value means decrease in volume, negative value means increase in volume +; small magnitude means quick change, large magnitude means slow change +; in signed magnitude representation, so a value of 8 is the same as (negative) 0 +square_note: MACRO + db $20 | \1 + IF \3 < 0 + db (\2 << 4) | (%1000 | (\3 * -1)) + ELSE + db (\2 << 4) | \3 + ENDC + dw \4 +ENDM + +; arguments: length [0, 15], volume [0, 15], fade [-7, 7], frequency +; fade: positive value means decrease in volume, negative value means increase in volume +; small magnitude means quick change, large magnitude means slow change +; in signed magnitude representation, so a value of 8 is the same as (negative) 0 +noise_note: MACRO + db $20 | \1 + IF \3 < 0 + db (\2 << 4) | (%1000 | (\3 * -1)) + ELSE + db (\2 << 4) | \3 + ENDC + db \4 +ENDM + +; arguments: pitch, length [1, 16] +note: MACRO + db (\1 << 4) | (\2 - 1) +ENDM + +; arguments: instrument [1, 19], length [1, 16] +drum_note: MACRO + db $B0 | (\2 - 1) + db \1 +ENDM + +; arguments: instrument, length [1, 16] +; like drum_note but one 1 byte instead of 2 +; can only be used with instruments 1-10, excluding 2 +; unused +drum_note_short: MACRO + db (\1 << 4) | (\2 - 1) +ENDM + +; arguments: length [1, 16] +rest: MACRO + db $C0 | (\1 - 1) +ENDM + +; arguments: speed [0, 15], volume [0, 15], fade [-7, 7] +; fade: positive value means decrease in volume, negative value means increase in volume +; small magnitude means quick change, large magnitude means slow change +; in signed magnitude representation, so a value of 8 is the same as (negative) 0 +note_type: MACRO + db $D0 | \1 + IF \3 < 0 + db (\2 << 4) | (%1000 | (\3 * -1)) + ELSE + db (\2 << 4) | \3 + ENDC +ENDM + +; arguments: speed [0, 15] +drum_speed: MACRO + db $D0 | \1 +ENDM + +; arguments: octave [1, 8] +octave: MACRO + db $E8 - \1 +ENDM + +; when enabled, effective frequency used is incremented by 1 +toggle_perfect_pitch: MACRO + db $E8 +ENDM + +; arguments: delay [0, 255], depth [0, 15], rate [0, 15] +; delay: time delay until vibrato effect begins +; depth: amplitude of vibrato wave +; rate: frequency of vibrato wave +vibrato: MACRO + db $EA + db \1 + db (\2 << 4) | \3 +ENDM + +; arguments: length [1, 256], octave [1, 8], pitch +pitch_slide: MACRO + db $EB + db \1 - 1 + db ((8 - \2) << 4) | \3 +ENDM + +; arguments: duty cycle [0, 3] (12.5%, 25%, 50%, 75%) +duty_cycle: MACRO + db $EC + db \1 +ENDM + +; arguments: tempo [0, $ffff] +; used to calculate note delay counters +; so a smaller value means music plays faster +; ideally should be set to $100 or less to guarantee no overflow +; if larger than $100, large note speed or note length values might cause overflow +; stored in big endian +tempo: MACRO + db $ED + db \1 / $100 + db \1 % $100 +ENDM + +; arguments: left output enable mask, right output enable mask +stereo_panning: MACRO + db $EE + db (\1 << 4) | \2 +ENDM + +; arguments: left master volume [0, 7], right master volume [0, 7] +volume: MACRO + db $F0 + db (\1 << 4) | \2 +ENDM + +; when enabled, the sfx data is interpreted as music data +execute_music: MACRO + db $F8 +ENDM + +; arguments: duty cycle 1, duty cycle 2, duty cycle 3, duty cycle 4 +duty_cycle_pattern: MACRO + db $FC + db \1 << 6 | \2 << 4 | \3 << 2 | \4 +ENDM + +; arguments: address +sound_call: MACRO + db $FD + dw \1 +ENDM + +; arguments: count, address +sound_loop: MACRO + db $FE + db \1 + dw \2 +ENDM + +sound_ret: MACRO + db $FF +ENDM diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm new file mode 100755 index 00000000..9be354e3 --- /dev/null +++ b/macros/scripts/events.asm @@ -0,0 +1,471 @@ +;\1 = event index +;\2 = return result in carry instead of zero flag +CheckEvent: MACRO +event_byte = ((\1) / 8) + ld a, [wEventFlags + event_byte] + + IF _NARG > 1 + IF ((\1) % 8) == 7 + add a + ELSE + REPT ((\1) % 8) + 1 + rrca + ENDR + ENDC + ELSE + bit (\1) % 8, a + ENDC +ENDM + + +;\1 = event index +CheckEventReuseA: MACRO + IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld a, [wEventFlags + event_byte] + ENDC + + bit (\1) % 8, a +ENDM + + +;\1 = event index +;\2 = event index of the last event used before the branch +CheckEventAfterBranchReuseA: MACRO +event_byte = ((\2) / 8) + IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld a, [wEventFlags + event_byte] + ENDC + + bit (\1) % 8, a +ENDM + + +;\1 = reg +;\2 = event index +;\3 = event index this event is relative to (optional, this is needed when there is a fixed flag address) +EventFlagBit: MACRO + IF _NARG > 2 + ld \1, ((\3) % 8) + ((\2) - (\3)) + ELSE + ld \1, (\2) % 8 + ENDC +ENDM + + +;\1 = reg +;\2 = event index +EventFlagAddress: MACRO +event_byte = ((\2) / 8) + ld \1, wEventFlags + event_byte +ENDM + + +;\1 = event index +CheckEventHL: MACRO +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + bit (\1) % 8, [hl] +ENDM + + +;\1 = event index +CheckEventReuseHL: MACRO +IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + bit (\1) % 8, [hl] +ENDM + + +; dangerous, only use when HL is guaranteed to be the desired value +;\1 = event index +CheckEventForceReuseHL: MACRO +event_byte = ((\1) / 8) + bit (\1) % 8, [hl] +ENDM + + +;\1 = event index +;\2 = event index of the last event used before the branch +CheckEventAfterBranchReuseHL: MACRO +event_byte = ((\2) / 8) +IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + bit (\1) % 8, [hl] +ENDM + + +;\1 = event index +CheckAndSetEvent: MACRO +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + bit (\1) % 8, [hl] + set (\1) % 8, [hl] +ENDM + + +;\1 = event index +CheckAndResetEvent: MACRO +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + bit (\1) % 8, [hl] + res (\1) % 8, [hl] +ENDM + + +;\1 = event index +CheckAndSetEventA: MACRO + ld a, [wEventFlags + ((\1) / 8)] + bit (\1) % 8, a + set (\1) % 8, a + ld [wEventFlags + ((\1) / 8)], a +ENDM + + +;\1 = event index +CheckAndResetEventA: MACRO + ld a, [wEventFlags + ((\1) / 8)] + bit (\1) % 8, a + res (\1) % 8, a + ld [wEventFlags + ((\1) / 8)], a +ENDM + + +;\1 = event index +SetEvent: MACRO +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + set (\1) % 8, [hl] +ENDM + + +;\1 = event index +SetEventReuseHL: MACRO + IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + set (\1) % 8, [hl] +ENDM + + +;\1 = event index +;\2 = event index of the last event used before the branch +SetEventAfterBranchReuseHL: MACRO +event_byte = ((\2) / 8) +IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + set (\1) % 8, [hl] +ENDM + + +; dangerous, only use when HL is guaranteed to be the desired value +;\1 = event index +SetEventForceReuseHL: MACRO +event_byte = ((\1) / 8) + set (\1) % 8, [hl] +ENDM + + +;\1 = event index +;\2 = event index +;\3, \4, ... = additional (optional) event indices +SetEvents: MACRO + SetEvent \1 + rept (_NARG + -1) + SetEventReuseHL \2 + shift + endr +ENDM + + +;\1 = event index +ResetEvent: MACRO +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + res (\1) % 8, [hl] +ENDM + + +;\1 = event index +ResetEventReuseHL: MACRO + IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + res (\1) % 8, [hl] +ENDM + + +;\1 = event index +;\2 = event index of the last event used before the branch +ResetEventAfterBranchReuseHL: MACRO +event_byte = ((\2) / 8) +IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + res (\1) % 8, [hl] +ENDM + + +; dangerous, only use when HL is guaranteed to be the desired value +;\1 = event index +ResetEventForceReuseHL: MACRO +event_byte = ((\1) / 8) + res (\1) % 8, [hl] +ENDM + + +;\1 = event index +;\2 = event index +;\3 = event index (optional) +ResetEvents: MACRO + ResetEvent \1 + rept (_NARG + -1) + ResetEventReuseHL \2 + shift + endr +ENDM + + +;\1 = event index +;\2 = number of bytes away from the base address (optional, for matching the ROM) +dbEventFlagBit: MACRO + IF _NARG > 1 + db ((\1) % 8) + ((\2) * 8) + ELSE + db ((\1) % 8) + ENDC +ENDM + + +;\1 = event index +;\2 = number of bytes away from the base address (optional, for matching the ROM) +dwEventFlagAddress: MACRO + IF _NARG > 1 + dw wEventFlags + ((\1) / 8) - (\2) + ELSE + dw wEventFlags + ((\1) / 8) + ENDC +ENDM + + +;\1 = start +;\2 = end +SetEventRange: MACRO +event_start_byte = ((\1) / 8) +event_end_byte = ((\2) / 8) + + IF event_end_byte < event_start_byte + FAIL "Incorrect argument order in SetEventRange." + ENDC + + IF event_start_byte == event_end_byte + ld a, [wEventFlags + event_start_byte] + or (1 << (((\2) % 8) + 1)) - (1 << ((\1) % 8)) + ld [wEventFlags + event_start_byte], a + ELSE +event_fill_start = event_start_byte + 1 +event_fill_count = event_end_byte - event_start_byte - 1 + + IF ((\1) % 8) == 0 +event_fill_start = event_fill_start + -1 +event_fill_count = event_fill_count + 1 + ELSE + ld a, [wEventFlags + event_start_byte] + or $ff - ((1 << ((\1) % 8)) - 1) + ld [wEventFlags + event_start_byte], a + ENDC + + IF ((\2) % 8) == 7 +event_fill_count = event_fill_count + 1 + ENDC + + IF event_fill_count == 1 + ld hl, wEventFlags + event_fill_start + ld [hl], $ff + ENDC + + IF event_fill_count > 1 + ld a, $ff + ld hl, wEventFlags + event_fill_start + + REPT event_fill_count + -1 + ld [hli], a + ENDR + + ld [hl], a + ENDC + + IF ((\2) % 8) == 0 + ld hl, wEventFlags + event_end_byte + set 0, [hl] + ELSE + IF ((\2) % 8) != 7 + ld a, [wEventFlags + event_end_byte] + or (1 << (((\2) % 8) + 1)) - 1 + ld [wEventFlags + event_end_byte], a + ENDC + ENDC + ENDC +ENDM + + +;\1 = start +;\2 = end +;\3 = assume a is 0 if present +ResetEventRange: MACRO +event_start_byte = ((\1) / 8) +event_end_byte = ((\2) / 8) + + IF event_end_byte < event_start_byte + FAIL "Incorrect argument order in ResetEventRange." + ENDC + + IF event_start_byte == event_end_byte + ld a, [wEventFlags + event_start_byte] + and ~((1 << (((\2) % 8) + 1)) - (1 << ((\1) % 8))) & $ff + ld [wEventFlags + event_start_byte], a + ELSE +event_fill_start = event_start_byte + 1 +event_fill_count = event_end_byte - event_start_byte - 1 + + IF ((\1) % 8) == 0 +event_fill_start = event_fill_start + -1 +event_fill_count = event_fill_count + 1 + ELSE + ld a, [wEventFlags + event_start_byte] + and ~($ff - ((1 << ((\1) % 8)) - 1)) & $ff + ld [wEventFlags + event_start_byte], a + ENDC + + IF ((\2) % 8) == 7 +event_fill_count = event_fill_count + 1 + ENDC + + IF event_fill_count == 1 + ld hl, wEventFlags + event_fill_start + ld [hl], 0 + ENDC + + IF event_fill_count > 1 + ld hl, wEventFlags + event_fill_start + + ; force xor a if we just to wrote to it above + IF (_NARG < 3) || (((\1) % 8) != 0) + xor a + ENDC + + REPT event_fill_count + -1 + ld [hli], a + ENDR + + ld [hl], a + ENDC + + IF ((\2) % 8) == 0 + ld hl, wEventFlags + event_end_byte + res 0, [hl] + ELSE + IF ((\2) % 8) != 7 + ld a, [wEventFlags + event_end_byte] + and ~((1 << (((\2) % 8) + 1)) - 1) & $ff + ld [wEventFlags + event_end_byte], a + ENDC + ENDC + ENDC +ENDM + + +; returns whether both events are set in Z flag +; This is counter-intuitive because the other event checks set the Z flag when +; the event is not set, but this sets the Z flag when the event is set. +;\1 = event index 1 +;\2 = event index 2 +;\3 = try to reuse a (optional) +CheckBothEventsSet: MACRO + IF ((\1) / 8) == ((\2) / 8) + IF (_NARG < 3) || (((\1) / 8) != event_byte) +event_byte = ((\1) / 8) + ld a, [wEventFlags + ((\1) / 8)] + ENDC + and (1 << ((\1) % 8)) | (1 << ((\2) % 8)) + cp (1 << ((\1) % 8)) | (1 << ((\2) % 8)) + ELSE + ; This case doesn't happen in the original ROM. + IF ((\1) % 8) == ((\2) % 8) + push hl + ld a, [wEventFlags + ((\1) / 8)] + ld hl, wEventFlags + ((\2) / 8) + and [hl] + cpl + bit ((\1) % 8), a + pop hl + ELSE + push bc + ld a, [wEventFlags + ((\1) / 8)] + and (1 << ((\1) % 8)) + ld b, a + ld a, [wEventFlags + ((\2) / 8)] + and (1 << ((\2) % 8)) + or b + cp (1 << ((\1) % 8)) | (1 << ((\2) % 8)) + pop bc + ENDC + ENDC +ENDM + + +; returns the complement of whether either event is set in Z flag +;\1 = event index 1 +;\2 = event index 2 +CheckEitherEventSet: MACRO + IF ((\1) / 8) == ((\2) / 8) + ld a, [wEventFlags + ((\1) / 8)] + and (1 << ((\1) % 8)) | (1 << ((\2) % 8)) + ELSE + ; This case doesn't happen in the original ROM. + IF ((\1) % 8) == ((\2) % 8) + push hl + ld a, [wEventFlags + ((\1) / 8)] + ld hl, wEventFlags + ((\2) / 8) + or [hl] + bit ((\1) % 8), a + pop hl + ELSE + push bc + ld a, [wEventFlags + ((\1) / 8)] + and (1 << ((\1) % 8)) + ld b, a + ld a, [wEventFlags + ((\2) / 8)] + and (1 << ((\2) % 8)) + or b + pop bc + ENDC + ENDC +ENDM + + +; for handling fixed event bits when events are inserted/removed +;\1 = event index +;\2 = fixed flag bit +AdjustEventBit: MACRO + IF ((\1) % 8) != (\2) + add ((\1) % 8) - (\2) + ENDC +ENDM + diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm new file mode 100644 index 00000000..a30561b9 --- /dev/null +++ b/macros/scripts/maps.asm @@ -0,0 +1,184 @@ +;\1 map width +;\2 Rows above (Y-blocks) +;\3 X movement (X-blocks) +EVENT_DISP: MACRO + dw (wOverworldMap + 7 + (\1) + ((\1) + 6) * ((\2) >> 1) + ((\3) >> 1)) ; Ev.Disp + db \2,\3 ;Y,X +ENDM + +FLYWARP_DATA: MACRO + EVENT_DISP \1,\2,\3 + db ((\2) & $01) ;sub-block Y + db ((\3) & $01) ;sub-block X +ENDM + +; external map entry macro +EMAP: MACRO ; emap x-coordinate,y-coordinate,textpointer +; the appearance of towns and routes in the town map, indexed by map id + ; nybble: y-coordinate + ; nybble: x-coordinate + ; word : pointer to map name + dn \2, \1 + dw \3 +ENDM + +; internal map entry macro +IMAP: MACRO ; imap mapid_less_than,x-coordinate,y-coordinate,textpointer +; the appearance of buildings and dungeons in the town map + ; byte : maximum map id subject to this rule + ; nybble: y-coordinate + ; nybble: x-coordinate + ; word : pointer to map name + db \1 + 1 + dn \3, \2 + dw \4 +ENDM + +;\1 sprite id +;\2 x position +;\3 y position +;\4 movement (WALK/STAY) +;\5 range or direction +;\6 text id +;\7 items only: item id +;\7 trainers only: trainer class/pokemon id +;\8 trainers only: trainer number/pokemon level +object: MACRO + db \1 + db \3 + 4 + db \2 + 4 + db \4 + db \5 + IF (_NARG > 7) + db TRAINER | \6 + db \7 + db \8 + ELSE + IF (_NARG > 6) + db ITEM | \6 + db \7 + ELSE + db \6 + ENDC + ENDC +ENDM + +;\1 x position +;\2 y position +;\3 destination warp id +;\4 destination map (-1 = wLastMap) +warp: MACRO + db \2, \1, \3, \4 +ENDM + +;\1 x position +;\2 y position +;\3 sign id +sign: MACRO + db \2, \1, \3 +ENDM + +;\1 x position +;\2 y position +;\3 map width +warp_to: MACRO + EVENT_DISP \3, \2, \1 +ENDM + +;\1 map name +;\2 map id +;\3 tileset +;\4 connections: combo of NORTH, SOUTH, WEST, and/or EAST, or 0 for none +map_header: MACRO +CURRENT_MAP_WIDTH = \2_WIDTH +CURRENT_MAP_HEIGHT = \2_HEIGHT +CURRENT_MAP_OBJECT EQUS "\1_Object" +\1_h:: + db \3 + db CURRENT_MAP_HEIGHT, CURRENT_MAP_WIDTH + dw \1_Blocks + dw \1_TextPointers + dw \1_Script + db \4 +ENDM + +; Comes after map_header and connection macros +end_map_header: MACRO + dw CURRENT_MAP_OBJECT +PURGE CURRENT_MAP_WIDTH +PURGE CURRENT_MAP_HEIGHT +PURGE CURRENT_MAP_OBJECT +ENDM + +; Connections go in order: north, south, west, east +;\1 direction +;\2 map name +;\3 map id +;\4 offset of the target map relative to the current map +; (x offset for east/west, y offset for north/south) +connection: MACRO + +; Calculate tile offsets for source (current) and target maps +_src = 0 +_tgt = (\4) + 3 +if _tgt < 2 +_src = -_tgt +_tgt = 0 +endc + +if "\1" == "north" +_blk = \3_WIDTH * (\3_HEIGHT - 3) + _src +_map = _tgt +_win = (\3_WIDTH + 6) * \3_HEIGHT + 1 +_y = \3_HEIGHT * 2 - 1 +_x = (\4) * -2 +_len = CURRENT_MAP_WIDTH + 3 - (\4) +if _len > \3_WIDTH +_len = \3_WIDTH +endc + +elif "\1" == "south" +_blk = _src +_map = (CURRENT_MAP_WIDTH + 6) * (CURRENT_MAP_HEIGHT + 3) + _tgt +_win = \3_WIDTH + 7 +_y = 0 +_x = (\4) * -2 +_len = CURRENT_MAP_WIDTH + 3 - (\4) +if _len > \3_WIDTH +_len = \3_WIDTH +endc + +elif "\1" == "west" +_blk = (\3_WIDTH * _src) + \3_WIDTH - 3 +_map = (CURRENT_MAP_WIDTH + 6) * _tgt +_win = (\3_WIDTH + 6) * 2 - 6 +_y = (\4) * -2 +_x = \3_WIDTH * 2 - 1 +_len = CURRENT_MAP_HEIGHT + 3 - (\4) +if _len > \3_HEIGHT +_len = \3_HEIGHT +endc + +elif "\1" == "east" +_blk = (\3_WIDTH * _src) +_map = (CURRENT_MAP_WIDTH + 6) * _tgt + CURRENT_MAP_WIDTH + 3 +_win = \3_WIDTH + 7 +_y = (\4) * -2 +_x = 0 +_len = CURRENT_MAP_HEIGHT + 3 - (\4) +if _len > \3_HEIGHT +_len = \3_HEIGHT +endc + +else +fail "Invalid direction for 'connection'." +endc + + db \3 + dw \2_Blocks + _blk + dw wOverworldMap + _map + db _len - _src + db \3_WIDTH + db _y, _x + dw wOverworldMap + _win +ENDM diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm new file mode 100755 index 00000000..732a22d4 --- /dev/null +++ b/macros/scripts/text.asm @@ -0,0 +1,78 @@ +text EQUS "db $00," ; Start writing text. +next EQUS "db $4e," ; Move a line down. +line EQUS "db $4f," ; Start writing at the bottom line. +para EQUS "db $51," ; Start a new paragraph. +cont EQUS "db $55," ; Scroll to the next line. +done EQUS "db $57" ; End a text box. +prompt EQUS "db $58" ; Prompt the player to end a text box (initiating some other event). + +page EQUS "db $49," ; Start a new Pokedex page. +dex EQUS "db $5f, $50" ; End a Pokedex entry. + +TX_RAM: MACRO +; prints text to screen +; \1: RAM address to read from + db $1 + dw \1 +ENDM + +TX_BCD: MACRO +; \1: RAM address to read from +; \2: number of bytes + print flags + db $2 + dw \1 + db \2 +ENDM + +TX_LINE EQUS "db $05" +TX_BLINK EQUS "db $06" +;TX_SCROLL EQUS "db $07" +TX_ASM EQUS "db $08" + +TX_NUM: MACRO +; print a big-endian decimal number. +; \1: address to read from +; \2: number of bytes to read +; \3: number of digits to display + db $09 + dw \1 + db \2 << 4 | \3 +ENDM + +TX_DELAY EQUS "db $0a" +TX_SFX_ITEM_1 EQUS "db $0b" +TX_SFX_LEVEL_UP EQUS "db $0b" +;TX_ELLIPSES EQUS "db $0c" +TX_WAIT EQUS "db $0d" +;TX_SFX_DEX_RATING EQUS "db $0e" +TX_SFX_ITEM_2 EQUS "db $10" +TX_SFX_KEY_ITEM EQUS "db $11" +TX_SFX_CAUGHT_MON EQUS "db $12" +TX_SFX_DEX_PAGE_ADDED EQUS "db $13" +TX_CRY_NIDORINA EQUS "db $14" +TX_CRY_PIDGEOT EQUS "db $15" +;TX_CRY_DEWGONG EQUS "db $16" + +TX_FAR: MACRO + db $17 + dw \1 + db BANK(\1) +ENDM + +TX_VENDING_MACHINE EQUS "db $f5" +TX_CABLE_CLUB_RECEPTIONIST EQUS "db $f6" +TX_PRIZE_VENDOR EQUS "db $f7" +TX_POKECENTER_PC EQUS "db $f9" +TX_PLAYERS_PC EQUS "db $fc" +TX_BILLS_PC EQUS "db $fd" + +TX_MART: MACRO + db $FE, _NARG + REPT _NARG + db \1 + SHIFT + ENDR + db $FF +ENDM + +TX_POKECENTER_NURSE EQUS "db $ff" diff --git a/macros/text_macros.asm b/macros/text_macros.asm deleted file mode 100755 index 21e02634..00000000 --- a/macros/text_macros.asm +++ /dev/null @@ -1,80 +0,0 @@ - -; text macros -text EQUS "db $00," ; Start writing text. -next EQUS "db $4e," ; Move a line down. -line EQUS "db $4f," ; Start writing at the bottom line. -para EQUS "db $51," ; Start a new paragraph. -cont EQUS "db $55," ; Scroll to the next line. -done EQUS "db $57" ; End a text box. -prompt EQUS "db $58" ; Prompt the player to end a text box (initiating some other event). - -page EQUS "db $49," ; Start a new Pokedex page. -dex EQUS "db $5f, $50" ; End a Pokedex entry. - -TX_RAM: MACRO -; prints text to screen -; \1: RAM address to read from - db $1 - dw \1 -ENDM - -TX_BCD: MACRO -; \1: RAM address to read from -; \2: number of bytes + print flags - db $2 - dw \1 - db \2 -ENDM - -TX_LINE EQUS "db $05" -TX_BLINK EQUS "db $06" -;TX_SCROLL EQUS "db $07" -TX_ASM EQUS "db $08" - -TX_NUM: MACRO -; print a big-endian decimal number. -; \1: address to read from -; \2: number of bytes to read -; \3: number of digits to display - db $09 - dw \1 - db \2 << 4 | \3 -ENDM - -TX_DELAY EQUS "db $0a" -TX_SFX_ITEM_1 EQUS "db $0b" -TX_SFX_LEVEL_UP EQUS "db $0b" -;TX_ELLIPSES EQUS "db $0c" -TX_WAIT EQUS "db $0d" -;TX_SFX_DEX_RATING EQUS "db $0e" -TX_SFX_ITEM_2 EQUS "db $10" -TX_SFX_KEY_ITEM EQUS "db $11" -TX_SFX_CAUGHT_MON EQUS "db $12" -TX_SFX_DEX_PAGE_ADDED EQUS "db $13" -TX_CRY_NIDORINA EQUS "db $14" -TX_CRY_PIDGEOT EQUS "db $15" -;TX_CRY_DEWGONG EQUS "db $16" - -TX_FAR: MACRO - db $17 - dw \1 - db BANK(\1) -ENDM - -TX_VENDING_MACHINE EQUS "db $f5" -TX_CABLE_CLUB_RECEPTIONIST EQUS "db $f6" -TX_PRIZE_VENDOR EQUS "db $f7" -TX_POKECENTER_PC EQUS "db $f9" -TX_PLAYERS_PC EQUS "db $fc" -TX_BILLS_PC EQUS "db $fd" - -TX_MART: MACRO - db $FE, _NARG - REPT _NARG - db \1 - SHIFT - ENDR - db $FF -ENDM - -TX_POKECENTER_NURSE EQUS "db $ff" diff --git a/scripts/CeruleanCity.asm b/scripts/CeruleanCity.asm index 117ec4da..94ec2496 100755 --- a/scripts/CeruleanCity.asm +++ b/scripts/CeruleanCity.asm @@ -64,7 +64,7 @@ CeruleanCityScript0: ld a, [wWalkBikeSurfState] and a jr z, .asm_19512 - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound .asm_19512 @@ -171,7 +171,7 @@ CeruleanCityScript2: ld a, $1 ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index 11abdf65..79de99ff 100755 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -510,7 +510,7 @@ OaksLabScript15: xor a ld [hJoyHeld], a call EnableAutoTextBoxDrawing - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart @@ -611,7 +611,7 @@ OaksLabScript16: xor a ; NPC_MOVEMENT_DOWN call FillMemory ld [hl], $ff - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart diff --git a/scripts/PalletTown.asm b/scripts/PalletTown.asm index 5ad7d40f..4c6ab015 100755 --- a/scripts/PalletTown.asm +++ b/scripts/PalletTown.asm @@ -27,8 +27,8 @@ PalletTownScript0: ld [hJoyHeld], a ld a, PLAYER_DIR_DOWN ld [wPlayerMovingDirection], a - ld a, $FF - call PlaySound ; stop music + ld a, SFX_STOP_ALL_MUSIC + call PlaySound ld a, BANK(Music_MeetProfOak) ld c, a ld a, MUSIC_MEET_PROF_OAK ; “oak appears” music diff --git a/scripts/PewterPokecenter.asm b/scripts/PewterPokecenter.asm index 22d2fb6b..be933fee 100755 --- a/scripts/PewterPokecenter.asm +++ b/scripts/PewterPokecenter.asm @@ -21,7 +21,8 @@ PewterJigglypuffText: ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld hl, .Text call PrintText - StopAllMusic + ld a, SFX_STOP_ALL_MUSIC + call PlaySound ld c, 32 call DelayFrames ld hl, JigglypuffFacingDirections diff --git a/scripts/PokemonTower2F.asm b/scripts/PokemonTower2F.asm index 81f4c0b3..94916e37 100755 --- a/scripts/PokemonTower2F.asm +++ b/scripts/PokemonTower2F.asm @@ -22,7 +22,7 @@ PokemonTower2Script0: ld hl, CoordsData_6055e call ArePlayerCoordsInArray ret nc - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld c, BANK(Music_MeetRival) @@ -76,7 +76,7 @@ PokemonTower2Script1: ld a, $1 ld [H_SPRITEINDEX], a call MoveSprite - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart diff --git a/scripts/Route22.asm b/scripts/Route22.asm index 7226e509..1fd7e09a 100755 --- a/scripts/Route22.asm +++ b/scripts/Route22.asm @@ -88,7 +88,7 @@ Route22Script0: ld a, [wWalkBikeSurfState] and a jr z, .asm_50f4e - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound .asm_50f4e @@ -167,7 +167,7 @@ Route22Script2: ld a, $1 ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart @@ -241,11 +241,11 @@ Route22Script_5104e: ld a, [wWalkBikeSurfState] and a jr z, .skipYVisibilityTesta - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound .skipYVisibilityTesta - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateTempo @@ -326,7 +326,7 @@ Route22Script5: ld a, $2 ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStartAndTempo diff --git a/scripts/SSAnne2F.asm b/scripts/SSAnne2F.asm index ba900748..2795d1d1 100755 --- a/scripts/SSAnne2F.asm +++ b/scripts/SSAnne2F.asm @@ -24,7 +24,7 @@ SSAnne2Script0: ld hl, CoordsData_61411 call ArePlayerCoordsInArray ret nc - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld c, BANK(Music_MeetRival) @@ -145,7 +145,7 @@ SSAnne2Script2: ld a, $2 ld [H_SPRITEINDEX], a call MoveSprite - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart diff --git a/scripts/SSAnneCaptainsRoom.asm b/scripts/SSAnneCaptainsRoom.asm index de0272e4..5723c32d 100755 --- a/scripts/SSAnneCaptainsRoom.asm +++ b/scripts/SSAnneCaptainsRoom.asm @@ -48,7 +48,7 @@ SSAnne7RubText: cp BANK(Audio3_UpdateMusic) ld [wAudioSavedROMBank], a jr nz, .asm_61908 - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld a, Bank(Music_PkmnHealed) diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index e7594663..84a94c92 100755 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -130,7 +130,7 @@ SilphCo7Script0: ld [wJoyIgnore], a ld a, PLAYER_DIR_DOWN ld [wPlayerMovingDirection], a - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound ld c, BANK(Music_MeetRival) @@ -219,7 +219,7 @@ SilphCo7Script4: ld a, $f ld [hSpriteIndexOrTextID], a call DisplayTextID - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound callba Music_RivalAlternateStart diff --git a/scripts/VermilionDock.asm b/scripts/VermilionDock.asm index 65b66c52..cc237f8e 100755 --- a/scripts/VermilionDock.asm +++ b/scripts/VermilionDock.asm @@ -38,7 +38,7 @@ VermilionDock_Script: VermilionDock_1db9b: SetEventForceReuseHL EVENT_SS_ANNE_LEFT - ld a, $ff + ld a, SFX_STOP_ALL_MUSIC ld [wJoyIgnore], a ld [wNewSoundID], a call PlaySound -- cgit v1.3.1-sl0p From 6ef36800b0dcb86100a7c716172015667e60dc99 Mon Sep 17 00:00:00 2001 From: Rangi Date: Fri, 3 Jul 2020 22:11:35 -0400 Subject: Replace raw hex values with HRAM constants To do: turn constants into labels and use ldh --- audio/engine_1.asm | 2 +- audio/engine_2.asm | 2 +- audio/engine_3.asm | 2 +- audio/pokedex_rating_sfx.asm | 2 +- audio/wave_instruments.asm | 2 +- constants/hardware_constants.asm | 16 +++++++ data/events/hidden_objects.asm | 46 +++++++++---------- data/maps/hide_show_data.asm | 4 +- data/wild/grass_water.asm | 2 +- engine/battle/animations.asm | 2 +- engine/battle/core.asm | 4 +- engine/battle/scale_sprites.asm | 4 +- engine/events/cinnabar_lab.asm | 2 +- engine/events/diploma.asm | 2 +- engine/events/hidden_objects/bookshelves.asm | 4 +- engine/events/hidden_objects/cinnabar_gym_quiz.asm | 12 ++--- engine/events/pick_up_item.asm | 4 +- engine/events/saffron_guards.asm | 2 +- engine/gfx/oam_dma.asm | 4 +- engine/gfx/screen_effects.asm | 12 ++--- engine/items/item_effects.asm | 2 +- engine/link/cable_club.asm | 4 +- engine/menus/pokedex.asm | 6 +-- engine/menus/save.asm | 8 ++-- engine/menus/swap_items.asm | 8 ++-- engine/movie/oak_speech/oak_speech.asm | 8 ++-- engine/overworld/hidden_objects.asm | 14 +++--- engine/overworld/missable_objects.asm | 2 +- engine/overworld/movement.asm | 4 +- engine/overworld/player_state.asm | 32 +++++++------- engine/overworld/sprite_collisions.asm | 40 ++++++++--------- engine/overworld/tilesets.asm | 2 +- engine/overworld/trainer_sight.asm | 16 +++---- engine/overworld/update_map.asm | 14 +++--- home.asm | 48 ++++++++++---------- home/init.asm | 6 +-- home/overworld.asm | 12 ++--- home/text.asm | 2 +- home/vblank.asm | 2 +- hram.asm | 51 +++++++++++++++++++++- scripts/BikeShop.asm | 2 +- scripts/BillsHouse.asm | 8 ++-- scripts/CinnabarGym.asm | 4 +- scripts/CopycatsHouse2F.asm | 2 +- scripts/OaksLab.asm | 8 ++-- scripts/PewterCity.asm | 16 +++---- scripts/Route5Gate.asm | 4 +- scripts/Route6Gate.asm | 2 +- scripts/Route7Gate.asm | 2 +- scripts/Route8Gate.asm | 2 +- scripts/SSAnne2F.asm | 4 +- scripts/SSAnneCaptainsRoom.asm | 2 +- scripts/SilphCo10F.asm | 2 +- scripts/SilphCo11F.asm | 8 ++-- scripts/SilphCo2F.asm | 8 ++-- scripts/SilphCo3F.asm | 2 +- scripts/SilphCo4F.asm | 8 ++-- scripts/SilphCo5F.asm | 2 +- scripts/SilphCo6F.asm | 2 +- scripts/SilphCo7F.asm | 8 ++-- scripts/SilphCo8F.asm | 8 ++-- scripts/SilphCo9F.asm | 8 ++-- scripts/ViridianCity.asm | 32 +++++++------- scripts/WardensHouse.asm | 2 +- wram.asm | 2 +- 65 files changed, 311 insertions(+), 248 deletions(-) (limited to 'audio') diff --git a/audio/engine_1.asm b/audio/engine_1.asm index 0f76f576..20b992aa 100644 --- a/audio/engine_1.asm +++ b/audio/engine_1.asm @@ -925,7 +925,7 @@ Audio1_ApplyWavePatternAndFrequency: ld e, [hl] inc hl ld d, [hl] - ld hl, $ff30 ; wave pattern RAM + ld hl, rWave_0 ld b, $f ld a, $0 ; stop hardware channel 3 ld [rNR30], a diff --git a/audio/engine_2.asm b/audio/engine_2.asm index 2e0aad0d..864a8c21 100644 --- a/audio/engine_2.asm +++ b/audio/engine_2.asm @@ -936,7 +936,7 @@ Audio2_ApplyWavePatternAndFrequency: ld e, [hl] inc hl ld d, [hl] - ld hl, $ff30 ; wave pattern RAM + ld hl, rWave_0 ld b, $f ld a, $0 ; stop hardware channel 3 ld [rNR30], a diff --git a/audio/engine_3.asm b/audio/engine_3.asm index 771b44df..c0aaeaf8 100644 --- a/audio/engine_3.asm +++ b/audio/engine_3.asm @@ -925,7 +925,7 @@ Audio3_ApplyWavePatternAndFrequency: ld e, [hl] inc hl ld d, [hl] - ld hl, $ff30 ; wave pattern RAM + ld hl, rWave_0 ld b, $f ld a, $0 ; stop hardware channel 3 ld [rNR30], a diff --git a/audio/pokedex_rating_sfx.asm b/audio/pokedex_rating_sfx.asm index f3aace8a..1b5dc4f0 100644 --- a/audio/pokedex_rating_sfx.asm +++ b/audio/pokedex_rating_sfx.asm @@ -1,5 +1,5 @@ PlayPokedexRatingSfx:: - ld a, [$ffdc] + ld a, [hDexRatingNumMonsOwned] ld c, $0 ld hl, OwnedMonValues .getSfxPointer diff --git a/audio/wave_instruments.asm b/audio/wave_instruments.asm index c915f18a..4a830f4b 100644 --- a/audio/wave_instruments.asm +++ b/audio/wave_instruments.asm @@ -13,7 +13,7 @@ ; these are the definitions for the channel 3 instruments ; each instrument definition is made up of 32 points (nibbles) that form ; the graph of the wave -; the current instrument is copied to $FF30 +; the current instrument is copied to rWave_0--rWave_f .wave0 db $02,$46,$8A,$CE,$FF,$FE,$ED,$DC,$CB,$A9,$87,$65,$44,$33,$22,$11 diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm index 9f2aa1b7..59ec6170 100644 --- a/constants/hardware_constants.asm +++ b/constants/hardware_constants.asm @@ -64,6 +64,22 @@ rNR44 EQU $ff23 ; Channel 4 Counter/consecutive; Initial (R/W) rNR50 EQU $ff24 ; Channel control / ON-OFF / Volume (R/W) rNR51 EQU $ff25 ; Selection of Sound output terminal (R/W) rNR52 EQU $ff26 ; Sound on/off +rWave_0 EQU $ff30 +rWave_1 EQU $ff31 +rWave_2 EQU $ff32 +rWave_3 EQU $ff33 +rWave_4 EQU $ff34 +rWave_5 EQU $ff35 +rWave_6 EQU $ff36 +rWave_7 EQU $ff37 +rWave_8 EQU $ff38 +rWave_9 EQU $ff39 +rWave_a EQU $ff3a +rWave_b EQU $ff3b +rWave_c EQU $ff3c +rWave_d EQU $ff3d +rWave_e EQU $ff3e +rWave_f EQU $ff3f rLCDC EQU $ff40 ; LCD Control (R/W) rLCDC_ENABLE EQU 7 rLCDC_ENABLE_MASK EQU 1 << rLCDC_ENABLE diff --git a/data/events/hidden_objects.asm b/data/events/hidden_objects.asm index 737947a7..8fc539ef 100755 --- a/data/events/hidden_objects.asm +++ b/data/events/hidden_objects.asm @@ -224,7 +224,7 @@ OaksLabHiddenObjects: db $FF ViridianPokecenterHiddenObjects: db $04,$00,$08 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $03,$0d,$04 db BANK(OpenPokemonCenterPC) @@ -234,7 +234,7 @@ ViridianMartHiddenObjects: db $FF ViridianSchoolHiddenObjects: db $04,$03,(ViridianSchoolNotebook_id - TextPredefs) / 2 + 1 - db Bank(PrintNotebookText) + db BANK(PrintNotebookText) dw PrintNotebookText db $00,$03,(ViridianSchoolBlackboard_id - TextPredefs) / 2 + 1 db BANK(PrintBlackboardLinkCableText) @@ -262,7 +262,7 @@ PewterMartHiddenObjects: db $FF PewterPokecenterHiddenObjects: db $04,$00,$08 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $03,$0d,$04 db BANK(OpenPokemonCenterPC) @@ -270,7 +270,7 @@ PewterPokecenterHiddenObjects: db $FF CeruleanPokecenterHiddenObjects: db $04,$00,$08 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $03,$0d,$04 db BANK(OpenPokemonCenterPC) @@ -286,7 +286,7 @@ CeruleanMartHiddenObjects: db $FF LavenderPokecenterHiddenObjects: db $04,$00,$08 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $03,$0d,$04 db BANK(OpenPokemonCenterPC) @@ -297,7 +297,7 @@ VermilionPokecenterHiddenObjects: db BANK(OpenPokemonCenterPC) dw OpenPokemonCenterPC db $04,$00,$04 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $FF VermilionGymHiddenObjects: @@ -345,7 +345,7 @@ CeladonMansion2HiddenObjects: db $FF CeladonPokecenterHiddenObjects: db $04,$00,$08 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $03,$0d,$04 db BANK(OpenPokemonCenterPC) @@ -460,7 +460,7 @@ CeladonHotelHiddenObjects: db BANK(OpenPokemonCenterPC) dw OpenPokemonCenterPC db $04,$00,$08 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $FF FuchsiaPokecenterHiddenObjects: @@ -468,7 +468,7 @@ FuchsiaPokecenterHiddenObjects: db BANK(OpenPokemonCenterPC) dw OpenPokemonCenterPC db $04,$00,$04 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $FF FuchsiaGymHiddenObjects: @@ -481,27 +481,27 @@ CinnabarGymHiddenObjects: db $0d,$11,$04 dbw BANK(GymStatues),GymStatues db $07,$0f,$01 - db Bank(PrintCinnabarQuiz) + db BANK(PrintCinnabarQuiz) dw PrintCinnabarQuiz db $01,$0a,$12 - db Bank(PrintCinnabarQuiz) + db BANK(PrintCinnabarQuiz) dw PrintCinnabarQuiz db $07,$09,$13 - db Bank(PrintCinnabarQuiz) + db BANK(PrintCinnabarQuiz) dw PrintCinnabarQuiz db $0d,$09,$14 - db Bank(PrintCinnabarQuiz) + db BANK(PrintCinnabarQuiz) dw PrintCinnabarQuiz db $0d,$01,$05 - db Bank(PrintCinnabarQuiz) + db BANK(PrintCinnabarQuiz) dw PrintCinnabarQuiz db $07,$01,$16 - db Bank(PrintCinnabarQuiz) + db BANK(PrintCinnabarQuiz) dw PrintCinnabarQuiz db $FF CinnabarPokecenterHiddenObjects: db $04,$00,$04 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $03,$0d,$04 db BANK(OpenPokemonCenterPC) @@ -513,7 +513,7 @@ SaffronGymHiddenObjects: db $FF MtMoonPokecenterHiddenObjects: db $04,$00,$08 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $03,$0d,$04 db BANK(OpenPokemonCenterPC) @@ -521,7 +521,7 @@ MtMoonPokecenterHiddenObjects: db $FF RockTunnelPokecenterHiddenObjects: db $04,$00,$08 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $03,$0d,$04 db BANK(OpenPokemonCenterPC) @@ -589,7 +589,7 @@ RocketHideout4HiddenObjects: db $FF SaffronPokecenterHiddenObjects: db $04,$00,$04 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $03,$0d,$04 db BANK(OpenPokemonCenterPC) @@ -704,7 +704,7 @@ ViridianCityHiddenObjects: db $FF SafariZoneRestHouse2HiddenObjects: db $04,$00,$08 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $03,$0d,$04 db BANK(OpenPokemonCenterPC) @@ -712,7 +712,7 @@ SafariZoneRestHouse2HiddenObjects: db $FF SafariZoneRestHouse3HiddenObjects: db $04,$00,$08 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $03,$0d,$04 db BANK(OpenPokemonCenterPC) @@ -720,7 +720,7 @@ SafariZoneRestHouse3HiddenObjects: db $FF SafariZoneRestHouse4HiddenObjects: db $04,$00,$08 - db Bank(PrintBenchGuyText) + db BANK(PrintBenchGuyText) dw PrintBenchGuyText db $03,$0d,$04 db BANK(OpenPokemonCenterPC) @@ -750,7 +750,7 @@ CeladonMansion5HiddenObjects: db BANK(PrintBlackboardLinkCableText) dw PrintBlackboardLinkCableText db $04,$03,(TMNotebook_id - TextPredefs) / 2 + 1 - db Bank(PrintNotebookText) + db BANK(PrintNotebookText) dw PrintNotebookText db $FF FightingDojoHiddenObjects: diff --git a/data/maps/hide_show_data.asm b/data/maps/hide_show_data.asm index 7f4593ca..bc89d600 100755 --- a/data/maps/hide_show_data.asm +++ b/data/maps/hide_show_data.asm @@ -2,7 +2,7 @@ ; objects for each map ($00-$F8) ; Table of 2-Byte pointers, one pointer per map, -; goes up to Map_F7, ends with $FFFF. +; goes up to Map_F7, ends with -1. ; points to table listing all missable object in the area MapHSPointers: dw MapHS00 @@ -253,7 +253,7 @@ MapHSPointers: dw MapHSXX dw MapHSXX dw MapHSXX - dw $FFFF + dw -1 ; end ; Structure: ; 3 bytes per object diff --git a/data/wild/grass_water.asm b/data/wild/grass_water.asm index f1dd461e..9dc41f82 100755 --- a/data/wild/grass_water.asm +++ b/data/wild/grass_water.asm @@ -247,7 +247,7 @@ WildDataPointers: dw NoMons dw NoMons dw NoMons - dw $FFFF + dw -1 ; end ; wild pokemon data is divided into two parts. ; first part: pokemon found in grass diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index c16fa3ec..d858e066 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -163,7 +163,7 @@ DrawFrameBlock: PlayAnimation: xor a - ld [$FF8B], a ; it looks like nothing reads this + ld [hROMBankTemp], a ; it looks like nothing reads this ld [wSubAnimTransform], a ld a, [wAnimationID] ; get animation number dec a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index e503243d..00852b2b 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6870,9 +6870,9 @@ _LoadTrainerPic: ld d, a ; de contains pointer to trainer pic ld a, [wLinkState] and a - ld a, Bank(TrainerPics) ; this is where all the trainer pics are (not counting Red's) + ld a, BANK(TrainerPics) ; this is where all the trainer pics are (not counting Red's) jr z, .loadSprite - ld a, Bank(RedPicFront) + ld a, BANK(RedPicFront) .loadSprite call UncompressSpriteFromDE ld de, vFrontPic diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm index 1774f7c5..11967ba1 100644 --- a/engine/battle/scale_sprites.asm +++ b/engine/battle/scale_sprites.asm @@ -17,7 +17,7 @@ ScaleFirstThreeSpriteColumnsByTwo: .columnInnerLoop push bc ld a, [de] - ld bc, -(7*8)+1 ; $ffc9, scale lower nybble and seek to previous output column + ld bc, -(7*8)+1 ; -$37, scale lower nybble and seek to previous output column call ScalePixelsByTwo ld a, [de] dec de @@ -32,7 +32,7 @@ ScaleFirstThreeSpriteColumnsByTwo: dec de dec de ld a, b - ld bc, -7*8 ; $ffc8, skip one output column (which has already been written along with the current one) + ld bc, -7*8 ; -$38, skip one output column (which has already been written along with the current one) add hl, bc ld b, a dec b diff --git a/engine/events/cinnabar_lab.asm b/engine/events/cinnabar_lab.asm index e642840d..e1598f98 100755 --- a/engine/events/cinnabar_lab.asm +++ b/engine/events/cinnabar_lab.asm @@ -35,7 +35,7 @@ GiveFossilToCinnabarLab:: ld e, a add hl, de ld a, [hl] - ld [$ffdb], a + ld [hItemToRemoveID], a cp DOME_FOSSIL jr z, .choseDomeFossil cp HELIX_FOSSIL diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index e53ef58f..24bd2f22 100755 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -73,7 +73,7 @@ UnusedPlayerNameLengthFunc: ; Unused function that does a calculation involving the length of the player's ; name. ld hl, wPlayerName - ld bc, $ff00 + lb bc, $ff, $00 .loop ld a, [hli] cp "@" diff --git a/engine/events/hidden_objects/bookshelves.asm b/engine/events/hidden_objects/bookshelves.asm index 82cd8843..eaf744ff 100644 --- a/engine/events/hidden_objects/bookshelves.asm +++ b/engine/events/hidden_objects/bookshelves.asm @@ -24,7 +24,7 @@ PrintBookshelfText:: pop af call PrintPredefTextID xor a - ld [$ffdb], a + ld [hFFDB], a ret .nextBookshelfEntry1 inc hl @@ -33,7 +33,7 @@ PrintBookshelfText:: jr .loop .noMatch ld a, $ff - ld [$ffdb], a + ld [hFFDB], a jpba PrintCardKeyText INCLUDE "data/tilesets/bookshelf_tile_ids.asm" diff --git a/engine/events/hidden_objects/cinnabar_gym_quiz.asm b/engine/events/hidden_objects/cinnabar_gym_quiz.asm index 9f549eea..6404717e 100644 --- a/engine/events/hidden_objects/cinnabar_gym_quiz.asm +++ b/engine/events/hidden_objects/cinnabar_gym_quiz.asm @@ -16,7 +16,7 @@ CinnabarGymQuiz:: pop af and $f0 swap a - ld [$ffdc], a + ld [hGymGateAnswer], a ld hl, CinnabarGymQuizIntroText call PrintText ld a, [hGymGateIndex] @@ -77,7 +77,7 @@ CinnabarGymGateFlagAction: CinnabarGymQuiz_1ea92: call YesNoChoice - ld a, [$ffdc] + ld a, [hGymGateAnswer] ld c, a ld a, [wCurrentMenuItem] cp c @@ -85,10 +85,10 @@ CinnabarGymQuiz_1ea92: ld hl, wCurrentMapScriptFlags set 5, [hl] ld a, [hGymGateIndex] - ld [$ffe0], a + ld [hBackupGymGateIndex], a ld hl, CinnabarGymQuizCorrectText call PrintText - ld a, [$ffe0] + ld a, [hBackupGymGateIndex] AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0 ld c, a ld b, FLAG_SET @@ -122,7 +122,7 @@ CinnabarGymQuizCorrectText: TX_BLINK TX_ASM - ld a, [$ffe0] + ld a, [hBackupGymGateIndex] AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0 ld c, a ld b, FLAG_TEST @@ -162,7 +162,7 @@ UpdateCinnabarGymGateTileBlocks_:: ld [wGymGateTileBlock], a push bc ld a, [hGymGateIndex] - ld [$ffe0], a + ld [hBackupGymGateIndex], a AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0 ld c, a ld b, FLAG_TEST diff --git a/engine/events/pick_up_item.asm b/engine/events/pick_up_item.asm index 9f19100a..5a658f22 100644 --- a/engine/events/pick_up_item.asm +++ b/engine/events/pick_up_item.asm @@ -15,7 +15,7 @@ PickUpItem: .isMissable ld a, [hl] - ld [$ffdb], a + ld [hMissableObjectIndex], a ld hl, wMapSpriteExtraData ld a, [hSpriteIndexOrTextID] @@ -30,7 +30,7 @@ PickUpItem: call GiveItem jr nc, .BagFull - ld a, [$ffdb] + ld a, [hMissableObjectIndex] ld [wMissableObjectIndex], a predef HideObject ld a, 1 diff --git a/engine/events/saffron_guards.asm b/engine/events/saffron_guards.asm index 02ab92ea..59c2725c 100755 --- a/engine/events/saffron_guards.asm +++ b/engine/events/saffron_guards.asm @@ -2,7 +2,7 @@ RemoveGuardDrink:: ld hl, GuardDrinksList .drinkLoop ld a, [hli] - ld [$ffdb], a + ld [hItemToRemoveID], a and a ret z push hl diff --git a/engine/gfx/oam_dma.asm b/engine/gfx/oam_dma.asm index b0d64675..aeea4c01 100644 --- a/engine/gfx/oam_dma.asm +++ b/engine/gfx/oam_dma.asm @@ -1,12 +1,12 @@ WriteDMACodeToHRAM:: ; Since no other memory is available during OAM DMA, ; DMARoutine is copied to HRAM and executed there. - ld c, $ff80 % $100 + ld c, hDMARoutine % $100 ld b, DMARoutineEnd - DMARoutine ld hl, DMARoutine .copy ld a, [hli] - ld [$ff00+c], a + ldh [c], a inc c dec b jr nz, .copy diff --git a/engine/gfx/screen_effects.asm b/engine/gfx/screen_effects.asm index 95f0ea25..0d3806c1 100755 --- a/engine/gfx/screen_effects.asm +++ b/engine/gfx/screen_effects.asm @@ -19,7 +19,7 @@ PredefShakeScreenVertically: ld [wDisableVBlankWYUpdate], a xor a .loop - ld [$ff96], a + ld [hMutateWY], a call .MutateWY call .MutateWY dec b @@ -30,9 +30,9 @@ PredefShakeScreenVertically: ret .MutateWY - ld a, [$ff96] + ld a, [hMutateWY] xor b - ld [$ff96], a + ld [hMutateWY], a ld [rWY], a ld c, 3 jp DelayFrames @@ -43,7 +43,7 @@ PredefShakeScreenHorizontally: call GetPredefRegisters xor a .loop - ld [$ff97], a + ld [hMutateWX], a call .MutateWX ld c, 1 call DelayFrames @@ -58,9 +58,9 @@ PredefShakeScreenHorizontally: ret .MutateWX - ld a, [$ff97] + ld a, [hMutateWX] xor b - ld [$ff97], a + ld [hMutateWX], a bit 7, a jr z, .skipZeroing xor a ; zero a if it's negative diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index a793ae00..7e2aa227 100755 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1341,7 +1341,7 @@ ItemUseMedicine: push hl push de ld d, a - callab CalcExperience ; calculate experience for next level and store it at $ff96 + callab CalcExperience ; calculate experience for next level and store it at hExperience pop de pop hl ld bc, wPartyMon1Exp - wPartyMon1Level diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 13b92e71..58008a94 100755 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -663,7 +663,7 @@ TradeCenter_PrintPartyListNames: push de push hl ld a, c - ld [$ff95], a + ld [hPastLeadingZeros], a call GetMonName pop hl call PlaceString @@ -903,7 +903,7 @@ CableClub_Run: ld [wTilesetGfxPtr + 1], a ld a, l ld [wTilesetGfxPtr], a - ld a, Bank(Club_GFX) + ld a, BANK(Club_GFX) ld [wTilesetBank], a ld hl, Club_Coll ld a, h diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index 0b7fb83c..baf656b6 100755 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -566,11 +566,11 @@ ShowPokedexDataInternal: pop hl inc hl ; hl = address of pokedex description text coord bc, 1, 11 - ld a, 2 - ld [$fff4], a + ld a, %10 + ld [hClearLetterPrintingDelayFlags], a call TextCommandProcessor ; print pokedex description text xor a - ld [$fff4], a + ld [hClearLetterPrintingDelayFlags], a .waitForButtonPress call JoypadLowSensitivity ld a, [hJoy5] diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 5aec7bd0..f2ecc3aa 100755 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -601,9 +601,9 @@ GetMonCountsForBoxesInBank: ret SAVCheckRandomID: -;checks if Sav file is the same by checking player's name 1st letter ($a598) +; checks if Sav file is the same by checking player's name 1st letter ; and the two random numbers generated at game beginning -;(which are stored at wPlayerID)s +; (which are stored at wPlayerID)s ld a, $0a ld [MBC1SRamEnable], a ld a, $01 @@ -702,7 +702,7 @@ ClearSAV: PadSRAM_FF: ld [MBC1SRamBank], a - ld hl, $a000 - ld bc, $2000 + ld hl, $a000 ; start of SRAM + ld bc, $2000 ; size of SRAM ld a, $ff jp FillMemory diff --git a/engine/menus/swap_items.asm b/engine/menus/swap_items.asm index 826fe60b..8b793ea1 100644 --- a/engine/menus/swap_items.asm +++ b/engine/menus/swap_items.asm @@ -77,18 +77,18 @@ HandleItemListSwapping:: cp b jr z, .swapSameItemType .swapDifferentItems - ld [$ff95], a ; [$ff95] = second item ID + ld [hSwapItemID], a ; save second item ID ld a, [hld] - ld [$ff96], a ; [$ff96] = second item quantity + ld [hSwapItemQuantity], a ; save second item quantity ld a, [de] ld [hli], a ; put first item ID in second item slot inc de ld a, [de] ld [hl], a ; put first item quantity in second item slot - ld a, [$ff96] + ld a, [hSwapItemQuantity] ld [de], a ; put second item quantity in first item slot dec de - ld a, [$ff95] + ld a, [hSwapItemID] ld [de], a ; put second item ID in first item slot xor a ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index ea7b84d8..578cf3b2 100755 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -57,7 +57,7 @@ OakSpeech: bit 1, a ; possibly a debug mode bit jp nz, .skipChoosingNames ld de, ProfOakPic - lb bc, Bank(ProfOakPic), $00 + lb bc, BANK(ProfOakPic), $00 call IntroDisplayPicCenteredOrUpperRight call FadeInIntroPic ld hl, OakSpeechText1 @@ -76,7 +76,7 @@ OakSpeech: call GBFadeOutToWhite call ClearScreen ld de, RedPicFront - lb bc, Bank(RedPicFront), $00 + lb bc, BANK(RedPicFront), $00 call IntroDisplayPicCenteredOrUpperRight call MovePicLeft ld hl, IntroducePlayerText @@ -85,7 +85,7 @@ OakSpeech: call GBFadeOutToWhite call ClearScreen ld de, Rival1Pic - lb bc, Bank(Rival1Pic), $00 + lb bc, BANK(Rival1Pic), $00 call IntroDisplayPicCenteredOrUpperRight call FadeInIntroPic ld hl, IntroduceRivalText @@ -95,7 +95,7 @@ OakSpeech: call GBFadeOutToWhite call ClearScreen ld de, RedPicFront - lb bc, Bank(RedPicFront), $00 + lb bc, BANK(RedPicFront), $00 call IntroDisplayPicCenteredOrUpperRight call GBFadeInFromWhite ld a, [wd72d] diff --git a/engine/overworld/hidden_objects.asm b/engine/overworld/hidden_objects.asm index 5887660e..a19694e0 100755 --- a/engine/overworld/hidden_objects.asm +++ b/engine/overworld/hidden_objects.asm @@ -14,14 +14,14 @@ IsPlayerOnDungeonWarp:: set 4, [hl] ret -; if a hidden object was found, stores $00 in [$ffee], else stores $ff +; if a hidden object was found, stores $00 in [hFoundHiddenObject], else stores $ff CheckForHiddenObject:: - ld hl, $ffeb + ld hl, hFoundHiddenObjectOrBookshelf xor a - ld [hli], a - ld [hli], a - ld [hli], a - ld [hl], a + ld [hli], a ; [hFoundHiddenObjectOrBookshelf] + ld [hli], a ; [hSavedMapTextPtr] + ld [hli], a ; [hSavedMapTextPtr + 1] + ld [hl], a ; [hFoundHiddenObject] ld de, $0 ld hl, HiddenObjectMaps .hiddenMapLoop @@ -81,7 +81,7 @@ CheckForHiddenObject:: ret .noMatch ld a, $ff - ld [$ffee], a + ld [hFoundHiddenObject], a ret ; checks if the coordinates in front of the player's sprite match Y in b and X in c diff --git a/engine/overworld/missable_objects.asm b/engine/overworld/missable_objects.asm index 6d365715..a89fcb54 100644 --- a/engine/overworld/missable_objects.asm +++ b/engine/overworld/missable_objects.asm @@ -120,7 +120,7 @@ IsObjectHidden: .notHidden xor a .hidden - ld [$ffe5], a + ld [hIsHiddenMissableObject], a ret ; adds missable object (items, leg. pokemon, etc.) to the map diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 432ae5ca..6c354779 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -475,7 +475,7 @@ InitializeSpriteScreenPosition: ; tests if sprite is off screen or otherwise unable to do anything CheckSpriteAvailability: predef IsObjectHidden - ld a, [$ffe5] + ld a, [hIsHiddenMissableObject] and a jp nz, .spriteInvisible ld h, wSpriteStateData2 / $100 @@ -564,7 +564,7 @@ UpdateSpriteImage: ld a, [hl] ; c1x9: facing direction add b ld b, a - ld a, [$ff93] ; current sprite offset + ld a, [hTilePlayerStandingOn] add b ld b, a ld a, [hCurrentSpriteOffset] diff --git a/engine/overworld/player_state.asm b/engine/overworld/player_state.asm index 69b9201f..ea24fdc1 100644 --- a/engine/overworld/player_state.asm +++ b/engine/overworld/player_state.asm @@ -297,7 +297,7 @@ _GetTileAndCoordsInFrontOfPlayer: GetTileTwoStepsInFrontOfPlayer: xor a - ld [$ffdb], a + ld [hPlayerFacing], a ld hl, wYCoord ld a, [hli] ld d, a @@ -306,7 +306,7 @@ GetTileTwoStepsInFrontOfPlayer: and a ; cp SPRITE_FACING_DOWN jr nz, .notFacingDown ; facing down - ld hl, $ffdb + ld hl, hPlayerFacing set 0, [hl] aCoord 8, 13 inc d @@ -315,7 +315,7 @@ GetTileTwoStepsInFrontOfPlayer: cp SPRITE_FACING_UP jr nz, .notFacingUp ; facing up - ld hl, $ffdb + ld hl, hPlayerFacing set 1, [hl] aCoord 8, 5 dec d @@ -324,7 +324,7 @@ GetTileTwoStepsInFrontOfPlayer: cp SPRITE_FACING_LEFT jr nz, .notFacingLeft ; facing left - ld hl, $ffdb + ld hl, hPlayerFacing set 2, [hl] aCoord 4, 9 dec e @@ -333,7 +333,7 @@ GetTileTwoStepsInFrontOfPlayer: cp SPRITE_FACING_RIGHT jr nz, .storeTile ; facing right - ld hl, $ffdb + ld hl, hPlayerFacing set 3, [hl] aCoord 12, 9 inc e @@ -378,33 +378,33 @@ CheckForBoulderCollisionWithSprites: ld hl, wSpriteStateData2 + $14 add hl, de ld a, [hli] ; map Y position - ld [$ffdc], a + ld [hPlayerYCoord], a ld a, [hl] ; map X position - ld [$ffdd], a + ld [hPlayerXCoord], a ld a, [wNumSprites] ld c, a ld de, $f ld hl, wSpriteStateData2 + $14 - ld a, [$ffdb] + ld a, [hPlayerFacing] and $3 ; facing up or down? jr z, .pushingHorizontallyLoop .pushingVerticallyLoop inc hl - ld a, [$ffdd] + ld a, [hPlayerXCoord] cp [hl] jr nz, .nextSprite1 ; if X coordinates don't match dec hl ld a, [hli] ld b, a - ld a, [$ffdb] + ld a, [hPlayerFacing] rrca jr c, .pushingDown ; pushing up - ld a, [$ffdc] + ld a, [hPlayerYCoord] dec a jr .compareYCoords .pushingDown - ld a, [$ffdc] + ld a, [hPlayerYCoord] inc a .compareYCoords cp b @@ -417,19 +417,19 @@ CheckForBoulderCollisionWithSprites: .pushingHorizontallyLoop ld a, [hli] ld b, a - ld a, [$ffdc] + ld a, [hPlayerYCoord] cp b jr nz, .nextSprite2 ld b, [hl] - ld a, [$ffdb] + ld a, [hPlayerFacing] bit 2, a jr nz, .pushingLeft ; pushing right - ld a, [$ffdd] + ld a, [hPlayerXCoord] inc a jr .compareXCoords .pushingLeft - ld a, [$ffdd] + ld a, [hPlayerXCoord] dec a .compareXCoords cp b diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index 43d1759c..c5ff8ebb 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -31,7 +31,7 @@ _UpdateSprites:: UpdateNonPlayerSprite: dec a swap a - ld [$ff93], a ; $10 * sprite# + ld [hTilePlayerStandingOn], a ; $10 * sprite# ld a, [wNPCMovementScriptSpriteOffset] ; some sprite offset? ld b, a ld a, [hCurrentSpriteOffset] @@ -79,7 +79,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ld [$ff90], a ; store Y coordinate adjusted for direction of movement + ld [hFF90], a ; store Y coordinate adjusted for direction of movement ld a, [hli] ; a = [$c1i5] (delta X) (-1, 0, or 1) call SetSpriteCollisionValues @@ -92,7 +92,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ld [$ff91], a ; store X coordinate adjusted for direction of movement + ld [hFF91], a ; store X coordinate adjusted for direction of movement ld a, l add 7 @@ -102,15 +102,15 @@ DetectCollisionBetweenSprites: ld [hld], a ; zero [$c1id] XXX what's [$c1id] for? ld [hld], a ; zero [$c1ic] (directions in which collisions occurred) - ld a, [$ff91] + ld a, [hFF91] ld [hld], a ; [$c1ib] = adjusted X coordinate - ld a, [$ff90] + ld a, [hFF90] ld [hl], a ; [$c1ia] = adjusted Y coordinate xor a ; zero the loop counter .loop - ld [$ff8f], a ; store loop counter + ld [hFF8F], a ; store loop counter swap a ld e, a ld a, [hCurrentSpriteOffset] @@ -154,7 +154,7 @@ DetectCollisionBetweenSprites: cpl inc a .noCarry1 - ld [$ff90], a ; store the distance between the two sprites' adjusted Y values + ld [hFF90], a ; store the distance between the two sprites' adjusted Y values ; Use the carry flag set by the above subtraction to determine which sprite's ; Y coordinate is larger. This information is used later to set [$c1ic], @@ -176,11 +176,11 @@ DetectCollisionBetweenSprites: ld b, 9 .next1 - ld a, [$ff90] ; a = distance between adjusted Y coordinates + ld a, [hFF90] ; a = distance between adjusted Y coordinates sub b - ld [$ff92], a ; store distance adjusted using sprite i's direction + ld [hFF92], a ; store distance adjusted using sprite i's direction ld a, b - ld [$ff90], a ; store 7 or 9 depending on sprite i's delta Y + ld [hFF90], a ; store 7 or 9 depending on sprite i's delta Y jr c, .checkXDistance ; If sprite j's delta Y is 0, then b = 7, else b = 9. @@ -193,7 +193,7 @@ DetectCollisionBetweenSprites: ld b, 9 .next2 - ld a, [$ff92] ; a = distance adjusted using sprite i's direction + ld a, [hFF92] ; a = distance adjusted using sprite i's direction sub b ; adjust distance using sprite j's direction jr z, .checkXDistance jr nc, .next ; go to next sprite if distance is still positive after both adjustments @@ -225,7 +225,7 @@ DetectCollisionBetweenSprites: cpl inc a .noCarry2 - ld [$ff91], a ; store the distance between the two sprites' adjusted X values + ld [hFF91], a ; store the distance between the two sprites' adjusted X values ; Use the carry flag set by the above subtraction to determine which sprite's ; X coordinate is larger. This information is used later to set [$c1ic], @@ -247,11 +247,11 @@ DetectCollisionBetweenSprites: ld b, 9 .next3 - ld a, [$ff91] ; a = distance between adjusted X coordinates + ld a, [hFF91] ; a = distance between adjusted X coordinates sub b - ld [$ff92], a ; store distance adjusted using sprite i's direction + ld [hFF92], a ; store distance adjusted using sprite i's direction ld a, b - ld [$ff91], a ; store 7 or 9 depending on sprite i's delta X + ld [hFF91], a ; store 7 or 9 depending on sprite i's delta X jr c, .collision ; If sprite j's delta X is 0, then b = 7, else b = 9. @@ -264,15 +264,15 @@ DetectCollisionBetweenSprites: ld b, 9 .next4 - ld a, [$ff92] ; a = distance adjusted using sprite i's direction + ld a, [hFF92] ; a = distance adjusted using sprite i's direction sub b ; adjust distance using sprite j's direction jr z, .collision jr nc, .next ; go to next sprite if distance is still positive after both adjustments .collision - ld a, [$ff91] ; a = 7 or 9 depending on sprite i's delta X + ld a, [hFF91] ; a = 7 or 9 depending on sprite i's delta X ld b, a - ld a, [$ff90] ; a = 7 or 9 depending on sprite i's delta Y + ld a, [hFF90] ; a = 7 or 9 depending on sprite i's delta Y inc l ; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100. @@ -294,7 +294,7 @@ DetectCollisionBetweenSprites: ; set bit in [$c1ie] or [$c1if] to indicate which sprite the collision occurred with inc l inc l - ld a, [$ff8f] ; a = loop counter + ld a, [hFF8F] ; a = loop counter ld de, SpriteCollisionBitTable add a add e @@ -311,7 +311,7 @@ DetectCollisionBetweenSprites: ld [hl], a .next - ld a, [$ff8f] ; a = loop counter + ld a, [hFF8F] ; a = loop counter inc a cp $10 jp nz, .loop diff --git a/engine/overworld/tilesets.asm b/engine/overworld/tilesets.asm index d6b8221c..88147233 100644 --- a/engine/overworld/tilesets.asm +++ b/engine/overworld/tilesets.asm @@ -25,7 +25,7 @@ LoadTilesetHeader: ld a, [hl] ld [hTilesetType], a xor a - ld [$ffd8], a + ld [hMovingBGTilesCounter1], a pop hl ld a, [wCurMapTileset] push hl diff --git a/engine/overworld/trainer_sight.asm b/engine/overworld/trainer_sight.asm index f0ea7266..81978c35 100755 --- a/engine/overworld/trainer_sight.asm +++ b/engine/overworld/trainer_sight.asm @@ -5,16 +5,16 @@ _GetSpritePosition1:: ld [hSpriteIndex], a call GetSpriteDataPointer ld a, [hli] ; c1x4 (screen Y pos) - ld [$ffeb], a + ld [hSpriteScreenYCoord], a inc hl ld a, [hl] ; c1x6 (screen X pos) - ld [$ffec], a + ld [hSpriteScreenXCoord], a ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de ld a, [hli] ; c2x4 (map Y pos) - ld [$ffed], a + ld [hSpriteMapYCoord], a ld a, [hl] ; c2x5 (map X pos) - ld [$ffee], a + ld [hSpriteMapXCoord], a ret _GetSpritePosition2:: @@ -42,16 +42,16 @@ _SetSpritePosition1:: ld a, [wSpriteIndex] ld [hSpriteIndex], a call GetSpriteDataPointer - ld a, [$ffeb] ; c1x4 (screen Y pos) + ld a, [hSpriteScreenYCoord] ; c1x4 (screen Y pos) ld [hli], a inc hl - ld a, [$ffec] ; c1x6 (screen X pos) + ld a, [hSpriteScreenXCoord] ; c1x6 (screen X pos) ld [hl], a ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de - ld a, [$ffed] ; c2x4 (map Y pos) + ld a, [hSpriteMapYCoord] ; c2x4 (map Y pos) ld [hli], a - ld a, [$ffee] ; c2x5 (map X pos) + ld a, [hSpriteMapXCoord] ; c2x5 (map X pos) ld [hl], a ret diff --git a/engine/overworld/update_map.asm b/engine/overworld/update_map.asm index c494065c..92ae2b10 100644 --- a/engine/overworld/update_map.asm +++ b/engine/overworld/update_map.asm @@ -63,7 +63,7 @@ RedrawMapView: ld a, [hli] ld h, [hl] ld l, a - ld de, -2 * 32 + ld de, -2 * BG_MAP_WIDTH add hl, de ld a, h and $3 @@ -73,23 +73,23 @@ RedrawMapView: ld a, h ld [wBuffer + 1], a ; this copy of the address is not used ld a, 2 - ld [$ffbe], a - ld c, 9 ; number of rows of 2x2 tiles (this covers the whole screen) + ld [hRedrawMapViewRowOffset], a + ld c, SCREEN_HEIGHT / 2 ; number of rows of 2x2 tiles (this covers the whole screen) .redrawRowLoop push bc push hl push hl ld hl, wTileMap - 2 * SCREEN_WIDTH ld de, SCREEN_WIDTH - ld a, [$ffbe] + ld a, [hRedrawMapViewRowOffset] .calcWRAMAddrLoop add hl, de dec a jr nz, .calcWRAMAddrLoop call CopyToRedrawRowOrColumnSrcTiles pop hl - ld de, $20 - ld a, [$ffbe] + ld de, BG_MAP_WIDTH + ld a, [hRedrawMapViewRowOffset] ld c, a .calcVRAMAddrLoop add hl, de @@ -104,7 +104,7 @@ RedrawMapView: ld a, REDRAW_ROW ld [hRedrawRowOrColumnMode], a call DelayFrame - ld hl, $ffbe + ld hl, hRedrawMapViewRowOffset inc [hl] inc [hl] pop hl diff --git a/home.asm b/home.asm index e9cd3ecf..2c58d0e6 100644 --- a/home.asm +++ b/home.asm @@ -199,7 +199,7 @@ LoadFrontSpriteByMonIndex:: pop hl ld a, [hLoadedROMBank] push af - ld a, Bank(CopyUncompressedPicToHL) + ld a, BANK(CopyUncompressedPicToHL) ld [hLoadedROMBank], a ld [MBC1RomBank], a xor a @@ -832,7 +832,7 @@ UpdateSprites:: ret nz ld a, [hLoadedROMBank] push af - ld a, Bank(_UpdateSprites) + ld a, BANK(_UpdateSprites) ld [hLoadedROMBank], a ld [MBC1RomBank], a call _UpdateSprites @@ -1104,7 +1104,7 @@ DisplayPokemartDialogue:: ld [wListMenuID], a ld a, [hLoadedROMBank] push af - ld a, Bank(DisplayPokemartDialogue_) + ld a, BANK(DisplayPokemartDialogue_) ld [hLoadedROMBank], a ld [MBC1RomBank], a call DisplayPokemartDialogue_ @@ -1136,14 +1136,14 @@ LoadItemList:: DisplayPokemonCenterDialogue:: ; zeroing these doesn't appear to serve any purpose xor a - ld [$ff8b], a - ld [$ff8c], a - ld [$ff8d], a + ld [hItemPrice], a + ld [hItemPrice + 1], a + ld [hItemPrice + 2], a inc hl ld a, [hLoadedROMBank] push af - ld a, Bank(DisplayPokemonCenterDialogue_) + ld a, BANK(DisplayPokemonCenterDialogue_) ld [hLoadedROMBank], a ld [MBC1RomBank], a call DisplayPokemonCenterDialogue_ @@ -2794,7 +2794,7 @@ GetTrainerInformation:: ld a, [wLinkState] and a jr nz, .linkBattle - ld a, Bank(TrainerPicAndMoneyPointers) + ld a, BANK(TrainerPicAndMoneyPointers) call BankswitchHome ld a, [wTrainerClass] dec a @@ -3185,12 +3185,12 @@ GetName:: ld hl, NamePointers add hl, de ld a, [hli] - ld [$ff96], a + ld [hSwapTemp + 1], a ld a, [hl] - ld [$ff95], a - ld a, [$ff95] + ld [hSwapTemp], a + ld a, [hSwapTemp] ld h, a - ld a, [$ff96] + ld a, [hSwapTemp + 1] ld l, a ld a, [wd0b5] ld b, a @@ -3258,7 +3258,7 @@ GetItemPrice:: ld [hItemPrice], a jr .done .getTMPrice - ld a, Bank(GetMachinePrice) + ld a, BANK(GetMachinePrice) ld [hLoadedROMBank], a ld [MBC1RomBank], a call GetMachinePrice @@ -3409,7 +3409,7 @@ Divide:: push bc ld a, [hLoadedROMBank] push af - ld a, Bank(_Divide) + ld a, BANK(_Divide) ld [hLoadedROMBank], a ld [MBC1RomBank], a call _Divide @@ -3552,11 +3552,11 @@ CalcStat:: call Multiply ld a, [hld] ld d, a - ld a, [$ff98] + ld a, [hProduct + 3] sub d ld a, [hli] ld d, a - ld a, [$ff97] + ld a, [hProduct + 2] sbc d ; test if (current stat exp bonus)^2 < stat exp jr c, .statExpLoop .statExpDone @@ -4497,11 +4497,11 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: bit 0, a ; A button jr z, .nothingFound ; A button is pressed - ld a, Bank(CheckForHiddenObject) + ld a, BANK(CheckForHiddenObject) ld [MBC1RomBank], a ld [hLoadedROMBank], a call CheckForHiddenObject - ld a, [$ffee] + ld a, [hFoundHiddenObject] and a jr nz, .hiddenObjectNotFound ld a, [wHiddenObjectFunctionRomBank] @@ -4515,13 +4515,13 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: jr .done .hiddenObjectNotFound callba PrintBookshelfText - ld a, [$ffdb] + ld a, [hFFDB] and a jr z, .done .nothingFound ld a, $ff .done - ld [$ffeb], a + ld [hFoundHiddenObjectOrBookshelf], a pop af ld [MBC1RomBank], a ld [hLoadedROMBank], a @@ -4537,17 +4537,17 @@ PrintPredefTextID:: RestoreMapTextPointer:: ld hl, wMapTextPtr - ld a, [$ffec] + ld a, [hSavedMapTextPtr] ld [hli], a - ld a, [$ffec + 1] + ld a, [hSavedMapTextPtr + 1] ld [hl], a ret SetMapTextPointer:: ld a, [wMapTextPtr] - ld [$ffec], a + ld [hSavedMapTextPtr], a ld a, [wMapTextPtr + 1] - ld [$ffec + 1], a + ld [hSavedMapTextPtr + 1], a ld a, l ld [wMapTextPtr], a ld a, h diff --git a/home/init.asm b/home/init.asm index efc886e0..48294fa6 100644 --- a/home/init.asm +++ b/home/init.asm @@ -53,13 +53,13 @@ rLCDC_DEFAULT EQU %11100011 call ClearVram - ld hl, $ff80 - ld bc, $ffff - $ff80 + ld hl, $ff80 ; start of HRAM + ld bc, $ffff - $ff80 ; size of HRAM call FillMemory call ClearSprites - ld a, Bank(WriteDMACodeToHRAM) + ld a, BANK(WriteDMACodeToHRAM) ld [hLoadedROMBank], a ld [MBC1RomBank], a call WriteDMACodeToHRAM diff --git a/home/overworld.asm b/home/overworld.asm index 9fb269dc..c959beb6 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -88,7 +88,7 @@ OverworldLoopLessDelay:: call IsPlayerCharacterBeingControlledByGame jr nz, .checkForOpponent call CheckForHiddenObjectOrBookshelfOrCardKeyDoor - ld a, [$ffeb] + ld a, [hFoundHiddenObjectOrBookshelf] and a jp z, OverworldLoop ; jump if a hidden object or bookshelf was found, but not if a card key door was found call IsSpriteOrSignInFrontOfPlayer @@ -762,7 +762,7 @@ HandleBlackOut:: call StopMusic ld hl, wd72e res 5, [hl] - ld a, Bank(ResetStatusAndHalveMoneyOnBlackout) ; also Bank(SpecialWarpIn) and Bank(SpecialEnterMap) + ld a, BANK(ResetStatusAndHalveMoneyOnBlackout) ; also BANK(SpecialWarpIn) and BANK(SpecialEnterMap) ld [hLoadedROMBank], a ld [MBC1RomBank], a call ResetStatusAndHalveMoneyOnBlackout @@ -793,7 +793,7 @@ HandleFlyWarpOrDungeonWarp:: set 2, [hl] ; fly warp or dungeon warp res 5, [hl] ; forced to ride bike call LeaveMapAnim - ld a, Bank(SpecialWarpIn) + ld a, BANK(SpecialWarpIn) ld [hLoadedROMBank], a ld [MBC1RomBank], a call SpecialWarpIn @@ -2388,14 +2388,14 @@ SwitchToMapRomBank:: push bc ld c, a ld b, $00 - ld a, Bank(MapHeaderBanks) + ld a, BANK(MapHeaderBanks) call BankswitchHome ; switch to ROM bank 3 ld hl, MapHeaderBanks add hl, bc ld a, [hl] - ld [$ffe8], a ; save map ROM bank + ld [hMapROMBank], a ; save map ROM bank call BankswitchBack - ld a, [$ffe8] + ld a, [hMapROMBank] ld [hLoadedROMBank], a ld [MBC1RomBank], a ; switch to map ROM bank pop bc diff --git a/home/text.asm b/home/text.asm index 89c93dd0..0d2ed0a2 100644 --- a/home/text.asm +++ b/home/text.asm @@ -365,7 +365,7 @@ TextCommandProcessor:: push af set 1, a ld e, a - ld a, [$fff4] + ld a, [hClearLetterPrintingDelayFlags] xor e ld [wLetterPrintingDelayFlags], a ld a, c diff --git a/home/vblank.asm b/home/vblank.asm index e8232ea3..78f5f69d 100644 --- a/home/vblank.asm +++ b/home/vblank.asm @@ -26,7 +26,7 @@ VBlank:: call VBlankCopy call VBlankCopyDouble call UpdateMovingBgTiles - call $ff80 ; hOAMDMA + call hDMARoutine ld a, BANK(PrepareOAMData) ld [hLoadedROMBank], a ld [MBC1RomBank], a diff --git a/hram.asm b/hram.asm index 69abb717..ab18b8c9 100644 --- a/hram.asm +++ b/hram.asm @@ -1,3 +1,5 @@ +hDMARoutine EQU $FF80 + hSoftReset EQU $FF8A ; Initialized to 16. ; Decremented each input iteration if the player @@ -81,6 +83,11 @@ hOAMBufferOffset EQU $FF90 hSpriteScreenX EQU $FF91 hSpriteScreenY EQU $FF92 +hFF8F EQU $FF8F +hFF90 EQU $FF90 +hFF91 EQU $FF91 +hFF92 EQU $FF92 + hTilePlayerStandingOn EQU $FF93 hSpritePriority EQU $FF94 @@ -90,14 +97,20 @@ hSignCoordPointer EQU $FF95 hNPCMovementDirections2Index EQU $FF95 +hSwapItemID EQU $FF95 +hSwapItemQuantity EQU $FF96 + ; CalcPositionOfPlayerRelativeToNPC hNPCSpriteOffset EQU $FF95 -; temp value used when swapping bytes +; temp value used when swapping bytes or words hSwapTemp EQU $FF95 hExperience EQU $FF96 ; 3 bytes, big endian +hMutateWY EQU $FF96 +hMutateWX EQU $FF97 + ; Multiplication and division variables are meant ; to overlap for back-to-back usage. Big endian. @@ -204,6 +217,8 @@ hAutoBGTransferPortion EQU $FFBB ; the destination address of the automatic background transfer hAutoBGTransferDest EQU $FFBC ; 2 bytes +hRedrawMapViewRowOffset EQU $FFBE + ; temporary storage for stack pointer during memory transfers that use pop ; to increase speed hSPTemp EQU $FFBF ; 2 bytes @@ -272,7 +287,8 @@ hCurrentSpriteOffset EQU $FFDA ; multiple of $10 hItemCounter EQU $FFDB -hGymGateIndex EQU $FFDB +hGymGateIndex EQU $FFDB +hGymGateAnswer EQU $FFDC hGymTrashCanRandNumMask EQU $FFDB @@ -285,33 +301,64 @@ hDexRatingNumMonsOwned EQU $FFDC ; $FF = player cancelled hOaksAideResult EQU $FFDB +hSavedCoordIndex EQU $FFDB + hOaksAideRequirement EQU $FFDB ; required number of owned mons hOaksAideRewardItem EQU $FFDC hOaksAideNumMonsOwned EQU $FFDD +hPlayerFacing EQU $FFDB +hPlayerYCoord EQU $FFDC +hPlayerXCoord EQU $FFDD + +hMissableObjectIndex EQU $FFDB + hItemToRemoveID EQU $FFDB hItemToRemoveIndex EQU $FFDC hVendingMachineItem EQU $FFDB hVendingMachinePrice EQU $FFDC ; 3-byte BCD number +hFFDB EQU $FFDB +hFFDC EQU $FFDC + +hBackupGymGateIndex EQU $FFE0 + +hUnlockedSilphCoDoors EQU $FFE0 + ; the first tile ID in a sequence of tile IDs that increase by 1 each step hStartTileID EQU $FFE1 hNewPartyLength EQU $FFE4 +hIsHiddenMissableObject EQU $FFE5 + hDividend2 EQU $FFE5 hDivisor2 EQU $FFE6 hQuotient2 EQU $FFE7 +hMapROMBank EQU $FFE8 + hSpriteVRAMSlotAndFacing EQU $FFE9 hCoordsInFrontOfPlayerMatch EQU $FFEA hSpriteAnimFrameCounter EQU $FFEA +hSpriteScreenYCoord EQU $FFEB +hSpriteScreenXCoord EQU $FFEC +hSpriteMapYCoord EQU $FFED +hSpriteMapXCoord EQU $FFEE + +hFoundHiddenObjectOrBookshelf EQU $FFEB +hFoundHiddenObject EQU $FFEE + +hSavedMapTextPtr EQU $FFEC + hWhoseTurn EQU $FFF3 ; 0 on player’s turn, 1 on enemy’s turn +hClearLetterPrintingDelayFlags EQU $FFF4 + ; bit 0: draw HP fraction to the right of bar instead of below (for party menu) ; bit 1: menu is double spaced hFlagsFFF6 EQU $FFF6 diff --git a/scripts/BikeShop.asm b/scripts/BikeShop.asm index 71149759..2661ca70 100755 --- a/scripts/BikeShop.asm +++ b/scripts/BikeShop.asm @@ -23,7 +23,7 @@ BikeShopText1: call GiveItem jr nc, .BagFull ld a, BIKE_VOUCHER - ld [$ffdb], a + ld [hItemToRemoveID], a callba RemoveItemByID SetEvent EVENT_GOT_BICYCLE ld hl, BikeShopText_1d824 diff --git a/scripts/BillsHouse.asm b/scripts/BillsHouse.asm index 0c8ca4de..395694a3 100755 --- a/scripts/BillsHouse.asm +++ b/scripts/BillsHouse.asm @@ -66,13 +66,13 @@ BillsHouseScript3: ld a, $2 ld [wSpriteIndex], a ld a, $c - ld [$ffeb], a + ld [hSpriteScreenYCoord], a ld a, $40 - ld [$ffec], a + ld [hSpriteScreenXCoord], a ld a, $6 - ld [$ffed], a + ld [hSpriteMapYCoord], a ld a, $5 - ld [$ffee], a + ld [hSpriteMapXCoord], a call SetSpritePosition1 ld a, HS_BILL_1 ld [wMissableObjectIndex], a diff --git a/scripts/CinnabarGym.asm b/scripts/CinnabarGym.asm index 1e92505a..08bbbe8b 100755 --- a/scripts/CinnabarGym.asm +++ b/scripts/CinnabarGym.asm @@ -96,7 +96,7 @@ CinnabarGymScript2: cp $ff jp z, CinnabarGymScript_75792 ld a, [wTrainerHeaderFlagBit] - ld [$ffdb], a + ld [hGymGateIndex], a AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2 ld c, a ld b, FLAG_TEST @@ -111,7 +111,7 @@ CinnabarGymScript2: call WaitForSoundToFinish .asm_7581b ld a, [wTrainerHeaderFlagBit] - ld [$ffdb], a + ld [hGymGateIndex], a AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2 ld c, a ld b, FLAG_SET diff --git a/scripts/CopycatsHouse2F.asm b/scripts/CopycatsHouse2F.asm index b43234c3..64612535 100755 --- a/scripts/CopycatsHouse2F.asm +++ b/scripts/CopycatsHouse2F.asm @@ -29,7 +29,7 @@ CopycatsHouse2FText1: ld hl, ReceivedTM31Text call PrintText ld a, POKE_DOLL - ld [$ffdb], a + ld [hItemToRemoveID], a callba RemoveItemByID SetEvent EVENT_GOT_TM31 jr .asm_62ecd diff --git a/scripts/OaksLab.asm b/scripts/OaksLab.asm index a0383246..9bb84923 100755 --- a/scripts/OaksLab.asm +++ b/scripts/OaksLab.asm @@ -672,9 +672,9 @@ OaksLabScript_RemoveParcel: OaksLabScript_1d02b: ld a, $7c - ld [$ffeb], a + ld [hSpriteScreenYCoord], a ld a, $8 - ld [$ffee], a + ld [hSpriteMapXCoord], a ld a, [wYCoord] cp $3 jr nz, .asm_1d045 @@ -703,9 +703,9 @@ OaksLabScript_1d02b: .asm_1d066 ld a, $20 .asm_1d068 - ld [$ffec], a + ld [hSpriteScreenXCoord], a ld a, b - ld [$ffed], a + ld [hSpriteMapYCoord], a ld a, $1 ld [wSpriteIndex], a call SetSpritePosition1 diff --git a/scripts/PewterCity.asm b/scripts/PewterCity.asm index 1b658242..86037c13 100755 --- a/scripts/PewterCity.asm +++ b/scripts/PewterCity.asm @@ -58,13 +58,13 @@ PewterCityScript1: ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $3c - ld [$ffeb], a + ld [hSpriteScreenYCoord], a ld a, $30 - ld [$ffec], a + ld [hSpriteScreenXCoord], a ld a, $c - ld [$ffed], a + ld [hSpriteMapYCoord], a ld a, $11 - ld [$ffee], a + ld [hSpriteMapXCoord], a ld a, $3 ld [wSpriteIndex], a call SetSpritePosition1 @@ -126,13 +126,13 @@ PewterCityScript4: ld [hSpriteIndexOrTextID], a call DisplayTextID ld a, $3c - ld [$ffeb], a + ld [hSpriteScreenYCoord], a ld a, $40 - ld [$ffec], a + ld [hSpriteScreenXCoord], a ld a, $16 - ld [$ffed], a + ld [hSpriteMapYCoord], a ld a, $10 - ld [$ffee], a + ld [hSpriteMapXCoord], a ld a, $5 ld [wSpriteIndex], a call SetSpritePosition1 diff --git a/scripts/Route5Gate.asm b/scripts/Route5Gate.asm index bc763dfd..e5d86b97 100755 --- a/scripts/Route5Gate.asm +++ b/scripts/Route5Gate.asm @@ -27,7 +27,7 @@ Route5GateScript0: xor a ld [hJoyHeld], a callba RemoveGuardDrink - ld a, [$ffdb] + ld a, [hItemToRemoveID] and a jr nz, .asm_1df82 ld a, $2 @@ -74,7 +74,7 @@ Route5GateText1: bit 6, a jr nz, .asm_88856 callba RemoveGuardDrink - ld a, [$ffdb] + ld a, [hItemToRemoveID] and a jr nz, .asm_768a2 ld hl, Route5GateText2 diff --git a/scripts/Route6Gate.asm b/scripts/Route6Gate.asm index 348f61ac..6b00eddb 100755 --- a/scripts/Route6Gate.asm +++ b/scripts/Route6Gate.asm @@ -21,7 +21,7 @@ Route6GateScript0: xor a ld [hJoyHeld], a callba RemoveGuardDrink - ld a, [$ffdb] + ld a, [hItemToRemoveID] and a jr nz, .asm_1e080 ld a, $2 diff --git a/scripts/Route7Gate.asm b/scripts/Route7Gate.asm index 724172c5..06c5c91b 100755 --- a/scripts/Route7Gate.asm +++ b/scripts/Route7Gate.asm @@ -33,7 +33,7 @@ Route7GateScript0: xor a ld [hJoyHeld], a callba RemoveGuardDrink - ld a, [$ffdb] + ld a, [hItemToRemoveID] and a jr nz, .asm_1e15a ld a, $2 diff --git a/scripts/Route8Gate.asm b/scripts/Route8Gate.asm index 8ecea68e..80b8b9a4 100755 --- a/scripts/Route8Gate.asm +++ b/scripts/Route8Gate.asm @@ -32,7 +32,7 @@ Route8GateScript0: xor a ld [hJoyHeld], a callba RemoveGuardDrink - ld a, [$ffdb] + ld a, [hItemToRemoveID] and a jr nz, .asm_1e220 ld a, $2 diff --git a/scripts/SSAnne2F.asm b/scripts/SSAnne2F.asm index 203e9711..face08d8 100755 --- a/scripts/SSAnne2F.asm +++ b/scripts/SSAnne2F.asm @@ -31,7 +31,7 @@ SSAnne2Script0: ld a, MUSIC_MEET_RIVAL call PlayMusic ld a, [wCoordIndex] - ld [$ffdb], a + ld [hSavedCoordIndex], a ld a, HS_SS_ANNE_2F_RIVAL ld [wMissableObjectIndex], a predef ShowObject @@ -43,7 +43,7 @@ SSAnne2Script0: ld [hJoyHeld], a ld a, $f0 ld [wJoyIgnore], a - ld a, [$ffdb] + ld a, [hSavedCoordIndex] cp $2 jr nz, .asm_61400 ld de, MovementData_6140c diff --git a/scripts/SSAnneCaptainsRoom.asm b/scripts/SSAnneCaptainsRoom.asm index 5723c32d..6078ccf0 100755 --- a/scripts/SSAnneCaptainsRoom.asm +++ b/scripts/SSAnneCaptainsRoom.asm @@ -51,7 +51,7 @@ SSAnne7RubText: ld a, SFX_STOP_ALL_MUSIC ld [wNewSoundID], a call PlaySound - ld a, Bank(Music_PkmnHealed) + ld a, BANK(Music_PkmnHealed) ld [wAudioROMBank], a .asm_61908 ld a, MUSIC_PKMN_HEALED diff --git a/scripts/SilphCo10F.asm b/scripts/SilphCo10F.asm index 40506682..92d95de1 100755 --- a/scripts/SilphCo10F.asm +++ b/scripts/SilphCo10F.asm @@ -28,7 +28,7 @@ SilphCo10GateCoords: db $FF SilphCo10Text_5a176: - ld a, [$ffe0] + ld a, [hUnlockedSilphCoDoors] and a ret z SetEvent EVENT_SILPH_CO_10_UNLOCKED_DOOR diff --git a/scripts/SilphCo11F.asm b/scripts/SilphCo11F.asm index 2f9d7924..116b528f 100755 --- a/scripts/SilphCo11F.asm +++ b/scripts/SilphCo11F.asm @@ -35,14 +35,14 @@ SilphCo11Script_62137: ld a, [hl] ld c, a xor a - ld [$ffe0], a + ld [hUnlockedSilphCoDoors], a pop hl .asm_62143 ld a, [hli] cp $ff jr z, .asm_6215f push hl - ld hl, $ffe0 + ld hl, hUnlockedSilphCoDoors inc [hl] pop hl cp b @@ -60,11 +60,11 @@ SilphCo11Script_62137: ret .asm_6215f xor a - ld [$ffe0], a + ld [hUnlockedSilphCoDoors], a ret SilphCo11Script_62163: - ld a, [$ffe0] + ld a, [hUnlockedSilphCoDoors] and a ret z SetEvent EVENT_SILPH_CO_11_UNLOCKED_DOOR diff --git a/scripts/SilphCo2F.asm b/scripts/SilphCo2F.asm index 5fd542cb..0ff7cee3 100755 --- a/scripts/SilphCo2F.asm +++ b/scripts/SilphCo2F.asm @@ -45,14 +45,14 @@ SilphCo2Script_59d43: ld a, [hl] ld c, a xor a - ld [$ffe0], a + ld [hUnlockedSilphCoDoors], a pop hl .asm_59d4f ld a, [hli] cp $ff jr z, .asm_59d6b push hl - ld hl, $ffe0 + ld hl, hUnlockedSilphCoDoors inc [hl] pop hl cp b @@ -70,12 +70,12 @@ SilphCo2Script_59d43: ret .asm_59d6b xor a - ld [$ffe0], a + ld [hUnlockedSilphCoDoors], a ret SilphCo2Script_59d6f: EventFlagAddress hl, EVENT_SILPH_CO_2_UNLOCKED_DOOR1 - ld a, [$ffe0] + ld a, [hUnlockedSilphCoDoors] and a ret z cp $1 diff --git a/scripts/SilphCo3F.asm b/scripts/SilphCo3F.asm index 42b5d611..3b6b1da8 100755 --- a/scripts/SilphCo3F.asm +++ b/scripts/SilphCo3F.asm @@ -39,7 +39,7 @@ SilphCo3GateCoords: SilphCo3Script_59fad: EventFlagAddress hl, EVENT_SILPH_CO_3_UNLOCKED_DOOR1 - ld a, [$ffe0] + ld a, [hUnlockedSilphCoDoors] and a ret z cp $1 diff --git a/scripts/SilphCo4F.asm b/scripts/SilphCo4F.asm index 7d5072f6..61288277 100755 --- a/scripts/SilphCo4F.asm +++ b/scripts/SilphCo4F.asm @@ -45,14 +45,14 @@ SilphCo4Script_19d5d: ld a, [hl] ld c, a xor a - ld [$ffe0], a + ld [hUnlockedSilphCoDoors], a pop hl .asm_19d69 ld a, [hli] cp $ff jr z, .asm_19d85 push hl - ld hl, $ffe0 + ld hl, hUnlockedSilphCoDoors inc [hl] pop hl cp b @@ -70,12 +70,12 @@ SilphCo4Script_19d5d: ret .asm_19d85 xor a - ld [$ffe0], a + ld [hUnlockedSilphCoDoors], a ret SilphCo4Script_19d89: EventFlagAddress hl, EVENT_SILPH_CO_4_UNLOCKED_DOOR1 - ld a, [$ffe0] + ld a, [hUnlockedSilphCoDoors] and a ret z cp $1 diff --git a/scripts/SilphCo5F.asm b/scripts/SilphCo5F.asm index d9deda5b..39d7235b 100755 --- a/scripts/SilphCo5F.asm +++ b/scripts/SilphCo5F.asm @@ -49,7 +49,7 @@ SilphCo5GateCoords: SilphCo5Script_19f9e: EventFlagAddress hl, EVENT_SILPH_CO_5_UNLOCKED_DOOR1 - ld a, [$ffe0] + ld a, [hUnlockedSilphCoDoors] and a ret z cp $1 diff --git a/scripts/SilphCo6F.asm b/scripts/SilphCo6F.asm index ddbcba79..9e6ffaf1 100755 --- a/scripts/SilphCo6F.asm +++ b/scripts/SilphCo6F.asm @@ -28,7 +28,7 @@ SilphCo6GateCoords: db $FF SilphCo6Script_1a1e6: - ld a, [$ffe0] + ld a, [hUnlockedSilphCoDoors] and a ret z SetEvent EVENT_SILPH_CO_6_UNLOCKED_DOOR diff --git a/scripts/SilphCo7F.asm b/scripts/SilphCo7F.asm index 97dd09ea..4966bba6 100755 --- a/scripts/SilphCo7F.asm +++ b/scripts/SilphCo7F.asm @@ -55,14 +55,14 @@ SilphCo7Text_51bc8: ld a, [hl] ld c, a xor a - ld [$ffe0], a + ld [hUnlockedSilphCoDoors], a pop hl .asm_51bd4 ld a, [hli] cp $ff jr z, .asm_51bf0 push hl - ld hl, $ffe0 + ld hl, hUnlockedSilphCoDoors inc [hl] pop hl cp b @@ -80,12 +80,12 @@ SilphCo7Text_51bc8: ret .asm_51bf0 xor a - ld [$ffe0], a + ld [hUnlockedSilphCoDoors], a ret SilphCo7Text_51bf4: EventFlagAddress hl, EVENT_SILPH_CO_7_UNLOCKED_DOOR1 - ld a, [$ffe0] + ld a, [hUnlockedSilphCoDoors] and a ret z cp $1 diff --git a/scripts/SilphCo8F.asm b/scripts/SilphCo8F.asm index ce6579f7..b1c32a34 100755 --- a/scripts/SilphCo8F.asm +++ b/scripts/SilphCo8F.asm @@ -35,14 +35,14 @@ SilphCo8Script_56541: ld a, [hl] ld c, a xor a - ld [$ffe0], a + ld [hUnlockedSilphCoDoors], a pop hl .asm_5654d ld a, [hli] cp $ff jr z, .asm_56569 push hl - ld hl, $ffe0 + ld hl, hUnlockedSilphCoDoors inc [hl] pop hl cp b @@ -60,11 +60,11 @@ SilphCo8Script_56541: ret .asm_56569 xor a - ld [$ffe0], a + ld [hUnlockedSilphCoDoors], a ret SilphCo8Script_5656d: - ld a, [$ffe0] + ld a, [hUnlockedSilphCoDoors] and a ret z SetEvent EVENT_SILPH_CO_8_UNLOCKED_DOOR diff --git a/scripts/SilphCo9F.asm b/scripts/SilphCo9F.asm index 66291e98..d9fdc625 100755 --- a/scripts/SilphCo9F.asm +++ b/scripts/SilphCo9F.asm @@ -65,14 +65,14 @@ SilphCo9Script_5d837: ld a, [hl] ld c, a xor a - ld [$ffe0], a + ld [hUnlockedSilphCoDoors], a pop hl .asm_5d843 ld a, [hli] cp $ff jr z, .asm_5d85f push hl - ld hl, $ffe0 + ld hl, hUnlockedSilphCoDoors inc [hl] pop hl cp b @@ -90,12 +90,12 @@ SilphCo9Script_5d837: ret .asm_5d85f xor a - ld [$ffe0], a + ld [hUnlockedSilphCoDoors], a ret SilphCo9Script_5d863: EventFlagAddress hl, EVENT_SILPH_CO_9_UNLOCKED_DOOR1 - ld a, [$ffe0] + ld a, [hUnlockedSilphCoDoors] and a ret z cp $1 diff --git a/scripts/ViridianCity.asm b/scripts/ViridianCity.asm index 643431a4..c3eb9a79 100755 --- a/scripts/ViridianCity.asm +++ b/scripts/ViridianCity.asm @@ -59,14 +59,14 @@ ViridianCityScript_1903d: ret ViridianCityScript1: - ld a, [wSpriteStateData1 + $34] - ld [$ffeb], a - ld a, [wSpriteStateData1 + $36] - ld [$ffec], a - ld a, [wSpriteStateData2 + $34] - ld [$ffed], a - ld a, [wSpriteStateData2 + $35] - ld [$ffee], a + ld a, [wSprite03StateData1YPixels] + ld [hSpriteScreenYCoord], a + ld a, [wSprite03StateData1XPixels] + ld [hSpriteScreenXCoord], a + ld a, [wSprite03StateData2MapY] + ld [hSpriteMapYCoord], a + ld a, [wSprite03StateData2MapX] + ld [hSpriteMapXCoord], a xor a ld [wListScrollOffset], a @@ -82,14 +82,14 @@ ViridianCityScript1: ret ViridianCityScript2: - ld a, [$ffeb] - ld [wSpriteStateData1 + $34], a - ld a, [$ffec] - ld [wSpriteStateData1 + $36], a - ld a, [$ffed] - ld [wSpriteStateData2 + $34], a - ld a, [$ffee] - ld [wSpriteStateData2 + $35], a + ld a, [hSpriteScreenYCoord] + ld [wSprite03StateData1YPixels], a + ld a, [hSpriteScreenXCoord] + ld [wSprite03StateData1XPixels], a + ld a, [hSpriteMapYCoord] + ld [wSprite03StateData2MapY], a + ld a, [hSpriteMapXCoord] + ld [wSprite03StateData2MapX], a call UpdateSprites call Delay3 xor a diff --git a/scripts/WardensHouse.asm b/scripts/WardensHouse.asm index e6ca47b2..015d137f 100755 --- a/scripts/WardensHouse.asm +++ b/scripts/WardensHouse.asm @@ -32,7 +32,7 @@ FuchsiaHouse2Text1: ld hl, WardenTeethText1 call PrintText ld a, GOLD_TEETH - ld [$ffdb], a + ld [hItemToRemoveID], a callba RemoveItemByID SetEvent EVENT_GAVE_GOLD_TEETH .asm_60cba diff --git a/wram.asm b/wram.asm index 40e1604a..9c37b3db 100755 --- a/wram.asm +++ b/wram.asm @@ -1985,7 +1985,7 @@ wSpriteOutputBitOffset:: ; determines where in the output byte the two bits are ds 1 wSpriteLoadFlags:: -; bit 0 determines used buffer (0 -> $a188, 1 -> $a310) +; bit 0 determines used buffer (0 -> sSpriteBuffer1, 1 -> sSpriteBuffer2) ; bit 1 loading last sprite chunk? (there are at most 2 chunks per load operation) ds 1 wSpriteUnpackMode:: -- cgit v1.3.1-sl0p