Working with Colours
Last updated
Last updated
Minicube64 has a default set of 64 colours, and defining your own custom palette is easy.
Custom colour palettes can be defined in a familiar hex notation like this:
It is recommended to define palette data before any other content such as graphics, but after the main program code.
It is also possible to define multiple palettes and switch to them at any time if needed.
Palettes can also be defined in byte notation if preferred.
Before the palette data we should align the data to a location in memory with the align
or org
directive. This forces the following data to begin at that specific address in memory, making it easy to point the COLORS
register to.
Setting the COLORS
register instructs to set the colour palette from a 256 byte region in memory.
The immediate value we load refers to the high-byte of the desired memory address.
This can be any value from $0300
. For example memory address 0x0500
, we use #$5
Changing palette values will only take effect at the end of the frame.
In this example we set a basic palette of 4 colours and show them at the top of the screen.