|
Joined: Jul 2009
Posts: 78
Member
|
OP
Member
Joined: Jul 2009
Posts: 78 |
Currently the colors of the MC6847 "Video Display Generator" chip used in CoCo and other machines are defined like this: static const UINT32 default_palette[] =
{
M6847_RGB(0x00, 0xff, 0x00), /* GREEN */
M6847_RGB(0xff, 0xff, 0x00), /* YELLOW */
M6847_RGB(0x00, 0x00, 0xff), /* BLUE */
M6847_RGB(0xff, 0x00, 0x00), /* RED */
M6847_RGB(0xff, 0xff, 0xff), /* BUFF */
M6847_RGB(0x00, 0xff, 0xff), /* CYAN */
M6847_RGB(0xff, 0x00, 0xff), /* MAGENTA */
M6847_RGB(0xff, 0x80, 0x00), /* ORANGE */
M6847_RGB(0x00, 0x00, 0x00), /* BLACK */
M6847_RGB(0x00, 0xff, 0x00), /* GREEN */
M6847_RGB(0x00, 0x00, 0x00), /* BLACK */
M6847_RGB(0xff, 0xff, 0xff), /* BUFF */
M6847_RGB(0x00, 0x40, 0x00), /* ALPHANUMERIC DARK GREEN */
M6847_RGB(0x00, 0xff, 0x00), /* ALPHANUMERIC BRIGHT GREEN */
M6847_RGB(0x40, 0x10, 0x00), /* ALPHANUMERIC DARK ORANGE */
M6847_RGB(0xff, 0xc4, 0x18) /* ALPHANUMERIC BRIGHT ORANGE */
}; There are plenty of "pure" colors there. But are these the colors effectively generated by MC6847? The MC6847 datasheet says that the colors are formed by the combination of three signals: Y, phiA and phiB, according to the Y'UV colorspace. According to the table "DC (STATIC) CHARACTERISTICS" in the datasheet, when producing color, Y may assume one of these voltages: "Black" = 0.72V; "White Low" = 0.65V; "White Medium" = 0.54V; "White High" = 0.42V. phiA and phiB may be: "Output Low" = 1.0V; "R(eference?)" = 1.5V; "Input High" = 2.0V. "FIGURE 10 - VIDEO AND CHROMINANCE OUTPUT WAVEFORM RELATIONSHIPS" shows the combinations of voltages used to produce each color. Mapping the values of Y to a 0~255 range, we get "Black" = 0; "White Low" = 59; "White Medium" = 153; and "White High" = 255. phiA and phiB can be mapped to -128, 0, +128. These values can then be converted to RGB according to the formulae (found in Wikipedia): - R = Y' + 1,13983 × U
- G = Y' - 0,39465 × U - 0,58060 × V
- B = Y' + 2,03211 × V
So we get: - GREEN = Y'UV(153,-128,-128) = RGB(7,277,-107) --> #07ff00
- YELLOW = Y'UV(255,-128,0) = RGB(255,305,-5) --> #ffff00
- BLUE = Y'UV(59,+128,0) = RGB(59,8,319) --> #3b08ff
- RED: Y'UV(59,0,+128) = RGB(204,-15,59) --> #cc003b
- WHITE: Y'UV(255,0,0) = RGB(255,255,255) --> #ffffff
- CYAN: Y'UV(153,0,-128) = RGB(7,227,153) --> #07e399
- MAGENTA: Y'UV(153,+128,+128) = RGB(298,28,413) --> #ff1cff
- ORANGE: Y'UV(153,-128,+128) = RGB(298,129,-107) --> #ff8100
- BLACK: Y'UV(0,0,0) = RGB(0,0,0) --> #000000
- DARK GREEN: Y'UV(0,-128,-128) = RGB(-145,124,-260) --> #007c00
- DARK ORANGE/RED: Y'UV(0,-128,+128) = RGB(145,-23,-260) --> #910000
Since these values are based on what MC6847 actually does, I suppose they are more accurate than the "pure" green (#00ff00), red (#ff0000), etc. that are currently being used.
Last edited by Ensjo; 10/13/10 05:24 AM.
|
|
|
|
Joined: Feb 2005
Posts: 449
Senior Member
|
Senior Member
Joined: Feb 2005
Posts: 449 |
|
|
|
|
Joined: Aug 2009
Posts: 1,183 Likes: 67
Very Senior Member
|
Very Senior Member
Joined: Aug 2009
Posts: 1,183 Likes: 67 |
PC-6001VW vs. MESS MC6847 color comparision: Still somewhat wrong there for sure, but at least they matches more than before, or perhaps MESS is right and PC-6001VW is wrong ... but how to test it out? 
|
|
|
|
Joined: May 2004
Posts: 1,745 Likes: 8
Very Senior Member
|
Very Senior Member
Joined: May 2004
Posts: 1,745 Likes: 8 |
doesn't MAME have YUV conversion stuff, or is it only for the LDs?
|
|
|
|
Joined: Mar 2001
Posts: 17,001 Likes: 93
Very Senior Member
|
Very Senior Member
Joined: Mar 2001
Posts: 17,001 Likes: 93 |
It does, but it's overkill for this type of case. The usual thing to do (as per e.g. NES) is to have PALETTE_INIT actually calculate the palette from the YUV values so it's documented where they come from.
|
|
|
|
Joined: Dec 2007
Posts: 301
Senior Member
|
Senior Member
Joined: Dec 2007
Posts: 301 |
Well as this thread started as MC6847 (CoCo),  I just ran a side-by-side test of MESS SVN Coco3 vs a real Coco3. Monitor on PC is SyncMaster 204B and on Coco3 a Magnavox Professional RGB 8CM873. MESS is set for a raster effect so the screens look the same as the Magnavox. Expecting identical colors from these two monitors may be asking too much, but the CLS CoCo colors are pretty darn close with proper adjustment of the Magnavox monitor brightness and contrast. The most noticeable difference is CLS4 "red" which is quite red on MESS but has some orange content on the Coco3. CLS2 "yellow" seems to have a slight greenish tint on the Coco3 compared to MESS. The other colors are essentially identical. The MESS colors seem very slightly more saturated but that is probably monitor differences.
|
|
|
|
Joined: May 2004
Posts: 979 Likes: 58
Senior Member
|
Senior Member
Joined: May 2004
Posts: 979 Likes: 58 |
Note that the Coco uses coco6847.c, so it hasn't actually been updated yet.
|
|
|
|
Joined: Jul 2009
Posts: 78
Member
|
OP
Member
Joined: Jul 2009
Posts: 78 |
Great, Curt.  But it would be good to document the origin of the values. What do you think of Belmont's ideia? The usual thing to do (as per e.g. NES) is to have PALETTE_INIT actually calculate the palette from the YUV values so it's documented where they come from. By the way, Curt, there's also the fact that although the MC6847's specs (TABLE 3 — DETAILED DESCRIPTION OF VDG MODES) says its Resolution Graphics modes' background is BLACK for both values of the CSS pin, in fact it is DARK GREEN when the pin CSS = 0 (i.e. when the foreground color is GREEN). Check out the videos, taken from a real MC-1000: - Alternating between Resolution Graphics 6 mode with MC6847's pin CSS=0 ("BLACK"/GREEN) and CSS=1 (BLACK/BUFF). The change in background color is perceivable.
http://www.ensjo.net/mc-1000/MVI_1261.AVI - Alternating of Resolution Graphics 6 mode with CSS=0 and Alphanumerics Internal mode with CSS=0 (GREEN text, not ORANGE) and INV=0 (bright chars on dark background). No change in background color is observed.
http://www.ensjo.net/mc-1000/MVI_1262.AVI
So on mc6847.c, instead of:
M6847_RGB(0x00, 0x00, 0x00), /* BLACK */
M6847_RGB(0x00, 0x7c, 0x00), /* GREEN */
we should have:
M6847_RGB(0x00, 0x7c, 0x00), /* DARK GREEN */
M6847_RGB(0x07, 0xff, 0x00), /* GREEN */
(Note that the GREEN color was wrong here.) PC-6001VW vs. MESS MC6847 color comparision:  Well... ORANGE in PC-6001W is so whitish, almost pink... And DARK ORANGE is just plain orange there. That simply is NOT what I see on my real-life MC-1000. [whiner]Oh... Green and orange text, normal and inverse, on the same screen... Damned MC-1000 designers, didn't wire MC6847 smartly to mix its screen modes. Since its BASIC is similar to Apple II's, probably they wanted to make it visually similar to Apple II on screen too (and that explains why the default text is bright on dark), so we have no block characters, no color, only inverse. So boring, booohooohoooo... :'(  [/whiner]
|
|
|
|
Joined: Jul 2009
Posts: 78
Member
|
OP
Member
Joined: Jul 2009
Posts: 78 |
it would be good to document the origin of the values. I added comments to explain the RGB colors. SVN diff:
Index: src/mess/video/m6847.c
===================================================================
--- src/mess/video/m6847.c (revision 9454)
+++ src/mess/video/m6847.c (working copy)
@@ -966,6 +966,60 @@
#define ATTOTIME_STRING_PRECISION 9
+/* MC6847 video output pins: Y, phiA, phiB (Y'UV color space).
+ *
+ * Y voltage levels:
+ * VB ("Black") = 0.72V; VWL ("White Low") = 0.65V; VWM ("White Medium") = 0.54V;
+ * VWH ("White High") = 0.42V.
+ *
+ * phiA and phiB voltage levels:
+ * VOL ("Output Low") = 1.0V; VR ("Reference"?) = 1.5V; VIH ("Input High") = 2.0V.
+ *
+ * Color composition:
+ *
+ * COLOR | Y | phiA | phiB
+ * ------------+-----+------+------
+ * GREEN | VWM | VOL | VOL
+ * YELLOW | VWH | VOL | VR
+ * BLUE | VWL | VIH | VR
+ * RED | VWL | VR | VIH
+ * WHITE | VWH | VR | VR
+ * CYAN | VWM | VR | VOL
+ * MAGENTA | VWM | VIH | VIH
+ * ORANGE | VWM | VOL | VIH
+ * BLACK | VB | VR | VR
+ * DARK GREEN | VB | VOL | VOL
+ * DARK ORANGE | VB | VOL | VIH
+ *
+ *
+ * Mapping voltages to a 0~255 range:
+ *
+ * Y values:
+ * VB = 0; VWL = 59; VWM = 153; VWH = 255.
+ *
+ * phiA and phiB values:
+ * VOL = -128; VR = 0; VIH = +128.
+ *
+ *
+ * Y'UV to RGB convertion:
+ * R = Y' + 1.13983 x U
+ * G = Y' - 0.39465 x U - 0.58060 x V
+ * B = Y' + 2.03211 x V
+ *
+ * So we get:
+ * GREEN = Y'UV(153,-128,-128) = RGB(7,277,-107) --> #07ff00
+ * YELLOW = Y'UV(255,-128,0) = RGB(255,305,-5) --> #ffff00
+ * BLUE = Y'UV(59,+128,0) = RGB(59,8,319) --> #3b08ff
+ * RED: Y'UV(59,0,+128) = RGB(204,-15,59) --> #cc003b
+ * WHITE: Y'UV(255,0,0) = RGB(255,255,255) --> #ffffff
+ * CYAN: Y'UV(153,0,-128) = RGB(7,227,153) --> #07e399
+ * MAGENTA: Y'UV(153,+128,+128) = RGB(298,28,413) --> #ff1cff
+ * ORANGE: Y'UV(153,-128,+128) = RGB(298,129,-107) --> #ff8100
+ * BLACK: Y'UV(0,0,0) = RGB(0,0,0) --> #000000
+ * DARK GREEN: Y'UV(0,-128,-128) = RGB(-145,124,-260) --> #007c00
+ * DARK ORANGE: Y'UV(0,-128,+128) = RGB(145,-23,-260) --> #910000
+ */
+
#define M6847_RGB(r,g,b) ((r << 16) | (g << 8) | (b << 0))
@@ -980,9 +1034,9 @@
M6847_RGB(0xff, 0x1c, 0xff), /* MAGENTA */
M6847_RGB(0xff, 0x81, 0x00), /* ORANGE */
+ M6847_RGB(0x00, 0x7c, 0x00), /* DARK GREEN */
+ M6847_RGB(0x07, 0xff, 0x00), /* GREEN */
M6847_RGB(0x00, 0x00, 0x00), /* BLACK */
- M6847_RGB(0x00, 0x7c, 0x00), /* GREEN */
- M6847_RGB(0x00, 0x00, 0x00), /* BLACK */
M6847_RGB(0xff, 0xff, 0xff), /* BUFF */
M6847_RGB(0x00, 0x7c, 0x00), /* ALPHANUMERIC DARK GREEN */
|
|
|
|
Joined: Jul 2009
Posts: 78
Member
|
OP
Member
Joined: Jul 2009
Posts: 78 |
CORRECTION!!! As I changed one of the two blacks in the default_palette[] array to dark green in the diff above, the text and semigraphic modes got their border and/or background color changed to dark green as well. A little fix and now they use the real black that remained. Please use this new diff instead of the one above:
Index: src/mess/video/m6847.c
===================================================================
--- src/mess/video/m6847.c (revision 9454)
+++ src/mess/video/m6847.c (working copy)
@@ -955,7 +955,7 @@
GREEN, YELLOW, BLUE, RED, /* 0 - 3 */
BUFF, CYAN, MAGENTA, ORANGE, /* 4 - 7 */
- BLACK, /* 8 */
+ BLACK = 10, /* 10 */
DKGREEN = 12, LTGREEN = 13, /* 12 - 13 */
DKORANGE = 14, LTORANGE = 15, /* 14 - 15 */
@@ -966,6 +966,60 @@
#define ATTOTIME_STRING_PRECISION 9
+/* MC6847 video output pins: Y, phiA, phiB (Y'UV color space).
+ *
+ * Y voltage levels:
+ * VB ("Black") = 0.72V; VWL ("White Low") = 0.65V; VWM ("White Medium") = 0.54V;
+ * VWH ("White High") = 0.42V.
+ *
+ * phiA and phiB voltage levels:
+ * VOL ("Output Low") = 1.0V; VR ("Reference"?) = 1.5V; VIH ("Input High") = 2.0V.
+ *
+ * Color composition:
+ *
+ * COLOR | Y | phiA | phiB
+ * ------------+-----+------+------
+ * GREEN | VWM | VOL | VOL
+ * YELLOW | VWH | VOL | VR
+ * BLUE | VWL | VIH | VR
+ * RED | VWL | VR | VIH
+ * WHITE | VWH | VR | VR
+ * CYAN | VWM | VR | VOL
+ * MAGENTA | VWM | VIH | VIH
+ * ORANGE | VWM | VOL | VIH
+ * BLACK | VB | VR | VR
+ * DARK GREEN | VB | VOL | VOL
+ * DARK ORANGE | VB | VOL | VIH
+ *
+ *
+ * Mapping voltages to a 0~255 range:
+ *
+ * Y values:
+ * VB = 0; VWL = 59; VWM = 153; VWH = 255.
+ *
+ * phiA and phiB values:
+ * VOL = -128; VR = 0; VIH = +128.
+ *
+ *
+ * Y'UV to RGB convertion:
+ * R = Y' + 1.13983 x U
+ * G = Y' - 0.39465 x U - 0.58060 x V
+ * B = Y' + 2.03211 x V
+ *
+ * So we get:
+ * GREEN = Y'UV(153,-128,-128) = RGB(7,277,-107) --> #07ff00
+ * YELLOW = Y'UV(255,-128,0) = RGB(255,305,-5) --> #ffff00
+ * BLUE = Y'UV(59,+128,0) = RGB(59,8,319) --> #3b08ff
+ * RED: Y'UV(59,0,+128) = RGB(204,-15,59) --> #cc003b
+ * WHITE: Y'UV(255,0,0) = RGB(255,255,255) --> #ffffff
+ * CYAN: Y'UV(153,0,-128) = RGB(7,227,153) --> #07e399
+ * MAGENTA: Y'UV(153,+128,+128) = RGB(298,28,413) --> #ff1cff
+ * ORANGE: Y'UV(153,-128,+128) = RGB(298,129,-107) --> #ff8100
+ * BLACK: Y'UV(0,0,0) = RGB(0,0,0) --> #000000
+ * DARK GREEN: Y'UV(0,-128,-128) = RGB(-145,124,-260) --> #007c00
+ * DARK ORANGE: Y'UV(0,-128,+128) = RGB(145,-23,-260) --> #910000
+ */
+
#define M6847_RGB(r,g,b) ((r << 16) | (g << 8) | (b << 0))
@@ -980,9 +1034,9 @@
M6847_RGB(0xff, 0x1c, 0xff), /* MAGENTA */
M6847_RGB(0xff, 0x81, 0x00), /* ORANGE */
+ M6847_RGB(0x00, 0x7c, 0x00), /* DARK GREEN */
+ M6847_RGB(0x07, 0xff, 0x00), /* GREEN */
M6847_RGB(0x00, 0x00, 0x00), /* BLACK */
- M6847_RGB(0x00, 0x7c, 0x00), /* GREEN */
- M6847_RGB(0x00, 0x00, 0x00), /* BLACK */
M6847_RGB(0xff, 0xff, 0xff), /* BUFF */
M6847_RGB(0x00, 0x7c, 0x00), /* ALPHANUMERIC DARK GREEN */
|
|
|
0 members (),
58
guests, and
3
robots. |
Key:
Admin,
Global Mod,
Mod
|
|
Forums9
Topics9,185
Posts120,285
Members5,044
|
Most Online1,283 Dec 21st, 2022
|
|
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!
|
|
|
|