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

Add Deep Loop Nesting support #329

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

KungFuFurby
Copy link
Owner

This merge request closes #302.

This almost completely replaces the standard storage locations for $E6 and $E9
loops: only $C0+x is still used to store the nesting level. Instead, all nesting
data will be dynamically allocated when loading a song. For now, it's allocated
to $C000 because the dynamic part has not yet been implemented on both the C++
side and the SNES side (yes, really: the SNES side is getting involved because
it tracks where to load data on the SPC700).

Note that the loop type reads and writes are planned, but ultimately are not
implemented. This is because their detection is currently not needed unless loop
breaks are involved. I've still reserved the byte for now.

This commit mentions #302.
Multiple ARAM locations have been retired as a result of using deep nesting and
are now unused: a few of them dating back to AddmusicK.

Note that $0180-$018F is found in the new-vcmd-collection branch, and thus is
not reflected here as it de-facto never existed.

This commit mentions #302.
@KungFuFurby KungFuFurby added documentation Improvements or additions to documentation spc-side Involves the SPC700 code. not-in-bleeding-edge Has not been incorporated into the bleeding-edge branch yet. labels Sep 28, 2022
@KungFuFurby
Copy link
Owner Author

KungFuFurby commented Dec 22, 2023

Currently this is not fully implemented. What needs to be done is the following...

  • On the SPC side, enchant the goDownOneLevel subroutine in readahead so that it can handle copying of pointers to the readahead reserved "channel" in the stack. This may also involve saving the flag of $11.6, since it may be subject to being overwritten. Locally I also need to conjure up a test MML case that satisfies the conditions: I've done this for the other cases.
  • Implement the C++ side .
    • Adjust the way the nesting limitations are handled. I have already determined that the way this is coded, the subroutines are going to need some additional work done to them coding-wise, since so far they take up an eighth "channel". That's fine and dandy for one nesting level, but some cases can get more complicated.
    • Implement stack size detection. This must be factored in to the filesize of both the local and global songs, though the stack will be stored after the end of the local song, and the deepest nesting level will be handled the same way that the EDL was handled.
  • Implement the SNES side. This will likely be required for updating the start of the stack pointer. It also requires that I track the number of bytes to allocate to the stack. Note that we don't need to clear out the region after loading: the nesting level variable will handle that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation not-in-bleeding-edge Has not been incorporated into the bleeding-edge branch yet. spc-side Involves the SPC700 code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deep Loop Nesting Support
1 participant