Working with Colours
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:
hex ff0000 ;red
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
aligndirective. This forces the following data to begin at that specific address in memory, making it easy to point the
org $500 ; or align $500
COLORSregister 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
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.
; draw once to screen
; optional styling to
; fill the top few lines
; set palette values
hex 000000 ff0000 00ff00 0000ff