Jump to content
Sign in to follow this  
Gemintronic

Standardized Palette Constants

Recommended Posts

I was thinking the recent information about macros would be useful in creating a unified color palette for NTSC and PAL. Maybe commands like:

callmacro set_palette_ntsc

and

callmacro set_palette_pal

 

That would look like this:

 

 macro set_palette_ntsc
const c_aqua = $B8
const c_black = $00
const c_blue = $86
const c_dkgray = $06
const c_fuchsia = $58
const c_gray = $08
const c_green = $D8
const c_lime = $DE
const c_ltgray = $0A
const c_maroon = $52
const c_navy = $A4
const c_olive = $E8
const c_purple = $66
const c_red = $44
const c_silver = $0C
const c_teal = $00
const c_white = $0E
const c_yellow = $1E
const c_brown = $F6
const c_dkblue = $70
end

 

All the Batari BASIC programmer would have to do is call the appropriate macro for NTCS/PAL and use the constants.

 

Am I onto something here? I think it would greatly simplify converting games between TV standards. Personally, I think c_red is more human readable than $44.

Edited by theloon

Share this post


Link to post
Share on other sites

Given that the low nybble makes no difference between the 2, c_red+4 for $44(NTSC) or $64(PAL) would work just as well. c_red should just be defined at $40 or $60.

 

The trick with palettes is that starting at $20 (which is the same for both)...as you go up the NTSC chart by +$10, the color corresponds to the PAL chart by +$20.

$20 = $20

$30 = $40

$40 = $60

$50 = $80

$60 = $A0

$70 = $C0

 

When you reach the middle of the NTSC chart at $80, continue by subtracting by +$20 from $F0 instead.

$80 = $D0

$90 = $B0

$A0 = $90

$B0 = $70

$C0 = $50

$D0 = $30

 

At either end of the values ($00-$1F and $E0-$FF), these are all B&W in PAL and have no directly-corresponding color from NTSC.

  • Like 1

Share this post


Link to post
Share on other sites

@Nukey Shay: I think you've done some incredible work figuring out how to convert colors in assembly. I think what might have to happen here is to manually pick colors bB programmers usually use and then by-eyeball make a table for NTSC and PAL. I've done some work on the NTSC side but I'm not sure if it's the most accurate or popular colors.

Share this post


Link to post
Share on other sites

