gbdev / hardware.inc

RGBDS include file for Game Boy hardware definitions
Creative Commons Zero v1.0 Universal
115 stars 21 forks source link

BG tile addressing mode constant name change request #34

Closed zlago closed 1 year ago

zlago commented 1 year ago

Having both LCDCF_BG8800/LCDCF_BG8000 and LCDCF_BG9800/LCDCF_BG9C00 have BG in the name can be a little confusing.

LCDCF_BG8800 being named after the first tile in address order instead of the first tile in index order seems a little counterintuitive, wouldn't it be better if LCDCF_BG8000/LCDCF_BG8800 got renamed to LCDCF_TILE8000/LCDCF_TILE9000?

ISSOtm commented 1 year ago

I agree that the similar naming is confusing, and also that 9000 is a better "base address". (Those are two separate things, imo.)

My only nitpick is that renaming the BG part to TILE loses the fact that this change only affects BG/WIN tiles, and not OBJ (OTOH, the current name fails to convey that WIN is affected by that bit, so it's not strictly a loss.) I can't come up with a better alternative, though.

(I reformatted your message for readability, hope you won't mind.)

pinobatch commented 1 year ago

In the header that I had used before I switched to hardware.inc, I had named them something like LCDCF_CHR21 and LCDCF_CHR01, based on a conception of $8000-$97FF as three "banks" (NES term) or "character base blocks" (GBA term), each 2 KiB (128 characters) in size. Then I had _CHRRAM0 = $8000, _CHRRAM1 = $8800, and _CHRRAM2 = $9000. Under this terminology, sprites use blocks 0 and 1 always, and the background and window can either use either blocks 0 and 1 or blocks 2 and 1.

Or would that only confuse things for people who have never worked with NES-style video memory bank switching?

ISSOtm commented 1 year ago

Yeah, the term "CHR" is very much absent in the GB dev scene. (It has a few remnants here and there, but it tends not to be used in much documentation or code.) I considered suggesting it, but given that, I chose not to.

TILE01 and TILE21 may work, though. Pan Docs does mention "tile blocks", after all. Maybe BLK01 and BLK21 would convey this better?

evie-calico commented 1 year ago

If you're going with the 01/21 approach, the original BG would work just fine

ISSOtm commented 1 year ago

Except that it fails to convey that the window is also affected.

evie-calico commented 1 year ago

What about rBGP then?

ISSOtm commented 1 year ago

Fair enough, but I think that e.g. BLK01 conveys better what the two digits are.