summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author shattered <shattered@users.noreply.github.com>2019-07-06 22:21:19 +0300
committer R. Belmont <rb6502@users.noreply.github.com>2019-07-06 15:21:19 -0400
commitce5a23d49f2c9905f491600b9e238a341d280ed1 (patch)
treed8492b8221fa41a60332bc826d2b85fa9c0b99eb
parent79892df49875d3e090d555c22423837617f3702c (diff)
various: de-unroll loops in pixel drawing routines, drop scanline_callback (#5308)
* isa_pgc: drop the scanline_callback (nw) * various: de-unroll loops in pixel drawing routines (nw)
-rw-r--r--src/devices/bus/isa/pgc.cpp43
-rw-r--r--src/devices/bus/isa/pgc.h3
-rw-r--r--src/devices/video/hp1ll3.cpp20
-rw-r--r--src/mame/drivers/att4425.cpp12
-rw-r--r--src/mame/drivers/bitgraph.cpp26
-rw-r--r--src/mame/drivers/dvk_ksm.cpp11
-rw-r--r--src/mame/drivers/eurocom2.cpp12
-rw-r--r--src/mame/drivers/gridcomp.cpp20
-rw-r--r--src/mame/drivers/ibm6580.cpp24
9 files changed, 47 insertions, 124 deletions
diff --git a/src/devices/bus/isa/pgc.cpp b/src/devices/bus/isa/pgc.cpp
index d90badaeae7..9e65cd819d0 100644
--- a/src/devices/bus/isa/pgc.cpp
+++ b/src/devices/bus/isa/pgc.cpp
@@ -159,10 +159,6 @@ void isa8_pgc_device::device_add_mconfig(machine_config &config)
m_cpu->set_irq_acknowledge_callback(FUNC(isa8_pgc_device::irq_callback));
#endif
- timer_device &scantimer(TIMER(config, "scantimer"));
- scantimer.configure_periodic(FUNC(isa8_pgc_device::scanline_callback), attotime::from_hz(60*PGC_TOTAL_VERT));
- scantimer.set_start_delay(attotime::from_hz(XTAL(50'000'000)/(2*PGC_HORZ_START)));
-
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(XTAL(50'000'000)/2,
PGC_TOTAL_HORZ, PGC_HORZ_START, PGC_HORZ_START+PGC_DISP_HORZ,
@@ -214,15 +210,12 @@ isa8_pgc_device::isa8_pgc_device(const machine_config &mconfig, device_type type
m_cpu(*this, "maincpu"),
m_screen(*this, PGC_SCREEN_NAME),
m_palette(*this, "palette"),
- m_commarea(nullptr), m_vram(nullptr), m_eram(nullptr), m_bitmap(nullptr)
+ m_commarea(nullptr), m_vram(nullptr), m_eram(nullptr)
{
}
void isa8_pgc_device::device_start()
{
- int width = PGC_DISP_HORZ;
- int height = PGC_DISP_VERT;
-
if (m_palette != nullptr && !m_palette->started())
throw device_missing_dependencies();
@@ -233,9 +226,6 @@ void isa8_pgc_device::device_start()
m_palette->set_pen_color(i, 0, 0, 0);
}
- m_bitmap = std::make_unique<bitmap_ind16>(width, height);
- m_bitmap->fill(0);
-
m_vram = std::make_unique<uint8_t[]>(0x78000);
m_eram = std::make_unique<uint8_t[]>(0x8000);
@@ -405,32 +395,21 @@ READ8_MEMBER(isa8_pgc_device::init_r)
return 0; // XXX ignored
}
-TIMER_DEVICE_CALLBACK_MEMBER(isa8_pgc_device::scanline_callback)
+uint32_t isa8_pgc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- uint16_t x, y = m_screen->vpos();
uint16_t *p;
uint8_t *v;
- // XXX hpos shifts every frame -- fix
- if (y == 0) LOGCMD("scanline_cb frame %d x %.4d y %.3d\n",
- (int) m_screen->frame_number(), m_screen->hpos(), y);
-
- if (y < PGC_VERT_START) return;
- y -= PGC_VERT_START;
- if (y >= PGC_DISP_VERT) return;
-
- // XXX address translation happens in hardware
- v = &m_vram[y * 1024];
- p = &m_bitmap->pix16(y, 0);
-
- for (x = 0; x < PGC_DISP_HORZ; x++)
+ for (int y = 0; y < PGC_DISP_VERT; y++)
{
- *p++ = *v++;
+ // XXX address translation happens in hardware
+ v = &m_vram[y * 1024];
+ p = &bitmap.pix16(y + PGC_VERT_START, PGC_HORZ_START);
+
+ for (int x = 0; x < PGC_DISP_HORZ; x++)
+ {
+ *p++ = *v++;
+ }
}
-}
-
-uint32_t isa8_pgc_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
-{
- copybitmap(bitmap, *m_bitmap, 0, 0, PGC_HORZ_START, PGC_VERT_START, cliprect);
return 0;
}
diff --git a/src/devices/bus/isa/pgc.h b/src/devices/bus/isa/pgc.h
index a2dc5e50c45..a022812cd52 100644
--- a/src/devices/bus/isa/pgc.h
+++ b/src/devices/bus/isa/pgc.h
@@ -41,8 +41,6 @@ protected:
private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- TIMER_DEVICE_CALLBACK_MEMBER(scanline_callback);
-
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
IRQ_CALLBACK_MEMBER(irq_callback);
@@ -68,7 +66,6 @@ private:
std::unique_ptr<uint8_t[]> m_eram;
uint8_t m_stateparam[16];
uint8_t m_lut[256 * 3];
- std::unique_ptr<bitmap_ind16> m_bitmap;
int m_accel;
};
diff --git a/src/devices/video/hp1ll3.cpp b/src/devices/video/hp1ll3.cpp
index 5f34138f940..5394e2145fd 100644
--- a/src/devices/video/hp1ll3.cpp
+++ b/src/devices/video/hp1ll3.cpp
@@ -823,22 +823,10 @@ uint32_t hp1ll3_device::screen_update(screen_device &screen, bitmap_ind16 &bitma
{
uint16_t const gfx = m_videoram[x];
- *p++ = BIT(gfx, 15);
- *p++ = BIT(gfx, 14);
- *p++ = BIT(gfx, 13);
- *p++ = BIT(gfx, 12);
- *p++ = BIT(gfx, 11);
- *p++ = BIT(gfx, 10);
- *p++ = BIT(gfx, 9);
- *p++ = BIT(gfx, 8);
- *p++ = BIT(gfx, 7);
- *p++ = BIT(gfx, 6);
- *p++ = BIT(gfx, 5);
- *p++ = BIT(gfx, 4);
- *p++ = BIT(gfx, 3);
- *p++ = BIT(gfx, 2);
- *p++ = BIT(gfx, 1);
- *p++ = BIT(gfx, 0);
+ for (int i = 15; i >= 0; i--)
+ {
+ *p++ = BIT(gfx, i);
+ }
}
}
diff --git a/src/mame/drivers/att4425.cpp b/src/mame/drivers/att4425.cpp
index 4fe4294b5a9..0dab4bf2d4b 100644
--- a/src/mame/drivers/att4425.cpp
+++ b/src/mame/drivers/att4425.cpp
@@ -177,14 +177,10 @@ uint32_t att4425_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
gfx ^= 255;
/* Display a scanline of a character */
- *p++ = BIT(gfx, 7) ? fg : bg;
- *p++ = BIT(gfx, 6) ? fg : bg;
- *p++ = BIT(gfx, 5) ? fg : bg;
- *p++ = BIT(gfx, 4) ? fg : bg;
- *p++ = BIT(gfx, 3) ? fg : bg;
- *p++ = BIT(gfx, 2) ? fg : bg;
- *p++ = BIT(gfx, 1) ? fg : bg;
- *p++ = BIT(gfx, 0) ? fg : bg;
+ for (int i = 7; i >= 0; i--)
+ {
+ *p++ = BIT(gfx, i) ? fg : bg;
+ }
*p++ = bg;
}
}
diff --git a/src/mame/drivers/bitgraph.cpp b/src/mame/drivers/bitgraph.cpp
index 06e5d9d2c3b..9646fe623ca 100644
--- a/src/mame/drivers/bitgraph.cpp
+++ b/src/mame/drivers/bitgraph.cpp
@@ -394,26 +394,16 @@ uint32_t bitgraph_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
for (x = 0; x < 1024 / 8; x += 2)
{
gfx = m_videoram[(x + 1) | (y << 7)];
-
- *p++ = BIT(gfx, 7);
- *p++ = BIT(gfx, 6);
- *p++ = BIT(gfx, 5);
- *p++ = BIT(gfx, 4);
- *p++ = BIT(gfx, 3);
- *p++ = BIT(gfx, 2);
- *p++ = BIT(gfx, 1);
- *p++ = BIT(gfx, 0);
+ for (int i = 7; i >= 0; i--)
+ {
+ *p++ = BIT(gfx, i);
+ }
gfx = m_videoram[x | (y << 7)];
-
- *p++ = BIT(gfx, 7);
- *p++ = BIT(gfx, 6);
- *p++ = BIT(gfx, 5);
- *p++ = BIT(gfx, 4);
- *p++ = BIT(gfx, 3);
- *p++ = BIT(gfx, 2);
- *p++ = BIT(gfx, 1);
- *p++ = BIT(gfx, 0);
+ for (int i = 7; i >= 0; i--)
+ {
+ *p++ = BIT(gfx, i);
+ }
}
}
return 0;
diff --git a/src/mame/drivers/dvk_ksm.cpp b/src/mame/drivers/dvk_ksm.cpp
index a1e0b109afa..4ed4f335f49 100644
--- a/src/mame/drivers/dvk_ksm.cpp
+++ b/src/mame/drivers/dvk_ksm.cpp
@@ -351,13 +351,10 @@ uint32_t ksm_state::draw_scanline(uint16_t *p, uint16_t offset, uint8_t scanline
if ((scanline > 7 && blink) || ((chr < (0x20 << 3)) && !blink)) gfx = 0;
- *p++ = BIT(gfx, 6) ? fg : bg;
- *p++ = BIT(gfx, 5) ? fg : bg;
- *p++ = BIT(gfx, 4) ? fg : bg;
- *p++ = BIT(gfx, 3) ? fg : bg;
- *p++ = BIT(gfx, 2) ? fg : bg;
- *p++ = BIT(gfx, 1) ? fg : bg;
- *p++ = BIT(gfx, 0) ? fg : bg;
+ for (int i = 6; i >= 0; i--)
+ {
+ *p++ = BIT(gfx, i) ? fg : bg;
+ }
*p++ = bg;
*p++ = bg;
*p++ = bg;
diff --git a/src/mame/drivers/eurocom2.cpp b/src/mame/drivers/eurocom2.cpp
index 9f916f38183..a4dcc042ae1 100644
--- a/src/mame/drivers/eurocom2.cpp
+++ b/src/mame/drivers/eurocom2.cpp
@@ -318,14 +318,10 @@ uint32_t eurocom2_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
{
gfx = m_p_videoram[page + x];
- *p++ = BIT(gfx, 7);
- *p++ = BIT(gfx, 6);
- *p++ = BIT(gfx, 5);
- *p++ = BIT(gfx, 4);
- *p++ = BIT(gfx, 3);
- *p++ = BIT(gfx, 2);
- *p++ = BIT(gfx, 1);
- *p++ = BIT(gfx, 0);
+ for (int i = 7; i >= 0; i--)
+ {
+ *p++ = BIT(gfx, i);
+ }
}
}
diff --git a/src/mame/drivers/gridcomp.cpp b/src/mame/drivers/gridcomp.cpp
index fca86b46762..df1ae8f140a 100644
--- a/src/mame/drivers/gridcomp.cpp
+++ b/src/mame/drivers/gridcomp.cpp
@@ -256,22 +256,10 @@ uint32_t gridcomp_state::screen_update_generic(screen_device &screen, bitmap_ind
{
gfx = m_videoram[x];
- *p++ = BIT(gfx, 15);
- *p++ = BIT(gfx, 14);
- *p++ = BIT(gfx, 13);
- *p++ = BIT(gfx, 12);
- *p++ = BIT(gfx, 11);
- *p++ = BIT(gfx, 10);
- *p++ = BIT(gfx, 9);
- *p++ = BIT(gfx, 8);
- *p++ = BIT(gfx, 7);
- *p++ = BIT(gfx, 6);
- *p++ = BIT(gfx, 5);
- *p++ = BIT(gfx, 4);
- *p++ = BIT(gfx, 3);
- *p++ = BIT(gfx, 2);
- *p++ = BIT(gfx, 1);
- *p++ = BIT(gfx, 0);
+ for (int i = 15; i >= 0; i--)
+ {
+ *p++ = BIT(gfx, i);
+ }
}
}
diff --git a/src/mame/drivers/ibm6580.cpp b/src/mame/drivers/ibm6580.cpp
index 8f2639c47b9..455fd084da2 100644
--- a/src/mame/drivers/ibm6580.cpp
+++ b/src/mame/drivers/ibm6580.cpp
@@ -762,14 +762,10 @@ uint32_t ibm6580_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
}
/* Display a scanline of a character */
- *p++ = BIT(gfx, 7) ? fg : bg;
- *p++ = BIT(gfx, 6) ? fg : bg;
- *p++ = BIT(gfx, 5) ? fg : bg;
- *p++ = BIT(gfx, 4) ? fg : bg;
- *p++ = BIT(gfx, 3) ? fg : bg;
- *p++ = BIT(gfx, 2) ? fg : bg;
- *p++ = BIT(gfx, 1) ? fg : bg;
- *p++ = BIT(gfx, 0) ? fg : bg;
+ for (int i = 7; i >= 0; i--)
+ {
+ *p++ = BIT(gfx, i) ? fg : bg;
+ }
}
} else {
// text mode
@@ -814,14 +810,10 @@ uint32_t ibm6580_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
fg = 1;
/* Display a scanline of a character */
- *p++ = BIT(gfx, 7) ? fg : bg;
- *p++ = BIT(gfx, 6) ? fg : bg;
- *p++ = BIT(gfx, 5) ? fg : bg;
- *p++ = BIT(gfx, 4) ? fg : bg;
- *p++ = BIT(gfx, 3) ? fg : bg;
- *p++ = BIT(gfx, 2) ? fg : bg;
- *p++ = BIT(gfx, 1) ? fg : bg;
- *p++ = BIT(gfx, 0) ? fg : bg;
+ for (int i = 7; i >= 0; i--)
+ {
+ *p++ = BIT(gfx, i) ? fg : bg;
+ }
}
}
}