Skip to content
New issue

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

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

Already on GitHub? # to your account

Implement LOAD UNION and LOAD FRAGMENT #736

Merged
merged 1 commit into from
Feb 17, 2021
Merged

Conversation

Rangi42
Copy link
Contributor

@Rangi42 Rangi42 commented Feb 14, 2021

Fix #632

@Rangi42
Copy link
Contributor Author

Rangi42 commented Feb 14, 2021

I was going to just implement LOAD UNION, but since SECTION FRAGMENT is allowed for RAM sections, it should probably work for LOAD blocks too.

LOAD UNION is easier to implement; LOAD FRAGMENT required the extra math to adjust loadOffset and curOffset by sect->size. (This is because the offset into the LOAD section needs to take previous FRAGMENTs' size so far into account, but the offset into the parent ROM section needs to ignore them and just reserve space for the current LOAD fragment.)

Also, I just do curOffset -= loadOffset; (A) to parallel the curOffset += loadOffset; later, and (B) because manually attempting to optimize that is not an improvement: in Compiler Explorer, even at -O2, the same code is generated either way.

@Rangi42
Copy link
Contributor Author

Rangi42 commented Feb 14, 2021

I'm sure this could use some more test cases and inspection of the logic. Any suggested test cases, e.g. using ALIGN, would be welcome.

@ISSOtm
Copy link
Member

ISSOtm commented Feb 17, 2021

I couldn't come up with additional test cases, so I'll merge this as-is. These are mostly regression tests, anyway, so best effort.

@ISSOtm ISSOtm merged commit 76d6ef8 into gbdev:master Feb 17, 2021
@Rangi42 Rangi42 deleted the load-union branch February 17, 2021 03:03
Rangi42 added a commit to Rangi42/rgbds that referenced this pull request Oct 23, 2024
This was implemented in gbdev#736 but removed after discussion in gbdev#869.

Fixes gbdev#1537
@Rangi42 Rangi42 mentioned this pull request Oct 23, 2024
Rangi42 added a commit to Rangi42/rgbds that referenced this pull request Oct 23, 2024
This was implemented in gbdev#736 but removed after discussion in gbdev#869.

Fixes gbdev#1537
Rangi42 added a commit to Rangi42/rgbds that referenced this pull request Oct 23, 2024
This was implemented in gbdev#736 but removed after discussion in gbdev#869.

Fixes gbdev#1537
Rangi42 added a commit to Rangi42/rgbds that referenced this pull request Oct 23, 2024
This was implemented in gbdev#736 but removed after discussion in gbdev#869.

Fixes gbdev#1537
Rangi42 added a commit to Rangi42/rgbds that referenced this pull request Oct 23, 2024
This was implemented in gbdev#736 but removed after discussion in gbdev#869.

Fixes gbdev#1537
Rangi42 added a commit to Rangi42/rgbds that referenced this pull request Oct 24, 2024
This was implemented in gbdev#736 but removed after discussion in gbdev#869.

Fixes gbdev#1537
Rangi42 added a commit that referenced this pull request Oct 24, 2024
This was implemented in #736 but removed after discussion in #869.

Fixes #1537
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Overlays via LOAD UNION
2 participants