User Defined Palletes
- Sarasaworks
- Posts: 16
- Joined: Fri Jul 05, 2024 9:47 am
User Defined Palletes
I am playing with tiles and sprites at the moment, but where I am struggling is defining a set of palettes. I saw a small section on palettes in the VERA docs. It shows how the colors are defined, but not how to compile those colors into usable/swappable 16 color palettes that can be sent to VRAM. Is this even possible or am confined to a collection of defaults?
"I mean... You'd be pretty disappointed too if you came all this way and the princess was in another castle... All those turtles and whatnot!"
--Scout Sarasa
--Scout Sarasa
- ahenry3068
- Posts: 1133
- Joined: Tue Apr 04, 2023 9:57 pm
Re: User Defined Palletes
This probably isn't everything you want. But it should give you some ideasSarasaworks wrote: ↑Sun Jul 07, 2024 3:51 am I am playing with tiles and sprites at the moment, but where I am struggling is defining a set of palettes. I saw a small section on palettes in the VERA docs. It shows how the colors are defined, but not how to compile those colors into usable/swappable 16 color palettes that can be sent to VRAM. Is this even possible or am confined to a collection of defaults?
viewtopic.php?t=6793
- Attachments
-
- PALEDITORB.BAS
- (27.57 KiB) Downloaded 65 times
-
- PALEDITOR.PRG
- (16.15 KiB) Downloaded 63 times
-
- DPAL.BIN
- (512 Bytes) Downloaded 69 times
- Sarasaworks
- Posts: 16
- Joined: Fri Jul 05, 2024 9:47 am
Re: User Defined Palletes
I just know that defining palettes on the NES is as simple as:
I'll look at the BASIC file in a bit. Don't have a reader on my phone.
P0: .byte $00, $03, $42, $D3 P1: .byte $00, $01, $02, $03And then sending them to the proper PPU address... Was looking for something similar.
I'll look at the BASIC file in a bit. Don't have a reader on my phone.
Last edited by Sarasaworks on Sun Jul 07, 2024 7:46 am, edited 1 time in total.
"I mean... You'd be pretty disappointed too if you came all this way and the princess was in another castle... All those turtles and whatnot!"
--Scout Sarasa
--Scout Sarasa
- Sarasaworks
- Posts: 16
- Joined: Fri Jul 05, 2024 9:47 am
Re: User Defined Palletes
So, after a few videos and deciphering how to manipulate VERA and VRAM, this was my conclusion:
stz $9f25 ; Select VRAM Data Bus Zero lda #$00 ; Low Byte, 17bit VRAM address ($1FA00) sta $9f20 lda #$fa ; Mid Byte, 17bit VRAM address sta $9f21 lda #$11 ; High Bit, 17bit VRAM address + 1 byte stride sta $9f22 ldx #$00 loop: cpx #$20 beq exit lda pal0,x sta $9f23 ; Send palette Data to VRAM Data Bus Zero inx jmp loop exit: rts pal0: .byte $00,$00 ; Transparent .byte $ff,$0f ; White .byte $fd,$0a ; Flesh Tones .byte $fc,$08 .byte $ea,$08 .byte $d8,$06 .byte $41,$00 ; Brown .byte $6b,$0f ; Blues .byte $53,$0f .byte $13,$0f .byte $dc,$05 ; Yellows .byte $a8,$04 .byte $dd,$0d ; Grayscale .byte $bb,$0b .byte $66,$06 .byte $00,$00 ; Black
Last edited by Sarasaworks on Tue Jul 09, 2024 8:40 pm, edited 4 times in total.
"I mean... You'd be pretty disappointed too if you came all this way and the princess was in another castle... All those turtles and whatnot!"
--Scout Sarasa
--Scout Sarasa
-
- Posts: 503
- Joined: Sat Jul 11, 2020 3:30 pm
Re: User Defined Palletes
That two byte stride should be one byte. You need to push two bytes (ggggbbbb 0000rrrr) for a single palette entry.
- Sarasaworks
- Posts: 16
- Joined: Fri Jul 05, 2024 9:47 am
Re: User Defined Palletes
Good call! Thanks! I edited my code accordinglyEd Minchau wrote: ↑Tue Jul 09, 2024 6:19 pm That two byte stride should be one byte. You need to push two bytes (ggggbbbb 0000rrrr) for a single palette entry.
Last edited by Sarasaworks on Tue Jul 09, 2024 8:47 pm, edited 1 time in total.
"I mean... You'd be pretty disappointed too if you came all this way and the princess was in another castle... All those turtles and whatnot!"
--Scout Sarasa
--Scout Sarasa