diff options
Diffstat (limited to 'src/mame/video/travrusa.cpp')
-rw-r--r-- | src/mame/video/travrusa.cpp | 174 |
1 files changed, 84 insertions, 90 deletions
diff --git a/src/mame/video/travrusa.cpp b/src/mame/video/travrusa.cpp index 29319501c49..42749cf2def 100644 --- a/src/mame/video/travrusa.cpp +++ b/src/mame/video/travrusa.cpp @@ -40,148 +40,142 @@ J Clegg ***************************************************************************/ -PALETTE_INIT_MEMBER(travrusa_state, travrusa) +void travrusa_state::travrusa_palette(palette_device &palette) const { const uint8_t *color_prom = memregion("proms")->base(); - int i; - /* create a lookup table for the palette */ - for (i = 0; i < 0x80; i++) + // create a lookup table for the palette + for (int i = 0; i < 0x80; i++) { int bit0, bit1, bit2; - int r, g, b; - /* red component */ + // red component bit0 = 0; - bit1 = (color_prom[i] >> 6) & 0x01; - bit2 = (color_prom[i] >> 7) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - /* green component */ - bit0 = (color_prom[i] >> 3) & 0x01; - bit1 = (color_prom[i] >> 4) & 0x01; - bit2 = (color_prom[i] >> 5) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - /* blue component */ - bit0 = (color_prom[i] >> 0) & 0x01; - bit1 = (color_prom[i] >> 1) & 0x01; - bit2 = (color_prom[i] >> 2) & 0x01; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + bit1 = BIT(color_prom[i], 6); + bit2 = BIT(color_prom[i], 7); + int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // green component + bit0 = BIT(color_prom[i], 3); + bit1 = BIT(color_prom[i], 4); + bit2 = BIT(color_prom[i], 5); + int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // blue component + bit0 = BIT(color_prom[i], 0); + bit1 = BIT(color_prom[i], 1); + bit2 = BIT(color_prom[i], 2); + int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; palette.set_indirect_color(i, rgb_t(r, g, b)); } - for (i = 0x80; i < 0x90; i++) + for (int i = 0x80; i < 0x90; i++) { int bit0, bit1, bit2; - int r, g, b; - /* red component */ + // red component bit0 = 0; - bit1 = (color_prom[(i - 0x80) + 0x200] >> 6) & 0x01; - bit2 = (color_prom[(i - 0x80) + 0x200] >> 7) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - /* green component */ - bit0 = (color_prom[(i - 0x80) + 0x200] >> 3) & 0x01; - bit1 = (color_prom[(i - 0x80) + 0x200] >> 4) & 0x01; - bit2 = (color_prom[(i - 0x80) + 0x200] >> 5) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - /* blue component */ - bit0 = (color_prom[(i - 0x80) + 0x200] >> 0) & 0x01; - bit1 = (color_prom[(i - 0x80) + 0x200] >> 1) & 0x01; - bit2 = (color_prom[(i - 0x80) + 0x200] >> 2) & 0x01; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + bit1 = BIT(color_prom[(i - 0x80) + 0x200], 6); + bit2 = BIT(color_prom[(i - 0x80) + 0x200], 7); + int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // green component + bit0 = BIT(color_prom[(i - 0x80) + 0x200], 3); + bit1 = BIT(color_prom[(i - 0x80) + 0x200], 4); + bit2 = BIT(color_prom[(i - 0x80) + 0x200], 5); + int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // blue component + bit0 = BIT(color_prom[(i - 0x80) + 0x200], 0); + bit1 = BIT(color_prom[(i - 0x80) + 0x200], 1); + bit2 = BIT(color_prom[(i - 0x80) + 0x200], 2); + int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; palette.set_indirect_color(i, rgb_t(r, g, b)); } - /* color_prom now points to the beginning of the lookup table */ + // color_prom now points to the beginning of the lookup table color_prom += 0x220; - /* characters */ - for (i = 0; i < 0x80; i++) + // characters + for (int i = 0; i < 0x80; i++) palette.set_pen_indirect(i, i); - /* sprites */ - for (i = 0x80; i < 0x100; i++) + // sprites + for (int i = 0x80; i < 0x100; i++) { - uint8_t ctabentry = (color_prom[i - 0x80] & 0x0f) | 0x80; + uint8_t const ctabentry = (color_prom[i - 0x80] & 0x0f) | 0x80; palette.set_pen_indirect(i, ctabentry); } } -PALETTE_INIT_MEMBER(travrusa_state,shtrider) +void travrusa_state::shtrider_palette(palette_device &palette) const { const uint8_t *color_prom = memregion("proms")->base(); - int i; - /* create a lookup table for the palette */ - for (i = 0; i < 0x80; i++) + // create a lookup table for the palette + for (int i = 0; i < 0x80; i++) { int bit0, bit1, bit2; - int r, g, b; - /* red component */ + // red component bit0 = 0; - bit1 = (color_prom[i + 0x000] >> 2) & 0x01; - bit2 = (color_prom[i + 0x000] >> 3) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - /* green component */ - bit0 = (color_prom[i + 0x100] >> 3) & 0x01; - bit1 = (color_prom[i + 0x000] >> 0) & 0x01; - bit2 = (color_prom[i + 0x000] >> 1) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - /* blue component */ - bit0 = (color_prom[i + 0x100] >> 0) & 0x01; - bit1 = (color_prom[i + 0x100] >> 1) & 0x01; - bit2 = (color_prom[i + 0x100] >> 2) & 0x01; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + bit1 = BIT(color_prom[i + 0x000], 2); + bit2 = BIT(color_prom[i + 0x000], 3); + int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // green component + bit0 = BIT(color_prom[i + 0x100], 3); + bit1 = BIT(color_prom[i + 0x000], 0); + bit2 = BIT(color_prom[i + 0x000], 1); + int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // blue component + bit0 = BIT(color_prom[i + 0x100], 0); + bit1 = BIT(color_prom[i + 0x100], 1); + bit2 = BIT(color_prom[i + 0x100], 2); + int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; palette.set_indirect_color(i, rgb_t(r, g, b)); } - for (i = 0x80; i < 0x90; i++) + for (int i = 0x80; i < 0x90; i++) { int bit0, bit1, bit2; - int r, g, b; - /* red component */ + // red component bit0 = 0; - bit1 = (color_prom[(i - 0x80) + 0x200] >> 6) & 0x01; - bit2 = (color_prom[(i - 0x80) + 0x200] >> 7) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - /* green component */ - bit0 = (color_prom[(i - 0x80) + 0x200] >> 3) & 0x01; - bit1 = (color_prom[(i - 0x80) + 0x200] >> 4) & 0x01; - bit2 = (color_prom[(i - 0x80) + 0x200] >> 5) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - /* blue component */ - bit0 = (color_prom[(i - 0x80) + 0x200] >> 0) & 0x01; - bit1 = (color_prom[(i - 0x80) + 0x200] >> 1) & 0x01; - bit2 = (color_prom[(i - 0x80) + 0x200] >> 2) & 0x01; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + bit1 = BIT(color_prom[(i - 0x80) + 0x200], 6); + bit2 = BIT(color_prom[(i - 0x80) + 0x200], 7); + int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // green component + bit0 = BIT(color_prom[(i - 0x80) + 0x200], 3); + bit1 = BIT(color_prom[(i - 0x80) + 0x200], 4); + bit2 = BIT(color_prom[(i - 0x80) + 0x200], 5); + int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + // blue component + bit0 = BIT(color_prom[(i - 0x80) + 0x200], 0); + bit1 = BIT(color_prom[(i - 0x80) + 0x200], 1); + bit2 = BIT(color_prom[(i - 0x80) + 0x200], 2); + int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; palette.set_indirect_color(i, rgb_t(r, g, b)); } - /* color_prom now points to the beginning of the lookup table */ + // color_prom now points to the beginning of the lookup table color_prom += 0x220; - /* characters */ - for (i = 0; i < 0x80; i++) + // characters + for (int i = 0; i < 0x80; i++) palette.set_pen_indirect(i, i); - /* sprites */ - for (i = 0x80; i < 0x100; i++) + // sprites + for (int i = 0x80; i < 0x100; i++) { - uint8_t ctabentry = (color_prom[i - 0x80] & 0x0f) | 0x80; + uint8_t const ctabentry = (color_prom[i - 0x80] & 0x0f) | 0x80; palette.set_pen_indirect(i, ctabentry); } } |