Discussion

A possible usage for the unused bits in the cell attributes

1

SP4CEBAR 2021-03-08 14:56 (Edited)

According to the in-app code reference, bits six and seven from the attributes of a cell of a background are unused.
A possible usage for them would be rotation or diagonal flipping* of characters.
*diagonal flipping can be used to rotate a character.


Reference:

BG Data

A background is a map of 32x32 character cells. Each cell occupies two bytes:

- Character number
- Attributes:
Bit Purpose
0-2 Palette number
3 Flip X
4 Flip Y
5 Priority
6-7 Unused


Timo 2021-03-08 17:35

But these bits are used for sprites (size).


was8bit 2021-03-08 18:58 (Edited)

How do sprites access and use background data ??


was8bit 2021-03-08 19:02

SPRITES...
$FE00 - Sprite Registers (256 B)

Sprite Registers

There are 64 sprites available, each occupies 4 bytes:

- X position
- Y position
- Character number
- Attributes:
Bit Purpose
0-2 Palette number
3 Flip X
4 Flip Y
5 Priority
6-7 Size:
0: 1 character (8x8 px)
1: 2x2 characters (16x16 px)
2: 3x3 characters (24x24 px)
3: 4x4 characters (32x32 px)

BACKGROUNDS
$9000 - BG0 Data (2 KB)
$9800 - BG1 Data (2 KB)

BG Data

A background is a map of 32x32 character cells. Each cell occupies two bytes:

- Character number
- Attributes:
Bit Purpose
0-2 Palette number
3 Flip X
4 Flip Y
5 Priority
6-7 Unused


was8bit 2021-03-08 19:05 (Edited)

Each cell of the background uses 2 bytes... first byte is the cell charactwr number, second byte is the cell register...

Of the cell register, the last 2 bits are not currently in use... so they should available for SPIN 00=no spin, 01=one spin, 10=two spins, 11=3 spins...


Timo 2021-03-08 19:20

I mean I prefer not to have different meanings for cell and sprite attributes. Of course size doesn't make sense for individual cells, that's why it's unused.
Actually I think rotation would make more sense for sprites than for cells, so that wouldn't be even possible without bigger changes.
Interestingly none of the classic game consoles had build-in rotation for sprites, only flipping. I guess because rotation is more difficult to implement in hardware. Flipping is very simple.


was8bit 2021-03-08 20:02

Ah...

Well, i like the idea of unused bites... it tempts me to use them ;)


was8bit 2021-03-08 20:16

For me, i would only be able to usefully use the unused bits for games where i didnt use sprites or arrays, keeping all data in the backgrounds... repurposing FLIP, i discovered, is only possible if the image is a perfect circle and radially symmetric... i had tried using both FLIPS to indicate direction of movement... manipulating images to match direction as indicated with the FLIP settings was abit tedious... had to keep swapping images...

so the image itself has only the last 3 bits that may be freely reusable ... and if i use only BG 0 for visible game, hiding BG 1, then use BG1 for additional data for the object above, i open up 8 more bits... for a total of 11 bits of data to store an object status...

This idea still captures my imagination... free from traditional arrays, and all data easily stored into PERSIST and easily restored back into background memory... should be good for a colony game ... i will get one made some day :)


Log in to reply.