summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/timelimt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/timelimt.cpp')
-rw-r--r--src/mame/video/timelimt.cpp54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/mame/video/timelimt.cpp b/src/mame/video/timelimt.cpp
index 40ec0718dab..1d3f1020e55 100644
--- a/src/mame/video/timelimt.cpp
+++ b/src/mame/video/timelimt.cpp
@@ -23,41 +23,41 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(timelimt_state, timelimt)
+void timelimt_state::timelimt_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double weights_r[3], weights_g[3], weights_b[2];
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
+
+ uint8_t const *const color_prom = memregion("proms")->base();
+ double weights_r[3], weights_g[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_r, 0, 0,
3, resistances_rg, weights_g, 0, 0,
2, resistances_b, weights_b, 0, 0);
-
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- r = combine_3_weights(weights_r, bit0, bit1, bit2);
- /* green component */
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = combine_3_weights(weights_g, bit0, bit1, bit2);
- /* blue component */
- bit0 = (*color_prom >> 6) & 0x01;
- bit1 = (*color_prom >> 7) & 0x01;
- b = combine_2_weights(weights_b, bit0, bit1);
-
- palette.set_pen_color(i,rgb_t(r,g,b));
- color_prom++;
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(weights_g, bit0, bit1, bit2);
+
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}