Shop OBEX P1 Docs P2 Docs Learn Events
Help with understanding what this code snippet is doing — Parallax Forums

Help with understanding what this code snippet is doing

BillDerBillDer Posts: 33
edited 2009-02-13 03:48 in Propeller 1
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.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-13 02:40
    First of all, the forum software uses numbers and some single letters within square brackets to designate format commands.· If· you include a space after the opening bracket, the actual contents of the brackets is shown.· If you put [noparse][[/noparse] i], it shows.· If you leave out the extra space, you get italics.



    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.
  • Nick McClickNick McClick Posts: 1,003
    edited 2009-02-13 03:48
    I actually don't think there's any documentation on the TV driver in the Prop manual. But the Hydra book is the goldmine. Another good reference is here. It took me a while to figure what was going there, too.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Gadget Gangster - Share your Electronic Projects - Sign up as a Designer and get a free 4-pack of Project Boards!
Sign In or Register to comment.