Shop OBEX P1 Docs P2 Docs Learn Events
VGA Colors — Parallax Forums

VGA Colors

johnfl68johnfl68 Posts: 72
edited 2008-05-21 04:11 in Propeller 1
Does anyone have a better explanation of VGA color tables with the prop (VGA tile driver 1024x768)?

I see some things say that the long strings are for 4 color pallets - but why the other 2 colors if it is only Foreground and Background?

I feel like I am missing something, but not really finding any good explanation of how colors work. I understand the 64 possible colors part.

Any help would be appreciated!

Thanks!

John

Comments

  • RaymanRayman Posts: 14,233
    edited 2008-04-02 19:45
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-04-02 20:29
    The color system is 2 bits (4 colors), the built in font takes advantage of this to pack two characters in interleaved fashion to save memory. If the 2 bit index is 00, then it is the background color for both characters, if it's 11 then it's the forground color for both characters. 01 is 1st character foreground/second character background and 10 is the reverse. IOW the LSB of the color index is the first character, and the MSB of the color index is the second character. So by setting up the color palette described in Rayman's website, one color palette isolates only the first character and the other color palette isolates only the second character. This is the resoning behind the ff_bb_ff_bb and ff_ff_bb_bb organization of the color values, the first one changes its value according to the LSB of the color index, the second changes its value according to the MSB of the color index.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.

    Post Edited (Paul Baker (Parallax)) : 4/2/2008 8:55:02 PM GMT
  • johnfl68johnfl68 Posts: 72
    edited 2008-04-04 22:53
    Thanks, this makes a bit more sense.

    John
  • johnfl68johnfl68 Posts: 72
    edited 2008-05-16 01:38
    Ok, a few more questions:

    I am working with the 1024x768 Tile Driver Demo.

    The background is blue(even though the code says lt grey on dk grey). If I try to change in the color table to white on black, the screen fills with the ! symbol?

    The following code:

    box(30, 1, 0, string("Compile"))
      box(40, 1, 1, string("Execute"))
      box(50, 1, 2, string("Quit"))
    



    Color 0 is Red, 1 is Green with the Underscore box effect, 2 is Cyan. In the color table, I would assume that 3 would be a Grey box, but the text comes out messed up, anyone know why this doesn't work?

    Also, the colors in the color table don't seem to line up, in the manner I would assume:

    long $3C043C04       'lt grey on dk grey
      long $3C3C04
      long $C000C000       'red
      long $C0C00000
      long $30003000       'green
      long $30300000
      long $0C000C00       'blue
      long $0C0C0000
      long $FC00FC00       'white
      long $FCFC0000
      long $FF80FF80       'red/white
      long $FFFF8080
      long $FF20FF20       'green/white
      long $FFFF2020
      long $FF28FF28       'cyan/white
      long $FFFF2828
      long $C0408080       'redbox
      long $3010F020       'greenbox
      long $3C142828       'cyanbox
      long $FC54A8A8       'greybox
      long $3C14FF28       'cyanbox+underscore
      long $F030C050       'graphics colors
    



    Red should be 1, but I get Red using a value of 5
    Using a value of 1 gives me Black
    Green should be 2, but I get Green with a value of 6
    Using a value of 2 also gives me Black
    Blue should be 3, but I get Blue using a value of 0
    Using a value of 3 also gives me Black
    White should be 4, but I can not get white to show up
    Using a value of 4 also gives me Black

    What am I missing?????

    What I need to do is fairly simple, I need to use the colors White, Red, Blue, Green, Cyan, Magenta, Yellow, and Black. This falls in to the 8 max foreground/background colors. I need to draw some boxes on the screen. I am using the boxFill PRI, is this part of the problem, is it using the box colors and not the foreground/background colors?

    I really only need one box color - at this time wanted to use Grey - but this messes up the characters in the box.

    Any help would be greatly appreciated!

    Thanks!

    John
  • RaymanRayman Posts: 14,233
    edited 2008-05-16 10:57
    Read the notes at the bottom of this page:



    http://www.rayslogic.com/propeller/Programming/Colors.htm



    Also, in several of the Parallax codes, the space character is mistakenly given $200, when it should be $220.· So, when you clear the screen, you may get a screenfull of a strange character instead of a blank screen...
  • johnfl68johnfl68 Posts: 72
    edited 2008-05-21 04:11
    Ok, I figured it out, I needed to swap foreground and background colors, and in being late at night swapped the long's instead, which gave me the backgrounds full of "!".

    Thanks for the help Rayman!

    John
Sign In or Register to comment.