Skip to content

Add more VRAM constants - #85

Merged
Rangi42 merged 2 commits into
gbdev:masterfrom
ISSOtm:vram-constants
Aug 7, 2026
Merged

Add more VRAM constants#85
Rangi42 merged 2 commits into
gbdev:masterfrom
ISSOtm:vram-constants

Conversation

@ISSOtm

@ISSOtm ISSOtm commented Apr 28, 2026

Copy link
Copy Markdown
Member

Tile block addresses as per the consensus thus far in #84, and also some attrmap addresses because I remember being confused as to their locations, and I think that:

SECTION "...", VRAM[ATTRMAP0],BANK[1] ; ...is more intuitive than...
SECTION "...", VRAM[TILEMAP0],BANK[1]

...and we already have some “spatially redundant but semantically distinct” duplicates anyway.

(Resolves #84.)

@avivace

avivace commented Apr 28, 2026

Copy link
Copy Markdown
Member

I'd suggest picking up the conversation from #18 and challenge e.g. #18 (comment) which summed it up why at the time we were removing those.

Also, not strictly related, but please don't use ...and we already have some “spatially redundant but semantically distinct” duplicates anyway. as an argument to this. The existence of prior exceptions doesn't create a general license. Those may have been ad-hoc exceptions, things that are just waiting to be worked on, or simply... debt (and we don't want debt, let alone self-reinforcing debt)

@Rangi42

Rangi42 commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator

@avivace Re: the conversation in #18, I addressed that in the issue #84 discussion. (I wasn't expecting a PR to exist this soon.)

Re: the unrelated ATTRMAP0-1 constants this PR invented, I think they're consistent with how we've been doing things lately.

We've already cleaned up almost all "debt" by moving old constants to hardware_compat.inc or removing them entirely. (And the remaining debt, postponed for v6.0, has been small oversights like #64, not any constants we still want to remove.)

The "spatially redundant but semantically distinct" constants we still have are recent ones:

  • JOYP_START vs JOYP_DOWN (two different uses of the same bit, controlled by JOYP_GET)
  • AUD1LEN_DUTY vs AUD2LEN_DUTY (two different registers with identical bit patterns)
  • LCDC_BG vs LCDC_PRIO (bit meaning changes in DMG vs CGB)
  • rBMODE vs rRTCLATCH (address meaning changes in MBC1 vs MBC3)
  • BG_YFLIP vs OAM_YFLIP (two different entities with identical bit patterns)
  • TILE_WIDTH vs TILE_HEIGHT (tiles are 8x8px, and I originally argued in favor of one constant for the side length, but it was agreed that these two names made more sense)
  • etc

My impression is that by now these aren't "ad-hoc exceptions", but are our accepted standard method for how to deal with semantic ambiguity. (It's basically the same principle as having two constants B_LCDC_BLOCKS and B_IE_JOYPAD for the same number 4.)

@Rangi42
Rangi42 requested a review from avivace August 4, 2026 16:48
Comment thread hardware.inc
Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com>
@ISSOtm

ISSOtm commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

Merging this PR due to lack of negative feedback in the last three months, and positive demand (#84 (comment)).

@Rangi42

Rangi42 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Merging this PR due to lack of negative feedback in the last three months, and positive demand.

The last commit to this PR was just today (the TILES_PER_BLOCK constant).

I approve of it as-is, and am waiting for @avivace to review this and the other recent PRs.

@Rangi42
Rangi42 merged commit 46158fc into gbdev:master Aug 7, 2026
1 of 2 checks passed
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.

Add constants for the three VRAM tile "blocks"

3 participants