vga_512x384_bitmap_DEMO
Princ
Posts: 12
Hi,
i would like to ask someone about vga_512x384_bitmap_DEMO.
I don´t understand why the pixels which make the plot are different color from background.
In driver there is probably explenation in the paragraf ColorPtr but i don´t understand to it.
So i would like to know how it works with colors and pixels in the driver.
Thanks a lot for reply
Princ
i would like to ask someone about vga_512x384_bitmap_DEMO.
I don´t understand why the pixels which make the plot are different color from background.
In driver there is probably explenation in the paragraf ColorPtr but i don´t understand to it.
So i would like to know how it works with colors and pixels in the driver.
Thanks a lot for reply
Princ
Comments
For each tile there is a color palette..
I'll go and fetch that one and take a quick look.
Edited to reflect post below.
So we know there are 192 words that contain the color bytes for the tiles. And we know they are arranged sequentially growing upward in the HUB memory, first word = upper left, second word = second tile from upper left, continuing through line by line until the last word = lower right tile.
The color bytes themselves only reference about 64 colors and this is because the Propeller VGA only has a couple of bits per color. Lower numbers = VGA colors.
From the driver comments:
The value ColorPtr holds the address of the color words. At that address you will find the first color word which is the upper left tile.
We can also see the lower numbered byte is the background, or "0" color, and the upper byte has the foreground, or "1" color.
The format for color bytes is: %RRGGBB00, so I was wrong about it. Higher numbers = VGA colors. Oh well. There are 4 levels for R, G, and B, two bits each.
From the demo code: 512x384_Bitmap_Demo
Here we see the length of the color array defined by:
And the color array defined here:
So then, to change the first tile to black and white:
Lower byte = black = %00_00_00_00 R= 00, B= 00, G= 00
Upper byte = white = %11_11_11_00 R=11, B=11, G=11
Use the statement
From there, you can simply index into the colors array with "colors[x]" where x is the tile number as defined above. if you see success with the upper left tile, go ahead and set a bunch of them with something like:
And you are on your way!
I'm not where I can run this, but I should be really close based on reading this driver. Close enough you can tell me what I got wrong when I read this later on.
I got it but i miss one last thing. In the demo there is a plot how the plot is connected witch colors?.
I think but i´m not sure if we make the pixel high it is executed like a "foreground" ?
So for example:
repeat i from 0 to tiles -1
colors := %11_11_11_00_00_00_00_00
pixel[1] = %1
it will make one pixel white and other pixels black ?