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

SPC-Side Optimization Collection 2 #412

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

KungFuFurby
Copy link
Owner

@KungFuFurby KungFuFurby commented Oct 31, 2023

AddmusicK 1.0.10 will currently not be taking in these optimizations to avoid accidental regressions. However, these optimizations are going to be here to track bytes saved for future accommodations of any additional SPC-side code that will be included by default.

Number of bytes saved so far for the default build as of 8720e27: $11 bytes

Six bytes are saved. One is saved by consolidating setting !MusicNoiseChannels
and $0389 into a Noiz subroutine, but only with !noSFX set to !false. The other
five are saved by recycling VCMD $F8's code.

!noSFX gets a different saving: namely, by getting rid of a redundant set of
!MusicNoiseChannels, because VCMD $F8's code does the job instead, and it's
never skipped since the SFX check naturally does not exist.
By taking advantage of the accumulator and recycling a call to KeyOffVoices
(though we skip clearing !PlayingVoices), we save two bytes.

This one (and a missed optimization) was also ported to the old unpause silent
SFX ASM that was kept for historical reasons and also to act as an example.
This does the same thing as checking for a zero in Y. The accumulator is
overwritten, but we're not really using it afterwards, so we save a byte.
Y is already zero in the first place, so we save a byte by doing this.
Set these prior to performing the ID comparisons for ProcessAPU1SFX. Saves ten
bytes in the process, but they're only saved for the hardcoded 1DFA SFX.
Another three bytes saved by doing this, but again, only for hardcoded 1DFA SFX.
@KungFuFurby KungFuFurby added the spc-side Involves the SPC700 code. label Oct 31, 2023
This does the same thing as checking for a zero in Y. The accumulator is
overwritten, but we're not really using it afterwards, so we save a byte.
Calling L_09CD then jumping to pitch is already handled by the main SFX
code, and jumping there saves three bytes for the hardcoded SFX.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spc-side Involves the SPC700 code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant