diff options
Diffstat (limited to 'src/mame/video/fastfred.cpp')
-rw-r--r-- | src/mame/video/fastfred.cpp | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/src/mame/video/fastfred.cpp b/src/mame/video/fastfred.cpp index c32c7eefe1c..73aad7722d0 100644 --- a/src/mame/video/fastfred.cpp +++ b/src/mame/video/fastfred.cpp @@ -25,51 +25,49 @@ ***************************************************************************/ -PALETTE_INIT_MEMBER(fastfred_state,fastfred) +void fastfred_state::fastfred_palette(palette_device &palette) const { - const uint8_t *color_prom = memregion("proms")->base(); - static const int resistances[4] = { 1000, 470, 220, 100 }; - double rweights[4], gweights[4], bweights[4]; - int i; + uint8_t const *const color_prom = memregion("proms")->base(); + static constexpr int resistances[4] = { 1000, 470, 220, 100 }; - /* compute the color output resistor weights */ + // compute the color output resistor weights + double rweights[4], gweights[4], bweights[4]; compute_resistor_weights(0, 255, -1.0, 4, resistances, rweights, 470, 0, 4, resistances, gweights, 470, 0, 4, resistances, bweights, 470, 0); - /* create a lookup table for the palette */ - for (i = 0; i < 0x100; i++) + // create a lookup table for the palette + for (int i = 0; i < 0x100; i++) { int bit0, bit1, bit2, bit3; - int r, g, b; - - /* red component */ - bit0 = (color_prom[i + 0x000] >> 0) & 0x01; - bit1 = (color_prom[i + 0x000] >> 1) & 0x01; - bit2 = (color_prom[i + 0x000] >> 2) & 0x01; - bit3 = (color_prom[i + 0x000] >> 3) & 0x01; - r = combine_4_weights(rweights, bit0, bit1, bit2, bit3); - - /* green component */ - bit0 = (color_prom[i + 0x100] >> 0) & 0x01; - bit1 = (color_prom[i + 0x100] >> 1) & 0x01; - bit2 = (color_prom[i + 0x100] >> 2) & 0x01; - bit3 = (color_prom[i + 0x100] >> 3) & 0x01; - g = combine_4_weights(gweights, bit0, bit1, bit2, bit3); - - /* blue component */ - bit0 = (color_prom[i + 0x200] >> 0) & 0x01; - bit1 = (color_prom[i + 0x200] >> 1) & 0x01; - bit2 = (color_prom[i + 0x200] >> 2) & 0x01; - bit3 = (color_prom[i + 0x200] >> 3) & 0x01; - b = combine_4_weights(bweights, bit0, bit1, bit2, bit3); + + // red component + bit0 = BIT(color_prom[i | 0x000], 0); + bit1 = BIT(color_prom[i | 0x000], 1); + bit2 = BIT(color_prom[i | 0x000], 2); + bit3 = BIT(color_prom[i | 0x000], 3); + int const r = combine_4_weights(rweights, bit0, bit1, bit2, bit3); + + // green component + bit0 = BIT(color_prom[i | 0x100], 0); + bit1 = BIT(color_prom[i | 0x100], 1); + bit2 = BIT(color_prom[i | 0x100], 2); + bit3 = BIT(color_prom[i | 0x100], 3); + int const g = combine_4_weights(gweights, bit0, bit1, bit2, bit3); + + // blue component + bit0 = BIT(color_prom[i | 0x200], 0); + bit1 = BIT(color_prom[i | 0x200], 1); + bit2 = BIT(color_prom[i | 0x200], 2); + bit3 = BIT(color_prom[i | 0x200], 3); + int const b = combine_4_weights(bweights, bit0, bit1, bit2, bit3); palette.set_indirect_color(i, rgb_t(r, g, b)); } - /* characters and sprites use the same palette */ - for (i = 0; i < 0x100; i++) + // characters and sprites use the same palette + for (int i = 0; i < 0x100; i++) palette.set_pen_indirect(i, i); } |