View Full Version : Color-Code.spin

Mark Bramwell
09-16-2007, 12:48 PM
I have grown tired of trying to figure out the color combinations for a tile.
I have created a program to help me sort it out.

Original Version: Mark Bramwell, Sept 16, 2007
Adapted to PS2 By Jeff Ledger Sept 16, 2007
Adapted to PropTerminal by Andy Schenk, Sept 18, 2007


To view on your TV screen every possible color combination but only 4 at a time with an easy
to use interface to change the colors and view them instantly with the appropriate HEX color
code string.

Color-Code-IR-RS232.spin uses a IR device on pin1 to decode a Sony TV remote.
Use the Left/Right arrows to select the box. Use Up/Down to change the color of that box.

Remote-Tester.spin will allow you to display & pick codes from another remote if you
do not have a Sony.

Updated: The attached file now has the PS2 keyboard as well as a RS232 version for Hyperterminal
Updated: The attached file now has a version that uses the PropTerminal software as a keyboard interface

Post Edited (Mark Bramwell) : 9/18/2007 6:08:59 PM GMT

09-16-2007, 01:37 PM
Good work, Mark! There had been a request from hippy the other day as to what colors...
I gave him the list from André's Hydra book, but it seems the PAL/NTSC logic uses a backwards color wheel.

Chroma Values most likely
from Hydra (dec) - name - correct chroma (hex)
00 Blue 0
02 Purple e
03 Magenta d
05 Red b
06 Orange a
07 Brown 9
08 Yellow 8
09 Yellow-Green 7
10 Green 6
13 Cyan 3

