Editing palettes via SPASM can be a bit tricky and hard to do... but I'll try to explain it as easier as I can:
The key point is the RAM address $702000, which is where the palette mirror is stored, finishing at $7021EF. You will need a way to divide/multiply hex numbers and to see SNES RGB Values too.
By every two-bytes of the latest 3 numbers ($702000
, etc.., until $7021EF
) there is a color stored, which is multiplied by 2. For example, $702022
is the Palette Number 11 ($22/2 = $11), $7021AA
is the Palette Number D5 ($1AA/2 = $D5), etc.. (you can see the palette numbers via GoldenEgg).
The usage is very simple:
LDA #$XXXX ; SNES RGB Value
STA $702XXX ; Pointer to the color's mirror
You should put this in level_init_code.asm, and remeber to always finish with RTS.
As an actual example: changing the colors of the object 63 the brown platform (which uses colors 18, 19, 1A and 1B), to blue. The code should be like this:
STA $702030 ; $30/2 = $18
STA $702032 ; $32/2 = $19
STA $702034 ; $34/2 = $1A
STA $702036 ; $36/2 = $1B
(the RBG values are the ones of colors 38, 39, 3A and 3B, which I used for the example)
Saving level_init_code.asm and patching level.asm to our rom will do the changes:
BG1 palettes are stored in: colors 1C to 1F, 2C to 2F, 3C to 3F, 43 to 4F and 53 to 5F, while BG2 palettes are stored in: colors 61 to 6F and 71 to 7F (though you usually won't have to edit all of them, that entirely depends of the chosen tileset you want to edit).
I hope you understand, don't hesitate to post any doubt you have.