Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:34 28 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : colours - colour table - bit per pixel

     Page 1 of 2    
Author Message
hhtg1968
Senior Member

Joined: 25/05/2023
Location: Germany
Posts: 123
Posted: 06:29am 14 Jun 2023
Copy link to clipboard 
Print this post

Hello (perhaps mainly to matherp or geoffg)!

since yesterday i can program on my picomite. many thanks...

a few questions:

1. if i test the colours by typing "colour rgb(...)" (blue, cobalt etc.) i see only 8 colours (every colour twice). is this my mistake? i could send a foto...

2. is there kind of a colour table/ map? i want to access to the colours by a number (0-15) in a game. otherwise i have to create an array with the rgb numbers...

3. in mode 2 there are 4 bits per pixel. does this relate to the speed of the dma/pio or is this an artificial limit? i think it makes not a big differencei if you have a screen memory/ buffer of 38kb or 76kb... 8bit/ 256 coloura would be nice. but i am so happy to have this small machine with (only) 16 colours...

yours hhtg
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2138
Posted: 06:48am 14 Jun 2023
Copy link to clipboard 
Print this post

That is consistent with one of the 4 outputs (GP18 - GP21) not connecting to the VGA socket. If the 8 colours you see match the names it is probably the GreenLow (GP19) that is missing. Check for a bad connection.

To test each pin copy & paste each of these lines to the console:-

CLS RGB(255,0,0) 'red  GP21
CLS RGB(0,0,255) 'blue GP18
CLS RGB(0,64,0) 'dark green GP19
CLS RGB(0,128,0) 'mid green GP20
CLS RGB(0,255,0) 'bright green GP19 and GP20
Edited 2023-06-14 16:50 by phil99
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4247
Posted: 07:07am 14 Jun 2023
Copy link to clipboard 
Print this post

Check your wiring....
There are 4 pico pinns that drive the VGA, check resistor values and wires...


Edited 2023-06-14 17:09 by Volhout
PicomiteVGA PETSCII ROBOTS
 
IanRogers

Senior Member

Joined: 09/12/2022
Location: United Kingdom
Posts: 151
Posted: 07:15am 14 Jun 2023
Copy link to clipboard 
Print this post

I just tested my new set up. version 5.0707  VGA

All 16 are present ( 3 shades of green as per above )
I'd give my left arm to be ambidextrous
 
hhtg1968
Senior Member

Joined: 25/05/2023
Location: Germany
Posts: 123
Posted: 07:56am 14 Jun 2023
Copy link to clipboard 
Print this post

many thanks to you all.

now it works!!!!

i placed the wire for 1/3 green wrong (1 cell). i need glasses but often i do not wear them...

and i am not a hardware specialist, so i had to ask you...
 
IanRogers

Senior Member

Joined: 09/12/2022
Location: United Kingdom
Posts: 151
Posted: 08:30am 14 Jun 2023
Copy link to clipboard 
Print this post

  Quote  i placed the wire for 1/3 green wrong (1 cell). i need glasses but often i do not wear them...


Welcome to our world.. I have about 6 different pairs each for their own focal point.
Driving
Gaming
general use
Electronics 2 pairs one set with built in magnifiers.

You may still have a way to go...
I'd give my left arm to be ambidextrous
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 09:33am 14 Jun 2023
Copy link to clipboard 
Print this post

@ hhtg
There are no "colour numbers" on the PicoMite. If you want them you have to create your own. There are various ways to do this. I usually use an array:

DIM C(5)=(RGB(black),RGB(blue),RGB(myrtle),RGB(cobalt),RGB(midgreen),RGB(cerulean))

or whatever colours I happen to need at the time. Then I just use C(0) instead of typing RGB(black) or RGB(0,0,0)

You can use any of the colours in any order you want, of course. You don't need to set up the array to use them all either. There are cleverer ways to do this, and to stuff the array, but this is all I usually need. It saves a lot of typing too. :)
Edited 2023-06-14 19:53 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
hhtg1968
Senior Member

Joined: 25/05/2023
Location: Germany
Posts: 123
Posted: 10:20am 14 Jun 2023
Copy link to clipboard 
Print this post

thanks.
ok. i use an array but i wanted to know wether it is more easy...

a colour with a "number" has advantages. you can change the colour in a tabel and the change applies for all such collours in the screen.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 11:19am 14 Jun 2023
Copy link to clipboard 
Print this post

That was why I started using an array. Well, that and the typing 'cos I'm lazy and don't touch-type.  :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2138
Posted: 12:36pm 14 Jun 2023
Copy link to clipboard 
Print this post

You could use the 24 bit integer values, though it isn't really practical.
Red     Green   Blue    24 bit value

 0       0       0       0
 0       0       255     255
 0       64      0       16384
 0       64      255     16639
 0       128     0       32768
 0       128     255     33023
 0       255     0       65280
 0       255     255     65535
 255     0       0       16711680
 255     0       255     16711935
 255     64      0       16728064
 255     64      255     16728319
 255     128     0       16744448
 255     128     255     16744703
 255     255     0       16776960
 255     255     255     16777215
 
hhtg1968
Senior Member

Joined: 25/05/2023
Location: Germany
Posts: 123
Posted: 12:42pm 14 Jun 2023
Copy link to clipboard 
Print this post

what happens when you take other values?

are these 16 colours fix?
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2138
Posted: 12:56pm 14 Jun 2023
Copy link to clipboard 
Print this post

Those are what is set in the firmware. If you enter any other numbers you just get the colour of one in the list of 16.

Eg CLS 155 is the same as CLS 255

To get any other colours requires changing the hardware between the Pico and the VGA socket.

