This instruction alters the current palette colors for a MegaChip screen mode.
The Palette start color has to be defined as part of the instruction.
02nn - Load Palette starting at color nn from the Image Pointer.
A sample palette can be defined as two hex words:
dw #ff01, #0203
This operation can be setup by incrementing through byte memory using a copy of the Image Pointer.
The Loop would start from nn and run up to 255.
The four bytes can be stored a set of Red, Green and Blue arrays.
The first byte, which is normally 255, can be discarded or could be stored as an alpha transparency value.
If the emulator allows execution of 1802 code, the coding will need to check which mode the machine is in and either process the instruction as a valid MegaChip instruction or as a possible call to ROM code.