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

Improve allocation of VRAM/PAL/OAM buffers #222

Merged
merged 2 commits into from
Sep 30, 2023

Conversation

cogwheel
Copy link
Contributor

@cogwheel cogwheel commented Sep 25, 2023

Fixes #215:

  • Use weak symbols
  • Move PAL_BUF out of hardware stack

@cogwheel cogwheel marked this pull request as draft September 25, 2023 15:02
@cogwheel
Copy link
Contributor Author

Hmm this works with 26_Full_Game but not 21_Sprite_Zero.

@cogwheel cogwheel marked this pull request as ready for review September 25, 2023 15:46
@cogwheel
Copy link
Contributor Author

Regarding b5d3522 I'm curious about the reasoning for __post_vram_update. Is there ever a time the buffer shouldn't be cleared and the counter reset after writing it to vram?

@cogwheel cogwheel marked this pull request as draft September 26, 2023 17:07
@cogwheel cogwheel marked this pull request as ready for review September 26, 2023 17:12
@mysterymath
Copy link
Member

Regarding b5d3522 I'm curious about the reasoning for __post_vram_update. Is there ever a time the buffer shouldn't be cleared and the counter reset after writing it to vram?

IIRC it was just that VRAM_BUF is a nesdoug addition to neslib, and it shouldn't trigger unless nesdoug is used.

@cogwheel cogwheel marked this pull request as draft September 27, 2023 20:47
@cogwheel cogwheel force-pushed the cog/weak-buffers branch 2 times, most recently from 49e92e6 to 06b2d88 Compare September 27, 2023 22:12
@cogwheel cogwheel marked this pull request as ready for review September 27, 2023 22:15
Fixes llvm-mos#215:
  - Use weak symbols
  - Move PAL_BUF out of hardware stack
  - Split multi_vram* ops from the definition of the buffer
@@ -6,8 +6,9 @@
.section .noinit.vram_buf,"aw",@nobits
.globl VRAM_BUF
.balign 128
.weak
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't do anything; the syntax is .weak <names>. So, this should be .weak VRAM_BUF.

Copy link
Contributor Author

@cogwheel cogwheel Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh hm... apparently .weak does the job of .globl too. Fixed (tested both with some nesdoug projects using the default and my own project overriding it).

@mysterymath mysterymath merged commit e44cf72 into llvm-mos:main Sep 30, 2023
@cogwheel cogwheel deleted the cog/weak-buffers branch September 30, 2023 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide linker-configured PAL_BUF for neslib/nesdoug
2 participants