summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/docastle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/docastle.cpp')
-rw-r--r--src/mame/video/docastle.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/mame/video/docastle.cpp b/src/mame/video/docastle.cpp
index 38ed7995853..4bad4c21b5d 100644
--- a/src/mame/video/docastle.cpp
+++ b/src/mame/video/docastle.cpp
@@ -30,37 +30,37 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(docastle_state, docastle)
+void docastle_state::docastle_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (*color_prom >> 5) & 0x01;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
- r = 0x23 * bit0 + 0x4b * bit1 + 0x91 * bit2;
- /* green component */
- bit0 = (*color_prom >> 2) & 0x01;
- bit1 = (*color_prom >> 3) & 0x01;
- bit2 = (*color_prom >> 4) & 0x01;
- g = 0x23 * bit0 + 0x4b * bit1 + 0x91 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 5);
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const r = 0x23 * bit0 + 0x4b * bit1 + 0x91 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i], 3);
+ bit2 = BIT(color_prom[i], 4);
+ int const g = 0x23 * bit0 + 0x4b * bit1 + 0x91 * bit2;
+
+ // blue component
bit0 = 0;
- bit1 = (*color_prom >> 0) & 0x01;
- bit2 = (*color_prom >> 1) & 0x01;
- b = 0x23 * bit0 + 0x4b * bit1 + 0x91 * bit2;
+ bit1 = BIT(color_prom[i], 0);
+ bit2 = BIT(color_prom[i], 1);
+ int const b = 0x23 * bit0 + 0x4b * bit1 + 0x91 * bit2;
/* because the graphics are decoded as 4bpp with the top bit used for transparency
or priority, we create matching 3bpp sets of palette entries, which effectively
ignores the value of the top bit */
- palette.set_pen_color(((i & 0xf8) << 1) | 0x00 | (i & 0x07), rgb_t(r,g,b));
- palette.set_pen_color(((i & 0xf8) << 1) | 0x08 | (i & 0x07), rgb_t(r,g,b));
- color_prom++;
+ palette.set_pen_color(((i & 0xf8) << 1) | 0x00 | (i & 0x07), rgb_t(r, g, b));
+ palette.set_pen_color(((i & 0xf8) << 1) | 0x08 | (i & 0x07), rgb_t(r, g, b));
}
}