Help with understanding what this code snippet is doing
BillDer
Posts: 33
This is taken from the Graphics demo. I am slowly but surely understanding how graphics works and finally understand what is going on with colors having a set of 4 colors etc. Thanks to everyone for the help to get where I am at.
Now, I am a little stuck. I understand that the screen array is an array of pointers to the display data.
And its pointing at $5000 to start. But, where are the color bits? I am so confused.
I know that this code snippet once understood will be the decoder ring I need. Can someone explain it to this thick headed newbie?
'init colors
repeat i from 0 to 63
colors := $00001010 * (i+4) & $F + $2B060C02
'init tile screen
repeat dx from 0 to tv_hc - 1
repeat dy from 0 to tv_vc - 1
screen[noparse][[/noparse]dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10)
Thank you in advance.
Now, I am a little stuck. I understand that the screen array is an array of pointers to the display data.
And its pointing at $5000 to start. But, where are the color bits? I am so confused.
I know that this code snippet once understood will be the decoder ring I need. Can someone explain it to this thick headed newbie?
'init colors
repeat i from 0 to 63
colors := $00001010 * (i+4) & $F + $2B060C02
'init tile screen
repeat dx from 0 to tv_hc - 1
repeat dy from 0 to tv_vc - 1
screen[noparse][[/noparse]dy * tv_hc + dx] := display_base >> 6 + dy + dx * tv_vc + ((dy & $3F) << 10)
Thank you in advance.
Comments
Regarding the screen information, 6 bits are used for a color table index and 10 bits are used for a pointer into either the ROM font table or a tile table (16 x 16 or 16 x 32 pixels), usually with 2 bits per pixel horizontally (to make a 32 bit long word for the video generator) and 16 or 32 longs vertically.· It helps to read the description of the video generator and its instructions in the Propeller Manual and to read the inner loop of either the TV driver or VGA drive to see how the screen word is broken apart to·access the various tables to get a long word of pixel data to feed the video generator.· You may want to get a Hydra Manual which goes into detail on video generation in the Propeller.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Gadget Gangster - Share your Electronic Projects - Sign up as a Designer and get a free 4-pack of Project Boards!