summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/video/marineb.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/video/marineb.cpp')
-rw-r--r--src/mame/video/marineb.cpp41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/mame/video/marineb.cpp b/src/mame/video/marineb.cpp
index 6404dd213af..11fd9de48fb 100644
--- a/src/mame/video/marineb.cpp
+++ b/src/mame/video/marineb.cpp
@@ -12,32 +12,31 @@
#include "includes/marineb.h"
-PALETTE_INIT_MEMBER(marineb_state, marineb)
+void marineb_state::marineb_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 < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i + palette.entries()] >> 0) & 0x01;
- bit2 = (color_prom[i + palette.entries()] >> 1) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ 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 = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3) & 0x01;
+ bit1 = BIT(color_prom[i + palette.entries()], 0);
+ bit2 = BIT(color_prom[i + palette.entries()], 1);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i + palette.entries()] >> 2) & 0x01;
- bit2 = (color_prom[i + palette.entries()] >> 3) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i + palette.entries()], 2);
+ bit2 = BIT(color_prom[i + palette.entries()], 3);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}