Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made frequency table lookups work across 256 byte boundaries #1

Merged
merged 1 commit into from
Mar 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 48 additions & 45 deletions Source/mGBASMSynthFunctions.s
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ _asmUpdatePu1PbWheelReset$::
ld A,(hl)
ld B,A

ld A,#<_freq
add A,B
add A,B
ld E,A
ld A,#>_freq
ld D,A
ld A,B
add A,A
add A,#<_freq
ld E,A
adc #>_freq
sub E
ld D,A

ld A,(DE)
ld (#0xFF13),A
Expand Down Expand Up @@ -144,15 +145,13 @@ _asmUpdatePu2PbWheelReset$::

ld hl, #_noteStatus + 3
ld A,(hl)
ld B,A


ld A,#<_freq
add A,B
add A,B
ld E,A
ld A,#>_freq
ld D,A
add A,A
add A,#<_freq
ld E,A
adc #>_freq
sub E
ld D,A

ld A,(DE)
ld (#0xFF18),A
Expand Down Expand Up @@ -254,14 +253,13 @@ _asmUpdateWavPbWheelReset$::

ld hl, #_noteStatus + 5
ld A,(hl)
ld B,A

ld A,#<_freq
add A,B
add A,B
ld E,A
ld A,#>_freq
ld D,A
add A,A
add A,#<_freq
ld E,A
adc #>_freq
sub E
ld D,A

ld A,(DE)

Expand Down Expand Up @@ -340,9 +338,10 @@ _asmUpdateNoiPbWheelReset$::
ld B,A

ld A,#<_noiFreq
add A,B
add A,B
ld E,A
ld A,#>_noiFreq
adc A,#>_noiFreq
sub E
ld D,A

ld A,(DE)
Expand Down Expand Up @@ -380,7 +379,7 @@ _asmPlayNotePu1::

cp #0x00
jr nz,_asmPlayNotePu1OnSet$
jr _asmPlayNotePu1Off$
jp _asmPlayNotePu1Off$

_asmPlayNotePu1OnSet$::
ld A, (#0xFF12)
Expand Down Expand Up @@ -426,12 +425,13 @@ _asmPlayNotePu1On$::
ld hl, #_noteStatus + 1
ld (hl),B

ld A,#<_freq
add A,B
add A,B
ld E,A
ld A,#>_freq
ld D,A
ld A,B
add A,A
add A,#<_freq
ld E,A
adc #>_freq
sub E
ld D,A

ld A,(DE)
ld (#0xFF13),A
Expand Down Expand Up @@ -522,7 +522,7 @@ _asmPlayNotePu2$::

cp #0x00
jr nz,_asmPlayNotePu2OnSet$
jr _asmPlayNotePu2Off$
jp _asmPlayNotePu2Off$

_asmPlayNotePu2OnSet$::
ld A, (#0xFF17)
Expand Down Expand Up @@ -566,12 +566,13 @@ _asmPlayNotePu2On$::
ld hl, #_noteStatus + 3
ld (hl),B

ld A,#<_freq
add A,B
add A,B
ld E,A
ld A,#>_freq
ld D,A
ld A,B
add A,A
add A,#<_freq
ld E,A
adc #>_freq
sub E
ld D,A

ld A,(DE)
ld (#0xFF18),A
Expand Down Expand Up @@ -689,12 +690,13 @@ pop bc
ret

_asmPlayNoteWavSet$::
ld A,#<_freq
add A,B
add A,B
ld E,A
ld A,#>_freq
ld D,A
ld A,B
add A,A
add A,#<_freq
ld E,A
adc #>_freq
sub E
ld D,A

ld A,(DE)

Expand Down Expand Up @@ -819,9 +821,10 @@ _asmPlayNoteNoiOn$::
ld (#0xFF21),A

ld A,#<_noiFreq
add A,B
add A,B
ld E,A
ld A,#>_noiFreq
adc A,#>_noiFreq
sub E
ld D,A

ld A,(DE)
Expand Down