Indeed. There are slight differences between the palettes which make true color-conversion an impossibility (not to mention the lack of YELLOW...hey! don't you guys have lemons over there??). But the mnemonic formula shown above is probably the closest you'll find. Kinda easy to remember, really. 20/20 (vision), positive = add, negative = subtract.

Edited by Nukey Shay
  • Like 1

Share this post


Link to post
Share on other sites

All the Batari BASIC programmer would have to do is call the appropriate macro for NTCS/PAL and use the constants.

 

Am I onto something here? I think it would greatly simplify converting games between TV standards. Personally, I think c_red is more human readable than $44.

This sort of idea has been proposed and used before, although maybe not in batari Basic, and maybe not using macros per se-- so yes, you're onto something. Different programmers have different opinions about using color names instead of color values-- some prefer using color names, and some prefer using color values. Each approach has advantages and disadvantages, so it just depends on your own preference.

 

As I see it, the four main problems with using color names are as follows:

 

(1) The 2600 has so many different colors-- at least in the NTSC and PAL color palettes-- that it could be tough to give unique names to all of them. This is actually not that difficult to do, because there are already lists of hundreds of color names that are used in other industries, although matching them up to the closest colors on the 2600 might be tricky.

 

(2) The NTSC and PAL color palettes don't match each other precisely, so some of the color names used in the NTSC palette might not have equivalent color values in the PAL palette.

 

(3) If you try to give a unique name to each color, it could be almost impossible to learn and remember all of them, and to pick the right one for the specific color you want to use without consulting a chart.

 

(4) Different programmers might want to define the color names differently, or the same programmer might want to define them differently in different games. This would be more likely to occur with basic color names like "blue" or "green" or "light purple" than for more specific color names like "fuchsia" or "teal."

 

However, if you stick to color names that are widely-used in other industries, pick the values that most closely correspond to those color names, and create an NTSC macro and a PAL macro, then each programmer will have the option of calling the appropriate macro or not. And even if they call one of the macros, they can always use their own color values, or create their own color names if they want.

 

So overall, I think it's a good idea.

 

http://www.google.com/search?q=%22color+names%22

 

Michael

Share this post


Link to post
Share on other sites

IMO after working with color values for a little while, you don't even see the numbers anymore. When I see something like #$8n in an NTSC program being stored to a color register, without even looking at a chart my mind's eye sees #BLUE+lum (the color, not the word). PAL, not so much. Just the ones that appear frequently.

 

I vote just keep programming.

Edited by Nukey Shay
  • Like 1

Share this post


Link to post
Share on other sites

Given that the low nybble makes no difference between the 2, c_red+4 for $44(NTSC) or $64(PAL) would work just as well. c_red should just be defined at $40 or $60.

That works great in assembly, because the assembler adds up the values to get a single value when converting the assembly into machine code.

 

But in batari Basic it will increase the number of bytes and cycles used, because a statement like "COLUP0=c_red+4" would be treated like any math, so it would be compiled into

  lda #c_red
  clc
  adc #4
  sta COLUP0

That's not so bad, as long as the program doesn't too many statements that set the color registers that way. But if bytes or cycles become an issue, that would be one place where the code could be optimized.

 

Michael

Share this post


Link to post
Share on other sites

IMO after working with color values for a little while, you don't even see the numbers anymore. When I see something like #$8n in an NTSC program being stored to a color register, without even looking at a chart my mind's eye sees #BLUE+lum (the color, not the word).

I agree, the NTSC color values are pretty easy to learn, especially if they're written in hex instead of decimal. It's mainly a problem for beginning programmers, or programmers who avoid using the hex values for some reason. But if someone plans to do any amount of programming for the 2600, it's better in the long run for them to bite the bullet and learn the color values.

 

On the other hand, assigning color names can be useful, such as if you keep forgetting whether you're using $C6 or $C8 for green, or if you want to make it easier to compile your game for either NTSC or PAL. But in those cases, each program might assign slightly different values to the names, which makes it tough to create one table of color names that fits all programmers and all programs.

 

Michael

Share this post


Link to post
Share on other sites

bB lacks the ability to treat constants AS constants (something that's built right into Dasm)?

 

Wow...that's a serious drawback. The value is known. No need for interpretation.

Share this post


Link to post
Share on other sites

bB lacks the ability to treat constants AS constants (something that's built right into Dasm)?

No, bB *does* treat named constants as constants. I'm talking about adding a number to a constant:

 

  ; assembly
  lda #c_red+4 ; this gets resolved into a single value by the assembler
  sta COLUP0

versus

 

  rem * batari Basic
  COLUP0=c_red+4 : rem * this gets treated as any other math statement, so it compiles to
  rem * lda #c_red : rem * note, c_red *is* recognized as being a constant (if defined as such)
  rem * clc
  rem * adc #4
  rem * sta COLUP0

This is no different for any other math-- e.g., a=5+12:

 

  ; assembly
  lda #5+12
  sta a

versus

 

  rem * batari Basic
  a=5+12
  rem * lda #5
  rem * clc
  rem * adc #12
  rem * sta a

I don't know why anyone would want to say something like "a=5+12" instead of just "a=17", but the point is, it's a math statement, so it gets compiled as such. I suppose batari could add some logic to the parser to look for cases where a math statement contains only constants, and compile them differently, like

 

  const c_red=$40
  COLUP0=c_red+4
  rem * lda #c_red+4
  rem * sta COLUP0

or even

 

  TIM64T = 37*76/64
  rem * lda #37*76/64
  rem * sta TIM64T

but I don't know how difficult that would be, and it might be more trouble than it's worth.

 

Michael

Edited by SeaGtGruff

Share this post


Link to post
Share on other sites
No, bB *does* treat named constants as constants. I'm talking about adding a number to a constant

...which is still a constant. Both are known values. Hence, my surprise.

 

 

In that case...

 

const c_red = $40

const c_red2 = $42

const c_red4 = $44

 

...etc ;)

Share this post


Link to post
Share on other sites

It's the 21st century. Time for people to use the full NTSC palette of pretty colors and abandon the inadequate glob of PAL colors.

Share this post


Link to post
Share on other sites

PAL gets WAY more time to dazzle you, tho. One thing that I've been envious of our blue brothers. The only thing, really. Oh, and boobies on commercial television.

Share this post


Link to post
Share on other sites

I wonder if India has limes. The people at work tell me recipes, they say it has a lemon in it. I told them it's a lime, but they don't get it. It's not a green lemon. It tastes different.

 

Anyway, there's really no reason to make a "unified" palette. Everyone knows that PAL games are usually worth less than NTSC. :)

 

<br /><br />

<br />Indeed. There are slight differences between the palettes which make true color-conversion an impossibility (not to mention the lack of YELLOW...hey! don't you guys have lemons over there??). But the mnemonic formula shown above is probably the closest you'll find. Kinda easy to remember, really. 20/20 (vision), positive = add, negative = subtract.<br />
Edited by yuppicide

Share this post


Link to post
Share on other sites

Thanks for all the feedback guys. Maybe I was chasing a problem that doesn't exist. Nevertheless, I think I'll use a macro for my own personal palette. I really dislike using $44 for color values. Not human readable.

 

I think I'll use the GretagMacbeth color chart to create a standard 24 color palette

http://www.poynton.com/notes/color/GretagMacbeth-ColorChecker.html

 

The colors pretty much cover everything and I don't have to remember $44 for red anymore :P

Share this post


Link to post
Share on other sites
The colors pretty much cover everything and I don't have to remember $44 for red anymore :P

Why try to remember anything? If you use VisualbB, just bring up the TIA Color Chart, select either NTSC or PAL, click on the color you want and it tells you the hex and decimal number for the color.

Share this post


Link to post
Share on other sites
The colors pretty much cover everything and I don't have to remember $44 for red anymore :P

Why try to remember anything? If you use VisualbB, just bring up the TIA Color Chart, select either NTSC or PAL, click on the color you want and it tells you the hex and decimal number for the color.

 

I see your point RT. However stopping coding to open the color chart and slect the color and copy the hex value.. is more complicated than simply typing c_red.

 

Any break from coding in the editor is a distraction.

 

Here is a preliminary list of color names using the 24 color palette:

c_brown

c_pink

c_skyblue

c_dkgreen

c_lilac

c_aqua

c_orange

c_blue

c_red

c_purple

c_ltgreen

c_gold

c_dkblue

c_green

c_maroon

c_yellow

c_fuchia

c_cyan

c_white

c_ltgray

c_silver

c_gray

c_dkgray

c_black

Edited by theloon

Share this post


Link to post
Share on other sites

It's the 21st century. Time for people to use the full NTSC palette of pretty colors and abandon the inadequate glob of PAL colors.

 

Send me an NTSC 2600 and all the kit to get an NTSC signal working on my PAL tv's, or even just send me an NTSC tv and the relevant equiptment to plug it up to a uk power supply and I'll happily stop using PAL myself - will cost you a few hundred dollars though....

  • Like 2

Share this post


Link to post
Share on other sites
I see your point RT. However stopping coding to open the color chart and slect the color and copy the hex value.. is more complicated than simply typing c_red.

 

Any break from coding in the editor is a distraction.

If you leave the chart open and drag it over to a corner out of your way, it's a heck of a lot faster and easier than trying to remember something like c_dkgreen. Now was it c_dkgreen or c_drkgreen? If it's easier for you to memorize dozens of abbreviated words than it is to simply click on a color, that's great.

Edited by Random Terrain

Share this post


Link to post
Share on other sites
It's the 21st century. Time for people to use the full NTSC palette of pretty colors and abandon the inadequate glob of PAL colors.

Send me an NTSC 2600 and all the kit to get an NTSC signal working on my PAL tv's, or even just send me an NTSC tv and the relevant equiptment to plug it up to a uk power supply and I'll happily stop using PAL myself - will cost you a few hundred dollars though....

If your country won't upgrade, you'll have to use emulation. PCs over there do have colors such as yellow, right? :D

Share this post


Link to post
Share on other sites

Hmmn.. I can see this technique isn't for everyone. Thanks for the feedback RT. I guess it's only for those who:

 

* Have a small screen like a nettop

* Use Game Maker and are already familiar with c_ color shortcuts

http://gamemaker.wikicomplete.info/color

* Get distracted by doing ANYTHING outside of the code editor

Edited by theloon

Share this post


Link to post
Share on other sites
It's the 21st century. Time for people to use the full NTSC palette of pretty colors and abandon the inadequate glob of PAL colors.

Send me an NTSC 2600 and all the kit to get an NTSC signal working on my PAL tv's, or even just send me an NTSC tv and the relevant equiptment to plug it up to a uk power supply and I'll happily stop using PAL myself - will cost you a few hundred dollars though....

If your country won't upgrade, you'll have to use emulation. PCs over there do have colors such as yellow, right? :D

 

What is this colour yellow that you speak of, I live in the UK - we have a grey sun, grey sand and don't you guys know we're called limeys 'cos we're too cheap to use lemons.....(The fact I love banana milkshake and always have pineapple on my pizzas should be ignored for the duration of this conversation)

Edited by eshu

Share this post


Link to post
Share on other sites

Taking RTs feedback into consideration I changed some color names around to have less "dk" or "lt" abbreviations. I also changed the names to better reflect Game Maker standards. I can't come up with names better than c_dkgray or c_ltgray though. Also, I'm thinking of either removing c_ltgray and adding c_beige (to keep it 24 colors) or just plain adding c_beige as currently only one shade of brown is listed.

 

UPDATE: Here are 25 colors for NTSC. So far I don't think this will be popular enough to do the PAL colors too.. I forgot whether actual TV colors are brighter or darker so in most cases I opted for brighter colors.

 const c_brown = $F2
const c_pink = $3C
const c_skyblue = $98
const c_olive = $E4
const c_lilac = $7A
const c_aqua = $B8
const c_orange = $38
const c_blue = $86
const c_red = $46
const c_purple = $64
const c_lime = $DA
const c_gold = $2E
const c_navy = $84
const c_green = $C6
const c_maroon = $42
const c_yellow = $1E
const c_fuchsia = $58
const c_cyan = $A6
const c_white = $0E
const c_ltgray = $0C
const c_silver = $0A
const c_gray = $08
const c_dkgray = $04
const c_black = $00
const c_tan = $FC

Edited by theloon

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...