Page 1 of 1

how does it work based on the palette offset at 16 colors

Posted: Fri Mar 22, 2024 7:55 am
by funkheld
Hi good afternoon.

what is the offset?
how/where does the palette offset have to be written in basic for sprites 16 color?
I don't really understand that.

where are the palettes for 16 color written?
I also have to use my palette from the system.

--------------------------
BVLOAD "SPRITE.BIN",8,1,$3000 >>>>> 64x64
BVLOAD "FUNKPAL.PAL",8,1,$fa00) ; 256 color for the system
BVLOAD "SPR.PAL",8,1,($fa00.....) >>>>>>>>> 16 color for the sprite ???

SPRMEM 1,1,$3000,0
SPRITE 1,3,0,0,3,3 >>>>> ?
MOVSPR 1,320,200
------------------------

Thanks.
greeting

------------------------
palette offset is the palette offset for the sprite. Range is 0-15 inclusive. This value is multiplied by 16 to determine the starting palette index.
-----------------------

Re: how does it work based on the palette offset at 16 colors

Posted: Fri Mar 22, 2024 10:30 am
by ahenry3068
There is only 1 palette. The Palette for a 16 color sprite is an Offset into the 256 color hardware palette.

Re: how does it work based on the palette offset at 16 colors

Posted: Fri Mar 22, 2024 11:19 am
by funkheld
hello, thanks for info.

greeting.

Re: how does it work based on the palette offset at 16 colors

Posted: Fri Mar 22, 2024 11:39 am
by funkheld
Hi good afternoon.

With the red background, the funkpal.pal from the demo program where my code was taken is not correct. So are there other system colors?

The sprites are fine in terms of color.

If I then want to have the system pal, then
Do I have to save it first?

BSAVE "SYSTEM.PAL",8,1,$FA00,$FA00 + 255 ?
why don't all colors appear?

Thanks.
greeting


this no funkpal.pal :
----------------------------------------
BVLOAD "pebispr641.bin",8,1,$3000
BVLOAD "spr641.pal",8,1,($fa00 + (16*2))

SPRMEM 1,1,$3000,0
SPRITE 1,3,1,0,3,3,0
MOVSPR 1,320,200
-----------------------------------------


this with funkpal.pal :
-----------------------------------------
BVLOAD "pebispr641.bin",8,1,$3000
BVLOAD "funkpal.pal",8,1,$fa00)
BVLOAD "spr641.pal",8,1,($fa00 + (16*2))

SPRMEM 1,1,$3000,0
SPRITE 1,3,1,0,3,3,0
MOVSPR 1,320,200
-----------------------------------------

Re: how does it work based on the palette offset at 16 colors

Posted: Fri Mar 22, 2024 12:03 pm
by ahenry3068
funkheld wrote: Fri Mar 22, 2024 11:39 am Hi good afternoon.

With the red background, the funkpal.pal from the demo program where my code was taken is not correct. So are there other system colors?

The sprites are fine in terms of color.

If I then want to have the system pal, then
Do I have to save it first?

BSAVE "SYSTEM.PAL",8,1,$FA00,$FA00 + 255 ?

Thanks.
greeting


this no funkpal.pal :
----------------------------------------
BVLOAD "pebispr641.bin",8,1,$3000
BVLOAD "spr641.pal",8,1,($fa00 + (16*2))

SPRMEM 1,1,$3000,0
SPRITE 1,3,1,0,3,3,0
MOVSPR 1,320,200
-----------------------------------------


this with funkpal.pal :
-----------------------------------------
BVLOAD "pebispr641.bin",8,1,$3000
BVLOAD "funkpal.pal",8,1,$fa00)
BVLOAD "spr641.pal",8,1,($fa00 + (16*2))

SPRMEM 1,1,$3000,0
SPRITE 1,3,1,0,3,3,0
MOVSPR 1,320,200
-----------------------------------------
Saving the system Palette that way won't work. BSAVE doesn't work on Video Ram. After you change the Palette you do need to restore it to use it. THERE IS ONLY 1 HARDWARE PALETTE. Whatever is loaded in the HARDWARE PALETTE is used by whatever image is on the screen. For 8 bit images the entire palette is used. For 16 color (4 bit) sprites an OFFSET into the HARDWARE PALETTE tells it where the 16 Colors START. I'm attaching a DPAL.PAL here. It is a binary image of the default VERA palette.

HERE'S THE DEFAULT PALETTE IMAGE (zipped)
DPAL.PAL.zip
(609 Bytes) Downloaded 87 times

Re: how does it work based on the palette offset at 16 colors

Posted: Fri Mar 22, 2024 12:35 pm
by funkheld
hello, thanks for the pal.
is an interesting story.

I have to understand the whole x16 system first.
takes longer for me. :roll:

Thanks.
greeting

Re: how does it work based on the palette offset at 16 colors

Posted: Fri Mar 22, 2024 3:16 pm
by hstubbs3
Guess I'll put this here, seems should be topical here.

https://github.com/hstubbs3/CommanderX1 ... png_to_bin

I had just made changes to the Python code so it takes in the RGBA PNG file and then attempts to find best colors in _each_ of the 16 palette offsets ...

will have to update the GIT with some documentation later.. but for now .. as example -

first on the host - prepped my BIN file for the graphics data ( is 32 64x64 sprites at 16 colors = 64KB !)

Code: Select all

python3 png_to_bin_perceptual_4bit.py spider_128x64.png spider_128x64_4bit_perc.inc
python3 inc_to_bin.py spider_128x64_4bit_perc.inc SPIDERS.BIN
then wrote a bas file so could do exec

so in the x16 -
BVLOAD "SPIDERS.BIN",8,0,$0000
BLOAD "SPIDERS.BAS",8,1,$8000
EXEC $8000

have no clue what the errors are but hey mostly works..

Image