Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 14:53 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 2 of 2    
Author Message
hhtg1968
Senior Member

Joined: 25/05/2023
Location: Germany
Posts: 123
Posted: 08:22am 15 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.



ah. slowly i understand the "resistor network" that is the "colour table". many thanks... the colour "names" (yellow) etc are only keywords for concrete rgb values. so you cannot program a so called colour scrolling feature...

hhtg
 
Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1114
Posted: 08:30am 15 Jun 2023
Copy link to clipboard 
Print this post

  stanleyella said  
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

So far nothing wrong with this, the LCD usualiy has more than 16 Colors so
it will work fine there.
But it will not fit into PM VGAs RGB 1-2-1 Color generation so you'll get false colors on VGA.
Edited 2023-06-15 18:33 by Martin H.
'no comment
 
hhtg1968
Senior Member

Joined: 25/05/2023
Location: Germany
Posts: 123
Posted: 09:01am 15 Jun 2023
Copy link to clipboard 
Print this post

i think such a LCD has its own (screen) memory (and own principe of colours). therefore you "talk" to such screens with commands, no direct write into the memory.
 
Mixtel90

Guru

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

The colour handling can be interesting on a PicoMite. :)
If several RGB() values are in an array then you can, of course, loop through them by changing the array index value. That can be quite effective. It's also fun to use it in Mode 1, where you can get instant background colour changes without affecting the foreground colours - or vice versa.
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: 01:25pm 15 Jun 2023
Copy link to clipboard 
Print this post

RS data sheet for ili9341 says-
The module display area contains 240X320 pixels and can display up to 262K colors
Why RS used colors? they're Bwitish but anyway must be different to vga.
I was happy using ili9341 with just 8 colours on 8 bit pics.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9129
Posted: 01:52pm 15 Jun 2023
Copy link to clipboard 
Print this post

The way that all versions of MMbasic work (slightly simplified but essentially correct) is the colours are always expressed as RGB888. i.e. 24-bits per pixel

This internal representation is then converted by a display specific driver to the actual display

The drivers have a very small number of function calls

DrawRectangle
DrawBitMap
DrawBuffer
ReadBuffer
ScrollScreen

The later two functions only apply to output devices that can be read (local framebuffer like VGA, external framebuffer like ILI9341)

So, irrespective of the display the BOX command will call DrawRectangle with a 24-bit number. It is then up to the display specific version of DrawRectangle to convert the 24-bit number to a resolution the display understands.

In the case of the PicoMite VGA 16-colour display it uses this algorithm

   unsigned char colour = ((c & 0x800000)>> 20) | ((c & 0xC000)>>13) | ((c & 0x80)>>7);


which gives the 4 bits of the RGB121 output

For a ILI9341 the output is RGB565 (2-bytes per pixel) so the algorithm is

col[0]= ((c >> 16) & 0b11111000) | ((c >> 13) & 0b00000111);
col[1] = ((c >>  5) & 0b11100000) | ((c >>  3) & 0b00011111);


The SSD1963 supports full RGB888 with three bytes per pixel so the algorithm is

col[0]=c>>16
col[1]=(c>>8) & 0xFF
col[2]= c & 0xFF


One wrinkle appears when you read the display framebuffer. In this case the driver has to convert the data from the display back to 24-bits.

So for a 4-bit VGA colour display the code for a pixel "val" is:


const int colours[16]={0x00,0xFF,0x4000,0x40ff,0x8000,0x80ff,0xff00,0xffff,0xff0000,0xff00FF,0xff4000,0xff40ff,0xff8000,0xff80ff,0xffff00,0xffffff};
colour=colours[val];
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 02:31pm 15 Jun 2023
Copy link to clipboard 
Print this post

I just saved that in documents for future reference.
I didn't know there was a scroll function though there's a youtube video about it using mmbasic.
A good explanation of colours. Cheers stan
 
hhtg1968
Senior Member

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

that is very well descripted. and i wrote wrong, then mmbasic writes to the memory of the external LCDs.

i will store this explanation too.
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024