Showing changes from revision #0 to #1:
Added | Removed | Changed
Entry | |
---|---|
- | None |
Exit | |
---|---|
R0 | Pointer to palette → RGB lookup table |
R1 | Pointer to RGB → palette lookup table |
This SWI returns pointers to two lookup tables for converting palette indices to RGB values (via R0) and back again (via R1, the ‘inverse table’)
On exit R0 is a pointer to a 1KB lookup table, with one word per entry, to convert from the current screen palette to a standard 15bpp colour value. I.e. the red component in bits 0-4, green in bits 5-9, and blue in bits 10-14.
R1 will be a pointer to a 32KB lookup table giving the inverse mapping, i.e. converting a 15bpp colour value back to the nearest palette index. In this case each table entry is a byte, giving the resultant palette index.
This SWI only operates in 256 colour screen modes. Any other colour depth will result in a ‘Bad MODE’ error.
The tables pointed to by R0 and R1 are held inside InverseTable’s workspace and should not be modified by the user. The tables will persist until the next mode change, palette change, or change in screen output redirection.
There is practically zero overhead in calling this SWI in situations in which the tables do not need to be recalculated. Therefore it’s recommended that you simply call this SWI to fetch the table pointers as and when needed, rather than attempt to cache the pointers (or the table contents) yourself.
See also InverseTable_SpriteTable, to generate a pair of lookup tables for use with an arbitrary (256 colour) sprite/palette.