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

rgblink scramble hides mistakes #1149

Open
zlago opened this issue Jul 18, 2023 · 5 comments
Open

rgblink scramble hides mistakes #1149

zlago opened this issue Jul 18, 2023 · 5 comments
Labels
enhancement Typically new features; lesser priority than bugs rgblink This affects RGBLINK

Comments

@zlago
Copy link

zlago commented Jul 18, 2023

while the scramble flag does serve its purpose of showing when you forget to bankswitch, it introduces two new issues:

  1. it hides alignment mistakes, as sections generally get placed at $4000
  2. it hides mistakes where data is read out of bounds, since all data past a section is usually $ff

possible solutions for each issue:

  1. try to put sections at the end of a bank, or avoid putting sections at $4000 (the former is probably better)
  2. allow for randomising section banks instead of putting each section in its own bank

the second one probably isnt as much of an issue as the first, as its me not testing the non-scrambled build..

@aaaaaa123456789
Copy link
Member

I'd say that a better fix would be to randomize all ROM padding in scramble mode, and to possibly shift sections by a few bytes when there's free space to do so. However, shifting sections would probably require rerunning the linker...

@evie-calico
Copy link
Contributor

That’s the issue I see with this. No matter how it’s implemented, the misalignment would cause fragmentation, which might cause a scrambled build to fail when a normal one wouldn’t.

@ISSOtm
Copy link
Member

ISSOtm commented Jul 24, 2023

The way I see it, allocating sections primarily towards the end of ROMX would help catch OOB accesses there, as then those accesses would tend to fall in VRAM (then it's a die roll as to whether a VRAM access exception is triggered, but better than nothing) or SRAM (which is most often locked).

Additionally, I see no harm in doing thins by default outside of -x mode. (Sure, that would change section order, but this should not be as breaking a change since #136's resolution.)

@evie-calico
Copy link
Contributor

Putting the sections at the end is a really good idea, I didn't consider that.

@zlago
Copy link
Author

zlago commented Jul 29, 2023

i didnt intend on solving both problems.. i only really thought of it as "should be a cheap way to put a section at somewhere other than the start"

@Rangi42 Rangi42 added the rgblink This affects RGBLINK label Aug 8, 2023
@Rangi42 Rangi42 added the enhancement Typically new features; lesser priority than bugs label Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Typically new features; lesser priority than bugs rgblink This affects RGBLINK
Projects
None yet
Development

No branches or pull requests

5 participants