Edit
Will post about doing that with plug-in modules in a few days.
Edited 2023-06-14 23:11 by phil99
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3804
Posted: 01:43pm 14 Jun 2023
Copy link to clipboard 
Print this post

  hhtg1968 said  what happens when you take other values?

You'll get whatever the hardware does and probably make your code harder to understand or change.

  hhtg1968 said  are these 16 colours fix?

Yes, unless you change to non-standard Picomite hardware.

Probably best to stick to the colour names (at least in the array if you use it) and I suspect porting to another MMBasic platform (such as MMB4W) may be easier.

John
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 02:46pm 14 Jun 2023
Copy link to clipboard 
Print this post

The PicoMite doesn't actually know anything about colours. It simply stores a 4-bit number to represent a colour then outputs that number direct to the VGA colour pins at the right time. After that you can do what you want with the numbers. The colour names are only their to be friendly.

Peter has chosen to use the 4 bits as RGB 1-2-1, so 1 bit each for red and blue and two bits for green. You could equally use 2 bits for red, 2 bits for blue and green fixed at 10% (RGB 2-0-2), giving you 3 shades and off for red & blue and a seriously weird display where dark green is the new black! You would still have 16 colours but it would mess the colour names up, of course. :)

You could equally well have 16 green levels by messing with the resistors.

You can never have more than 16 colours on screen at once, as there are only 4 bits, even if you use some sort of system to switch the VGA resistor network.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 03:11pm 14 Jun 2023
Copy link to clipboard 
Print this post

I got this from the forum
'colour shortcuts
const WH =RGB(255,  255,  255) 'WHITE
const YE =RGB(255,  255,    0) 'YELLOW
const LI =RGB(255,  128,  255) 'LILAC
const BR =RGB(255,  128,    0) 'BROWN
const FU =RGB(255,  64,   255) 'FUCHSIA
const RU =RGB(255,  64,     0) 'RUST
const MA =RGB(255,  0,    255) 'MAGENTA
const RE =RGB(255,  0,      0) 'RED
const CY =RGB(0,    255,  255) 'CYAN
const GR =RGB(0,    255,    0) 'GREEN
const CE =RGB(0,    128,  255) 'CERULEAN
const MI =RGB(0,    128,    0) 'MIDGREEN
const CO =RGB(0,    64,   255) 'COBALT
const MY =RGB(0,    64,     0) 'MYRTLE
const BL =RGB(0,    0,    255) 'BLUE
const Bk =RGB(0,    0,      0) 'BLACK
const Gy =RGB(128,  128,  128) 'GREY
const Lg =RGB(210,  210,  210) 'LITEGREY
const Og =RGB(255,  165,    0) 'ORANGE
const PK =RGB(255,  160,  171) 'PINK
const Gd =RGB(255,  215,    0) 'GOLD
const SA =RGB(250,  128,  114) 'SALMON
const BE =RGB(245,  245,  220) 'BEIGE
 
hhtg1968
Senior Member

Joined: 25/05/2023
Location: Germany
Posts: 123
Posted: 05:18pm 14 Jun 2023
Copy link to clipboard 
Print this post

i understand the bitmaps in combination with the number of bit per pixel. i often wrote scroll routines, bitwise etc.

but i don not have any knowledge of vga hardware. i hope my questions are not to dumb...

to stanleyella: you list more than 16 colours. i will try further...
 
hhtg1968
Senior Member

Joined: 25/05/2023
Location: Germany
Posts: 123
Posted: 05:22pm 14 Jun 2023
Copy link to clipboard 
Print this post

the picomite basic knows the "keywords" for gold, grey etc. (more than 16 colour names),

but hardware forces to similar colours... gold is yellow...
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 05:57pm 14 Jun 2023
Copy link to clipboard 
Print this post

  hhtg1968 said  i understand the bitmaps in combination with the number of bit per pixel. i often wrote scroll routines, bitwise etc.

but i don not have any knowledge of vga hardware. i hope my questions are not to dumb...

to stanleyella: you list more than 16 colours. i will try further...


you can only use any 16 at once.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 06:02pm 14 Jun 2023
Copy link to clipboard 
Print this post

@ Stan
Those colours will not work for the PicoMite as they are not RGB 1-2-1. You can't get values of 210, 165, 160, 114 and 220 on a PicoMite. They don't seem to tie in with the CMM2 either.

It's not a case of *choosing* any 16 at once, you have no choice. You get a single 4-bit number and that's it. That's 16 values. The "colour lookup table" is the resistor network between the PicoMite pins and the VGA socket.  :)

Any colour names that refer to the same colour are to help with compatibility between platforms, that's all.
Edited 2023-06-15 04:07 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 08:22pm 14 Jun 2023
Copy link to clipboard 
Print this post

  Mixtel90 said  @ Stan
Those colours will not work for the PicoMite as they are not RGB 1-2-1. You can't get values of 210, 165, 160, 114 and 220 on a PicoMite. They don't seem to tie in with the CMM2 either.

It's not a case of *choosing* any 16 at once, you have no choice. You get a single 4-bit number and that's it. That's 16 values. The "colour lookup table" is the resistor network between the PicoMite pins and the VGA socket.  :)

Any colour names that refer to the same colour are to help with compatibility between platforms, that's all.


All good info Mick. me Doh! I got the constants from the forum and no error message  using but then I only use a few colours from the 8 "primary" colours.
just when I think I'm understanding mmbasic I realize I don't :(

Just going back to vga from using lcd and it's fun with a "big" display though 320x240 16 colours is the same. using a ps2 keyboard and a lcd seemed silly
 
     Page 1 of 2    
Print this page
© JAQ Software 2024