Hi good afternoon.
a challenge for basic.
I have 255 r-g-b colors in a text file
The file is 255x3 colors, i.e. 765.
the values are simply one after the other:
0 0 0 240 240 240 0 0 128.....
how can you read the text file into basic and then convert it to pal and save it as x16.pal ?
how can you convert it so that you can see the 255 colors as
pal can read into the x16
Thanks.
greeting
255 x r-g-b
----------------
0 0 0
240 240 240
0 0 128
224 240 160
192 64 192
80 192 0
160 0 0
112 224 224
80 128 208
0 64 96
112 112 240
48 48 48
112 112 112
96 240 160
240 128 0
176 176 176
0 0 0
16 16 16
32 32 32
48 48 48
64 64 64
80 80 80
96 96 96
112 112 112
128 128 128
144 144 144
160 160 160
176 176 176
192 192 192
208 208 208
224 224 224
240 240 240
16 16 32
48 48 64
64 64 96
96 96 128
128 128 160
144 144 192
176 176 240
16 16 32
32 32 64
48 48 96
64 64 128
80 80 160
96 96 192
112 112 240
0 0 32
16 16 64
16 16 96
32 32 128
32 32 160
48 48 192
48 48 240
0 0 32
0 0 64
0 0 96
0 0 128
0 0 160
0 0 192
0 0 240
16 32 32
48 64 64
64 96 96
96 128 128
128 160 160
144 192 192
176 224 240
16 16 32
32 48 64
48 80 96
64 112 128
80 144 160
96 176 192
112 208 240
0 16 32
16 48 64
16 80 96
32 96 128
32 128 160
48 160 192
48 192 240
0 16 32
0 48 64
0 64 96
0 96 128
0 128 160
0 144 192
0 176 240
16 32 16
48 64 48
64 96 80
96 128 112
128 160 144
144 192 176
176 240 208
16 32 16
32 64 48
48 96 64
64 128 96
80 160 128
96 192 144
112 240 176
0 32 16
16 64 32
16 96 64
32 128 80
32 160 96
48 192 128
48 240 144
0 32 16
0 64 32
0 96 48
0 128 64
0 160 80
0 192 96
0 240 112
16 32 16
48 64 48
80 96 64
96 128 96
128 160 128
160 192 144
192 240 176
16 32 16
32 64 32
64 96 48
80 128 64
96 160 80
128 192 96
144 240 112
0 32 0
16 64 16
32 96 16
48 128 32
64 160 32
80 192 48
96 240 48
0 32 0
16 64 0
16 96 0
32 128 0
32 160 0
48 192 0
48 240 0
32 32 16
64 64 48
96 96 64
128 128 96
160 160 128
192 192 144
240 240 176
32 32 16
64 64 32
96 96 48
128 128 64
160 160 80
192 192 96
240 240 112
32 32 0
64 64 16
96 96 16
128 128 32
160 160 32
192 192 48
240 240 48
32 32 0
64 64 0
96 96 0
128 128 0
160 160 0
192 192 0
240 240 0
32 16 16
64 48 48
96 80 64
128 96 96
160 128 128
192 160 144
240 192 176
32 16 16
64 32 32
96 64 48
128 80 64
160 96 80
192 128 96
240 144 112
32 0 0
64 16 16
96 32 16
128 48 32
160 64 32
192 80 48
240 96 48
32 0 0
64 16 0
96 16 0
128 32 0
160 32 0
192 48 0
240 48 0
32 16 16
64 48 48
96 64 80
128 96 112
160 128 144
192 144 176
240 176 208
32 16 16
64 32 48
96 48 64
128 64 96
160 80 128
192 96 144
240 112 176
32 0 16
64 16 32
96 16 64
128 32 80
160 32 96
192 48 128
240 48 144
32 0 16
64 0 32
96 0 48
128 0 64
160 0 8
192 0 96
240 0 112
32 16 32
64 48 64
96 64 96
128 96 128
160 128 160
192 144 192
224 176 240
16 16 32
48 32 64
80 48 96
112 64 128
144 80 160
176 96 192
208 112 240
16 0 32
48 16 64
80 16 96
96 32 128
128 32 160
160 48 192
192 48 240
16 0 2
48 0 64
64 0 96
96 0 128
128 0 160
144 0 192
176 0 240
--------------------
Convert r-g-b to pal for the x16
- ahenry3068
- Posts: 1146
- Joined: Tue Apr 04, 2023 9:57 pm
Re: Convert r-g-b to pal for the x16
First your going to have to put comma's between them all. Then you have to Divide each value by 16 and round them off to ints (So all must be between 0 - 15) our palette is 12 bit.
This code isn't doing exactly the same thing but it may give you ideas, It's doing something similiar.
viewtopic.php?t=6929
This code isn't doing exactly the same thing but it may give you ideas, It's doing something similiar.
viewtopic.php?t=6929
- ahenry3068
- Posts: 1146
- Joined: Tue Apr 04, 2023 9:57 pm
Re: Convert r-g-b to pal for the x16
If you haven't figured it out by this Thursday I'll write it for you and give you a Binary Pal file to load.
Re: Convert r-g-b to pal for the x16
I have my R-G-B palette from the forum here, which I have put here. Now I don't know which one is the right one?
what kind of palette is that in the picture?
Is there an R-G-B sample program for this please?
I haven't found a program for the x16 yet that converts r-g-b into pal for loading into the x16.
I can write the program myself if you can give me the exact formula for it. there must be 255 colors for the file.
I also play with purebasic, so I can process it there.
Thanks.
greeting
what kind of palette is that in the picture?
Is there an R-G-B sample program for this please?
I haven't found a program for the x16 yet that converts r-g-b into pal for loading into the x16.
I can write the program myself if you can give me the exact formula for it. there must be 255 colors for the file.
I also play with purebasic, so I can process it there.
Thanks.
greeting
- Attachments
-
- Bild22.jpg (46.8 KiB) Viewed 1535 times
Re: Convert r-g-b to pal for the x16
This file has an error when starting.
I loaded it with basload.
Thanks.
greeting
viewtopic.php?t=6929
I loaded it with basload.
Thanks.
greeting
viewtopic.php?t=6929
- Attachments
-
- color.jpg (14.58 KiB) Viewed 1532 times
- ahenry3068
- Posts: 1146
- Joined: Tue Apr 04, 2023 9:57 pm
Re: Convert r-g-b to pal for the x16
PALENTRY = $FA00 + (COLOR-INDX*2) CX16-R = INT((RGB-R / 16) + .5) CX16-G = INT((RGB-G / 16) + .5) CX16-B = INT((RGB-B / 16) + .5) GB = (CX16-G*16) + B VPOKE 1, PALENTRY ,GB VPOKE 1, PALENTRY+1, CX16-Rfunkheld wrote: ↑Mon Mar 18, 2024 7:52 am I have my R-G-B palette from the forum here, which I have put here. Now I don't know which one is the right one?
what kind of palette is that in the picture?
Is there an R-G-B sample program for this please?
I haven't found a program for the x16 yet that converts r-g-b into pal for loading into the x16.
I can write the program myself if you can give me the exact formula for it. there must be 255 colors for the file.
I also play with purebasic, so I can process it there.
Thanks.
greeting
- ahenry3068
- Posts: 1146
- Joined: Tue Apr 04, 2023 9:57 pm
Re: Convert r-g-b to pal for the x16
There's both BASLOAD source and a Tokenized file there. Tokenized file you load with load. Also I think I did this one with the RAM Basload. There are subtle differences between the RAM version and the ROM version. I'll check my code there later.
Re: Convert r-g-b to pal for the x16
The rom version is now in x16.
I think it's better if you use the built-in x16 because it is always adapted to the respective basload.
thanks
greeting.
I think it's better if you use the built-in x16 because it is always adapted to the respective basload.
thanks
greeting.
- Attachments
-
- x16basload.jpg (14.38 KiB) Viewed 1509 times
Re: Convert r-g-b to pal for the x16
Hello, thanks for the help.
where did this RGB come from please?
my RGB :
255 x r-g-b
----------------
0 0 0
240 240 240
0 0 128
224 240 160
192 64 192
80 192 0
0 0 0
240 240 240
0 0 128
224 240 160
192 64 192
80 192 0
--------------------------------------------
my data :
CX16-R = INT((RGB-R / 16) + .5)
CX16-G = INT((RGB-G / 16) + .5)
CX16-B = INT((RGB-B / 16) + .5)
GB = (CX16-G*16) + B
CX16-R
could I then write in like this? :
$FA00 = GB
SFA00+1=CX16-R
SFA00+2= GB
$FA00+3=CX16
.....
...
where did this RGB come from please?
my RGB :
255 x r-g-b
----------------
0 0 0
240 240 240
0 0 128
224 240 160
192 64 192
80 192 0
0 0 0
240 240 240
0 0 128
224 240 160
192 64 192
80 192 0
--------------------------------------------
my data :
CX16-R = INT((RGB-R / 16) + .5)
CX16-G = INT((RGB-G / 16) + .5)
CX16-B = INT((RGB-B / 16) + .5)
GB = (CX16-G*16) + B
CX16-R
could I then write in like this? :
$FA00 = GB
SFA00+1=CX16-R
SFA00+2= GB
$FA00+3=CX16
.....
...
Last edited by funkheld on Mon Mar 18, 2024 11:33 am, edited 5 times in total.
- ahenry3068
- Posts: 1146
- Joined: Tue Apr 04, 2023 9:57 pm
Re: Convert r-g-b to pal for the x16
When I wrote that ROM BASLOAD was not yet available.
As to your other question. I wrote that code fresh as an example for you.