Fordi / P2PPU

A NES-like Picture Processing Unit for the Pixel 2.0 by Rabid Prototypes
https://www.kickstarter.com/projects/rabidprototypes/pixel-20-the-arduino-compatible-smart-display
0 stars 0 forks source link

[Hands-off] Swap bitmask for tile/palette reference #7

Closed Fordi closed 7 years ago

Fordi commented 7 years ago

At present, the high 11 bits of a tile/palette reference are the tile, and the low 5 are the palette. Given that most of my dev work is being spent in Palette 0, this makes it so that maps (e.g., arrays of tile/palette reference data) are non-obvious when they needn't be. That is:

{
    ....
    { ... 0x0020, 0x01E0, 0x0060, 0x0460 ... }
    ....
}

It's not obvious which tiles are being referenced, but written the other way:

{
    ....
    { ... 0x0001, 0x000F, 0x0003, 0x0023 ... }
    ....
}

The indices are clear. Even if you go to another palette, at least the first 256 tiles in the table are obvious at all times. In Palette 1:

{
    ....
    { ... 0x0801, 0x080F, 0x0803, 0x0823 ... }
    ....
}