summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/lucky74.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/lucky74.cpp')
-rw-r--r--src/mame/video/lucky74.cpp112
1 files changed, 54 insertions, 58 deletions
diff --git a/src/mame/video/lucky74.cpp b/src/mame/video/lucky74.cpp
index 309c71df8ef..b295311e6c2 100644
--- a/src/mame/video/lucky74.cpp
+++ b/src/mame/video/lucky74.cpp
@@ -125,74 +125,70 @@ WRITE8_MEMBER(lucky74_state::lucky74_bg_colorram_w)
}
-PALETTE_INIT_MEMBER(lucky74_state, lucky74)
-/*
- There are 2 states (see the technical notes).
- We're constructing a double-sized palette with one half for each state.
-*/
+void lucky74_state::lucky74_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- static const int resistances_rgb[4] = { 2000, 1000, 470, 220 };
- double weights_r[4], weights_g[4], weights_b[4];
+ // There are 2 states (see the technical notes).
+ // We're constructing a double-sized palette with one half for each state.
+ uint8_t const *const color_prom = memregion("proms")->base();
+ static constexpr int resistances_rgb[4] = { 2000, 1000, 470, 220 };
+ double weights_r[4], weights_g[4], weights_b[4];
compute_resistor_weights(0, 255, -1.0,
4, resistances_rgb, weights_r, 1000, 0,
4, resistances_rgb, weights_g, 1000, 0,
4, resistances_rgb, weights_b, 1000, 0);
-
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
{
- int bit0, bit1, bit2, bit3, r1, g1, b1, r2, g2, b2;
-
- /* red component (this 1, PROM E6) */
- bit0 = (color_prom[0x000 + i] >> 0) & 0x01;
- bit1 = (color_prom[0x000 + i] >> 1) & 0x01;
- bit2 = (color_prom[0x000 + i] >> 2) & 0x01;
- bit3 = (color_prom[0x000 + i] >> 3) & 0x01;
- r1 = combine_4_weights(weights_r, bit0, bit1, bit2, bit3);
-
- /* red component (this 2, PROM E7) */
- bit0 = (color_prom[0x100 + i] >> 0) & 0x01;
- bit1 = (color_prom[0x100 + i] >> 1) & 0x01;
- bit2 = (color_prom[0x100 + i] >> 2) & 0x01;
- bit3 = (color_prom[0x100 + i] >> 3) & 0x01;
- r2 = combine_4_weights(weights_r, bit0, bit1, bit2, bit3);
-
- /* green component (this 1, PROM D6) */
- bit0 = (color_prom[0x200 + i] >> 0) & 0x01;
- bit1 = (color_prom[0x200 + i] >> 1) & 0x01;
- bit2 = (color_prom[0x200 + i] >> 2) & 0x01;
- bit3 = (color_prom[0x200 + i] >> 3) & 0x01;
- g1 = combine_4_weights(weights_g, bit0, bit1, bit2, bit3);
-
- /* green component (this 2, PROM D7) */
- bit0 = (color_prom[0x300 + i] >> 0) & 0x01;
- bit1 = (color_prom[0x300 + i] >> 1) & 0x01;
- bit2 = (color_prom[0x300 + i] >> 2) & 0x01;
- bit3 = (color_prom[0x300 + i] >> 3) & 0x01;
- g2 = combine_4_weights(weights_g, bit0, bit1, bit2, bit3);
-
- /* blue component (this 1, PROM C6) */
- bit0 = (color_prom[0x400 + i] >> 0) & 0x01;
- bit1 = (color_prom[0x400 + i] >> 1) & 0x01;
- bit2 = (color_prom[0x400 + i] >> 2) & 0x01;
- bit3 = (color_prom[0x400 + i] >> 3) & 0x01;
- b1 = combine_4_weights(weights_b, bit0, bit1, bit2, bit3);
-
- /* blue component (this 2, PROM C7) */
- bit0 = (color_prom[0x500 + i] >> 0) & 0x01;
- bit1 = (color_prom[0x500 + i] >> 1) & 0x01;
- bit2 = (color_prom[0x500 + i] >> 2) & 0x01;
- bit3 = (color_prom[0x500 + i] >> 3) & 0x01;
- b2 = combine_4_weights(weights_b, bit0, bit1, bit2, bit3);
-
-
- /* PROMs circuitry, 1st state */
+ int bit0, bit1, bit2, bit3;
+
+ // red component (this 1, PROM E6)
+ bit0 = BIT(color_prom[0x000 + i], 0);
+ bit1 = BIT(color_prom[0x000 + i], 1);
+ bit2 = BIT(color_prom[0x000 + i], 2);
+ bit3 = BIT(color_prom[0x000 + i], 3);
+ int const r1 = combine_4_weights(weights_r, bit0, bit1, bit2, bit3);
+
+ // red component (this 2, PROM E7)
+ bit0 = BIT(color_prom[0x100 + i], 0);
+ bit1 = BIT(color_prom[0x100 + i], 1);
+ bit2 = BIT(color_prom[0x100 + i], 2);
+ bit3 = BIT(color_prom[0x100 + i], 3);
+ int const r2 = combine_4_weights(weights_r, bit0, bit1, bit2, bit3);
+
+ // green component (this 1, PROM D6)
+ bit0 = BIT(color_prom[0x200 + i], 0);
+ bit1 = BIT(color_prom[0x200 + i], 1);
+ bit2 = BIT(color_prom[0x200 + i], 2);
+ bit3 = BIT(color_prom[0x200 + i], 3);
+ int const g1 = combine_4_weights(weights_g, bit0, bit1, bit2, bit3);
+
+ // green component (this 2, PROM D7)
+ bit0 = BIT(color_prom[0x300 + i], 0);
+ bit1 = BIT(color_prom[0x300 + i], 1);
+ bit2 = BIT(color_prom[0x300 + i], 2);
+ bit3 = BIT(color_prom[0x300 + i], 3);
+ int const g2 = combine_4_weights(weights_g, bit0, bit1, bit2, bit3);
+
+ // blue component (this 1, PROM C6)
+ bit0 = BIT(color_prom[0x400 + i], 0);
+ bit1 = BIT(color_prom[0x400 + i], 1);
+ bit2 = BIT(color_prom[0x400 + i], 2);
+ bit3 = BIT(color_prom[0x400 + i], 3);
+ int const b1 = combine_4_weights(weights_b, bit0, bit1, bit2, bit3);
+
+ // blue component (this 2, PROM C7)
+ bit0 = BIT(color_prom[0x500 + i], 0);
+ bit1 = BIT(color_prom[0x500 + i], 1);
+ bit2 = BIT(color_prom[0x500 + i], 2);
+ bit3 = BIT(color_prom[0x500 + i], 3);
+ int const b2 = combine_4_weights(weights_b, bit0, bit1, bit2, bit3);
+
+
+ // PROMs circuitry, 1st state
palette.set_pen_color(i, rgb_t(r1, g1, b1));
- /* PROMs circuitry, 2nd state */
+ // PROMs circuitry, 2nd state
palette.set_pen_color(i + 256, rgb_t(r2, g2, b2));
}
}