What is the typical way if I want to write the color attribute values into the PPU in a vertical way (for example when I have horizontal scrolling)?
For tiles, I can set bit 2 of PPUCTRL if I want to write tiles vertically, so it increments the PPU address by 32 after each write.
But is there also a good way to do this for attributes, incrementing by 8 for each write, or using some trick? Or do I indeed have to re-initialize the two address bytes manually for each write?
Drawing attributes vertically
Moderator: Moderators
Drawing attributes vertically
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
Re: Drawing attributes vertically
No trick, have to set the addr every byte. Or just write the full 64 bytes in one go.
Re: Drawing attributes vertically
Either set the address every write, or use 32 increment mode just to get two writes in.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Re: Drawing attributes vertically
Alright, thanks. Looks like there's no way around it then.
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
Re: Drawing attributes vertically
What I normally do for attributes is use increment 32 mode and write pairs of attribute bytes. Since 32 is equivalent to 4 attribute rows, the pairs are: 0 and 4, 1 and 5, 2 and 6, 3 and 7. If I'm scrolling vertically and the screen is between name tables, I don't bother with with partial updates, I just update all 16 bytes of the column (if using horizontal mirroring or 4-screen, otherwise it'll just be 8 bytes anyway) even though only some of them are visible. Updating all 16 bytes in pairs is faster than 9 bytes in ones.
Last edited by tokumaru on Mon Mar 07, 2022 1:53 pm, edited 1 time in total.
Re: Drawing attributes vertically
I would keep a copy of the entire attribute tables in RAM, it makes it much simpler when you want to update them in VRAM.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!
Re: Drawing attributes vertically
That's a pretty good idea. Reduces half of the initialization data.
That's the one thing I want to avoid in my current constellation. That's why I designed meta tiles of 32 x 32 pixels, so that each meta tile has its own attributes value and bit manipulation and wasting 128 bytes in RAM isn't necessary.
My game "City Trouble":
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html
Gameplay video: https://youtu.be/Eee0yurkIW4
Download (ROM, manual, artworks): http://www.denny-r-walter.de/city.html