Tile ID flags
The format to specify the picture for every tile in a tilemap (plane A, B or window) and the initial tile in every sprite is the same. Bits 10-0 are the tile number (from 0 to 2047) while the other bits apply special effects:
- Bit 11: flip the picture horizontally
- Bit 12: flip the picture vertically
- Bits 14-13: pick one of the four palettes (0 to 3)
- Bit 15: pick layer priority (0 = low, 1 = high)
For the tilemaps the effects are applied per tile, while for sprites the effects are applied to the whole sprite (e.g. flipping horizontally will flip the entire sprite).
For convenience here are some asm labels that can be OR'd with the tile ID:
NOFLIP: equ $0000 ; Don't flip (default)
HFLIP: equ $0800 ; Flip horizontally
VFLIP: equ $1000 ; Flip vertically
HVFLIP: equ $1800 ; Flip both ways (180° flip)
PAL0: equ $0000 ; Use palette 0 (default)
PAL1: equ $2000 ; Use palette 1
PAL2: equ $4000 ; Use palette 2
PAL3: equ $6000 ; Use palette 3
LOPRI: equ $0000 ; Low priority (default)
HIPRI: equ $8000 ; High priority