There is additional background information in the wiki: propeller.wikispaces.com/Colors (http://propeller.wikispaces.com/Colors)

It would be doubtlessly an awarding task - if not already done! - if someone could assign some morer color names
to a color matrix, as follows:

luma -> 2 3 4 5 6
no chroma black d'gray l#gray white white
0 blue
3 cyan
6 green
7 yellow-gr
8 yellow
9 brown
A orange
B red
D magenta
E purple

I added two forgotten lines; and it could look a little bit like this:

Post Edited (deSilva) : 9/17/2007 7:00:41 PM GMT

Mark Bramwell
09-16-2007, 10:19 PM
What I find interesting is some color combinations cause the screen to tear / lose lock.

That is why I eventually needed to do something that allows me to sit back and simply cycle quickly by pushing a button.

I probably should pick up a PS2 connector and solder it onto the board although the IR_Kit sure is a handy object to have (I used an old module from a VCR and soldered it in).

09-16-2007, 10:41 PM
Well, you can have 64 arbitrary colors at the same time with TV even now!
And avoid the luma values 0,1 and 7

09-16-2007, 10:42 PM
If you are seeing screen tear, it's highly likely you are using luma values that are outside the range for images.

On the Propeller, some of the luma values are used for SYNC. There are 8 possible luma values, with 0 and 1 being sync, this leaves 6 intensities for actual display.

This is done so that the entire video signal is under your control.

On the wiki page, I've mapped out the standard colors, and their values. It's pretty easy to look at the strip at the bottom of the screen capture, note the hue, then assign intensities 2, 7 from there to get your color. The grid of colors above is done with the artifacting technique and only works on NTSC display systems. It's very RAM hungry, making it near useless for anything but demos on a prop with no external memory attached.

(was just wanting to explore color possibilities with the Parallax reference video circuit.)

Some displays will tolerate zones of luma value 1, for really black objects. Most will not.

Luma 7 should be ok, right?

Never had a problem with that one on any displays I've used.

Propeller Wiki: Share the coolness! (http://propeller.wikispaces.com/)

09-16-2007, 11:33 PM
Alas, it is still alittle bit unclear how the color modulation is implemented. I "infered" from cryptical remarks in André's Hydra book, that an additional phase shifted signal (of value 1) is added to the basic luma signal. I couldn't imagine how it work otherwise, or how it could work at all when e.g. you change colors along a video line all with luma value 7.....

Oldbitcollector (Jeff)
09-17-2007, 12:35 AM
Nice Utility! Attached is a copy that has been modified to use the PS2 keyboard (comboKeyboard)

Thanks for the great tool!


Buttons . . . check. Dials . . . check. Switches . . . check. Little colored lights . . . check.

— Calvin, of 'Calvin and Hobbes.

09-17-2007, 02:50 AM
I'm a bit confused on that matter too. I know somebody who is gonna put that matter to rest soon.

The information on the wiki is from pure observation. I have a display that will display nearly anything NTSC, and I've another one that's really picky. Went through the Parallax driver, then again with the EASY_NTSC Cardboard created. Color was confusing --in the end, it was just easier to just blast all 256 possible waitvid values to the screen, sort out the good from the bad, and put it all in one display example.

That's the screenie on the wiki.

Propeller Wiki: Share the coolness! (http://propeller.wikispaces.com/)

Fred Hawkins
09-17-2007, 02:58 AM
The difficult displays probably have digital filters that play hub with colors slightly out of range. Sony sold a trinitron color tv with individual channel tuning knobs. I found it useful for adjusting the screen to watch pay-per-view back when it was more simply encoded. The sony didn't have a remote, maybe ebay is worth a look.

09-17-2007, 03:07 AM
There can be no "colours out of range"... The hue is coded into a phase shift, controlled by the chroma values 0 to 15. The problem is the voltage swing of the signal that must stay above sync level and not overshot inside the Prop.

So it should be safe to limit yourself to luma values between 2 and 6.

Trying all 256 values in the color register is not dangerous but seems not very instructive...

09-17-2007, 03:37 AM
Say what you want. I now know exactly what a given value will do, when it's an input to a waitvid. Before that exercise, I was in the same boat as a lot of other people, wondering if we had 5 or 6 lumas to work with, wondering about the high-sat colors, how they mix, etc...

It's not like I didn't think about it. More like wanting to sort out contradictory information. Working through that exercise sorted all of those issues out nicely.

There isn't an NTSC display around that won't display that color screen in the wiki. Luma 7 is just fine for use, particularly if it's for a monochrome pixel.

Propeller Wiki: Share the coolness! (http://propeller.wikispaces.com/)

Mark Bramwell
09-17-2007, 06:30 AM
I have updated the ZIP file in the 1st message.

It now includes Jeff's adapted version for the PS2 keyboard as well as I have modified my version to also support the PC keyboard via Hyperterminal. If you have a stock protoboard/RPMproto with only a RS232 connection, you can now use hyperterminal to control the spin program.


Now supports hyperterminal for those of you with a stock protoboard with no-IR and no-PS2-keyboard.
Use 9600, none, 1, no flow control
Use I, J, K, M to navigate with hyperterminal.


*** Propeller Color Code Tester for your TV ***

Use the I,J,K,M keys to navigate on your TV screen

I I=Increase the current color value
J K Change which code we are examining
M M=Decrease the current color value

09-17-2007, 10:26 AM
This is a nice utility.


Propeller Wiki: Share the coolness! (http://propeller.wikispaces.com/)

Mark Bramwell
09-17-2007, 11:14 AM
There are definitely some good and some bad color combinations!

I just reset the default colors in the app to: 44 0B 6B 9B

They are a much nicer starting position, no bleeding or buzzing from the TV. (although the red is more of an orange on my set but RED=aa is too bright for me)

09-17-2007, 01:32 PM
$aa IS ASSUMED to be orange!! I should be grateful if someone would undertake the task to fill in some color names in my table http://forums.parallax.com/images/smilies/smile.gif
Thank You

Fred Hawkins
09-17-2007, 06:58 PM
deSilva said...
$aa IS ASSUMED to be orange!! I should be grateful if someone would undertake the task to fill in some color names in my table http://forums.parallax.com/images/smilies/smile.gif
Thank You
deSilva, I'll do that for you (using netscape's color names) if you rearrange your color example table so it is not so discordant*. (The upper left corner panel seems misplaced)
Among the various prototypes of palette displays in Wiki's list (http://en.wikipedia.org/wiki/List_of_palettes), I like TED best for our purposes. That's a very nice and useful palette. Atari 2600 is also nice, but it lacks any reference values.

*attached a non-discordant palette

09-18-2007, 01:08 AM
This Wiki page looks like a major task of someone...
I think the ATARI NTSC palette comes quite close.. I added it to my above posting, and also removed a disconcordancy http://forums.parallax.com/images/smilies/smile.gif

Fred Hawkins
09-18-2007, 02:36 AM
I like it. Still need names?

09-18-2007, 03:00 AM
Yes, but they should be "validated" ... I do not trust my assignment http://forums.parallax.com/images/smilies/smile.gif

09-18-2007, 02:00 PM
Here is a version for PropTerminal. It works like the PS2 version but has additional functions:
- with RETURN you write the actual colorcodes to the Terminal
- then you can write a comment to this value.
- repeat this if you want more then one color set
when all colors are on the Terminal screen:
- Save it to the clipboard with 'Copy Text' in the File-Menu (of PropTerminal)
- Insert it in the IDE with Paste or Control-v.


Mark Bramwell
09-19-2007, 01:09 AM
PropTerminal looks interesting. I had no used it before.

I have refreshed the zip and re-uploaded it in the 1st message of this thread.

You can now use: IR (TV remote), Hyperterminal, PS2 keyboard and PropTerminal to control this program

The only thing left is telepathy and I am still working on that spin object!