summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/sun3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/sun3.cpp')
-rw-r--r--src/mame/drivers/sun3.cpp99
1 files changed, 33 insertions, 66 deletions
diff --git a/src/mame/drivers/sun3.cpp b/src/mame/drivers/sun3.cpp
index 01418f6ca10..5650ba652ed 100644
--- a/src/mame/drivers/sun3.cpp
+++ b/src/mame/drivers/sun3.cpp
@@ -283,8 +283,8 @@ private:
uint8_t rtc7170_r(offs_t offset);
void rtc7170_w(offs_t offset, uint8_t data);
+ template <unsigned W, unsigned H>
uint32_t bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- uint32_t bw2_16x11_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t bw2_350_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(sun3_timer);
@@ -898,57 +898,27 @@ TIMER_DEVICE_CALLBACK_MEMBER(sun3_state::sun3_timer)
}
}
+template <unsigned W, unsigned H>
uint32_t sun3_state::bw2_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint32_t *scanline;
- int x, y;
- uint8_t pixels;
static const uint32_t palette[2] = { 0, 0xffffff };
- uint8_t *m_vram = (uint8_t *)m_bw2_vram.target();
+ uint8_t const *const m_vram = (uint8_t *)m_bw2_vram.target();
- for (y = 0; y < 900; y++)
+ for (int y = 0; y < H; y++)
{
- scanline = &bitmap.pix32(y);
- for (x = 0; x < 1152/8; x++)
+ uint32_t *scanline = &bitmap.pix(y);
+ for (int x = 0; x < W/8; x++)
{
- pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))];
-
- *scanline++ = palette[(pixels>>7)&1];
- *scanline++ = palette[(pixels>>6)&1];
- *scanline++ = palette[(pixels>>5)&1];
- *scanline++ = palette[(pixels>>4)&1];
- *scanline++ = palette[(pixels>>3)&1];
- *scanline++ = palette[(pixels>>2)&1];
- *scanline++ = palette[(pixels>>1)&1];
- *scanline++ = palette[(pixels&1)];
- }
- }
- return 0;
-}
-
-uint32_t sun3_state::bw2_16x11_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
-{
- uint32_t *scanline;
- int x, y;
- uint8_t pixels;
- static const uint32_t palette[2] = { 0, 0xffffff };
- uint8_t *m_vram = (uint8_t *)m_bw2_vram.target();
-
- for (y = 0; y < 1100; y++)
- {
- scanline = &bitmap.pix32(y);
- for (x = 0; x < 1600/8; x++)
- {
- pixels = m_vram[(y * (1600/8)) + (BYTE4_XOR_BE(x))];
-
- *scanline++ = palette[(pixels>>7)&1];
- *scanline++ = palette[(pixels>>6)&1];
- *scanline++ = palette[(pixels>>5)&1];
- *scanline++ = palette[(pixels>>4)&1];
- *scanline++ = palette[(pixels>>3)&1];
- *scanline++ = palette[(pixels>>2)&1];
- *scanline++ = palette[(pixels>>1)&1];
- *scanline++ = palette[(pixels&1)];
+ uint8_t const pixels = m_vram[(y * (W/8)) + (BYTE4_XOR_BE(x))];
+
+ *scanline++ = palette[BIT(pixels, 7)];
+ *scanline++ = palette[BIT(pixels, 6)];
+ *scanline++ = palette[BIT(pixels, 5)];
+ *scanline++ = palette[BIT(pixels, 4)];
+ *scanline++ = palette[BIT(pixels, 3)];
+ *scanline++ = palette[BIT(pixels, 2)];
+ *scanline++ = palette[BIT(pixels, 1)];
+ *scanline++ = palette[BIT(pixels, 0)];
}
}
return 0;
@@ -956,27 +926,24 @@ uint32_t sun3_state::bw2_16x11_update(screen_device &screen, bitmap_rgb32 &bitma
uint32_t sun3_state::bw2_350_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint32_t *scanline;
- int x, y;
- uint8_t pixels;
static const uint32_t palette[2] = { 0, 0xffffff };
- uint8_t *m_vram = (uint8_t *)&m_ram_ptr[(0x100000>>2)];
+ uint8_t const *const m_vram = (uint8_t *)&m_ram_ptr[(0x100000>>2)];
- for (y = 0; y < 900; y++)
+ for (int y = 0; y < 900; y++)
{
- scanline = &bitmap.pix32(y);
- for (x = 0; x < 1152/8; x++)
+ uint32_t *scanline = &bitmap.pix(y);
+ for (int x = 0; x < 1152/8; x++)
{
- pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))];
-
- *scanline++ = palette[(pixels>>7)&1];
- *scanline++ = palette[(pixels>>6)&1];
- *scanline++ = palette[(pixels>>5)&1];
- *scanline++ = palette[(pixels>>4)&1];
- *scanline++ = palette[(pixels>>3)&1];
- *scanline++ = palette[(pixels>>2)&1];
- *scanline++ = palette[(pixels>>1)&1];
- *scanline++ = palette[(pixels&1)];
+ uint8_t const pixels = m_vram[(y * (1152/8)) + (BYTE4_XOR_BE(x))];
+
+ *scanline++ = palette[BIT(pixels, 7)];
+ *scanline++ = palette[BIT(pixels, 6)];
+ *scanline++ = palette[BIT(pixels, 5)];
+ *scanline++ = palette[BIT(pixels, 4)];
+ *scanline++ = palette[BIT(pixels, 3)];
+ *scanline++ = palette[BIT(pixels, 2)];
+ *scanline++ = palette[BIT(pixels, 1)];
+ *scanline++ = palette[BIT(pixels, 0)];
}
}
return 0;
@@ -1013,7 +980,7 @@ void sun3_state::sun3(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &sun3_state::sun3_mem);
screen_device &bwtwo(SCREEN(config, "bwtwo", SCREEN_TYPE_RASTER));
- bwtwo.set_screen_update(FUNC(sun3_state::bw2_update));
+ bwtwo.set_screen_update(NAME((&sun3_state::bw2_update<1152, 900>)));
bwtwo.set_size(1600,1100);
bwtwo.set_visarea(0, 1152-1, 0, 900-1);
bwtwo.set_refresh_hz(72);
@@ -1079,7 +1046,7 @@ void sun3_state::sun3_60(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &sun3_state::sun3_mem);
screen_device &bwtwo(*subdevice<screen_device>("bwtwo"));
- bwtwo.set_screen_update(FUNC(sun3_state::bw2_16x11_update));
+ bwtwo.set_screen_update(NAME((&sun3_state::bw2_update<1600, 1100>)));
bwtwo.set_size(1600,1100);
bwtwo.set_visarea(0, 1600-1, 0, 1100-1);
bwtwo.set_refresh_hz(72);
@@ -1102,7 +1069,7 @@ void sun3_state::sun3200(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &sun3_state::sun3_mem);
screen_device &bwtwo(*subdevice<screen_device>("bwtwo"));
- bwtwo.set_screen_update(FUNC(sun3_state::bw2_16x11_update));
+ bwtwo.set_screen_update(NAME((&sun3_state::bw2_update<1600, 1100>)));
bwtwo.set_size(1600,1100);
bwtwo.set_visarea(0, 1600-1, 0, 1100-1);
bwtwo.set_refresh_hz(72);