summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author dxl <41547105+hp9k@users.noreply.github.com>2018-08-31 23:52:22 +0200
committer R. Belmont <rb6502@users.noreply.github.com>2018-08-31 17:52:22 -0400
commit49d1ee4d17cde68386a985fedb08ff0a87463f0d (patch)
tree8bdfd5fcd1c10ef1530abb903ea96de39060fd58
parenta8b903c4ec867bbfae44795658e6504b11802422 (diff)
More topcat fixes (#3933)
* topcat: add has_changed() function (nw) * topcat: don't write to plane if not enabled (nw) * topcat: fix initialization order (nw)
-rw-r--r--src/devices/bus/hp_dio/hp98543.cpp9
-rw-r--r--src/devices/bus/hp_dio/hp98544.cpp17
-rw-r--r--src/devices/video/topcat.cpp18
-rw-r--r--src/devices/video/topcat.h4
4 files changed, 36 insertions, 12 deletions
diff --git a/src/devices/bus/hp_dio/hp98543.cpp b/src/devices/bus/hp_dio/hp98543.cpp
index c0bceae761c..b9d75b5a7eb 100644
--- a/src/devices/bus/hp_dio/hp98543.cpp
+++ b/src/devices/bus/hp_dio/hp98543.cpp
@@ -158,11 +158,20 @@ WRITE_LINE_MEMBER(dio16_98543_device::vblank_w)
for (auto &tc: m_topcat)
tc->vblank_w(state);
}
+
uint32_t dio16_98543_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int startx[TOPCAT_COUNT], starty[TOPCAT_COUNT];
int endx[TOPCAT_COUNT], endy[TOPCAT_COUNT];
+ bool changed = false;
+
+ for (auto& tc: m_topcat)
+ changed |= tc->has_changed();
+
+ if (!changed)
+ return UPDATE_HAS_NOT_CHANGED;
+
for (int i = 0; i < TOPCAT_COUNT; i++)
m_topcat[i]->get_cursor_pos(startx[i], starty[i], endx[i], endy[i]);
diff --git a/src/devices/bus/hp_dio/hp98544.cpp b/src/devices/bus/hp_dio/hp98544.cpp
index 339499a96c0..c038be06208 100644
--- a/src/devices/bus/hp_dio/hp98544.cpp
+++ b/src/devices/bus/hp_dio/hp98544.cpp
@@ -134,17 +134,26 @@ WRITE_LINE_MEMBER(dio16_98544_device::vblank_w)
uint32_t dio16_98544_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int startx, starty, endx, endy;
- m_topcat->get_cursor_pos(startx, starty, endx, endy);
+
+
+ if (!m_topcat->has_changed())
+ return UPDATE_HAS_NOT_CHANGED;
for (int y = 0; y < m_v_pix; y++) {
uint32_t *scanline = &bitmap.pix32(y);
- for (int x = 0; x < 1024; x++) {
+ for (int x = 0; x < m_h_pix; x++) {
uint8_t tmp = m_vram[y * m_h_pix + x];
- if (y >= starty && y <= endy && x >= startx && x <= endx)
- tmp |= 0xff;
*scanline++ = tmp ? rgb_t(255,255,255) : rgb_t(0, 0, 0);
}
}
+
+ m_topcat->get_cursor_pos(startx, starty, endx, endy);
+
+ for(int y = starty; y <= endy; y++) {
+ uint32_t *scanline = &bitmap.pix32(y);
+ memset(scanline + startx, 0xff, (endx - startx) << 2);
+ }
+
return 0;
}
diff --git a/src/devices/video/topcat.cpp b/src/devices/video/topcat.cpp
index db162733fcd..2b5b32a6750 100644
--- a/src/devices/video/topcat.cpp
+++ b/src/devices/video/topcat.cpp
@@ -53,6 +53,8 @@ void topcat_device::device_start()
save_item(NAME(m_fb_enable));
save_item(NAME(m_unknown_reg4a));
save_item(NAME(m_unknown_reg4c));
+ save_item(NAME(m_cursor_state));
+ save_item(NAME(m_changed));
}
//-------------------------------------------------
@@ -80,19 +82,21 @@ READ16_MEMBER(topcat_device::vram_r)
WRITE16_MEMBER(topcat_device::vram_w)
{
- if (mem_mask & m_plane_mask) {
+ if (mem_mask & m_plane_mask && (m_fb_write_enable & (m_plane_mask << 8))) {
bool src = data & m_plane_mask;
bool dst = m_vram[offset * 2 + 1] & m_plane_mask;
execute_rule(src, (replacement_rule_t)((m_pixel_replacement_rule >> 8) & 0x0f), dst);
modify_vram_offset(offset * 2 + 1, dst);
}
- if (mem_mask & (m_plane_mask << 8)) {
+ if (mem_mask & (m_plane_mask << 8) && (m_fb_write_enable & (m_plane_mask << 8))) {
bool src = data & (m_plane_mask << 8);
bool dst = m_vram[offset * 2] & m_plane_mask;
execute_rule(src, (replacement_rule_t)((m_pixel_replacement_rule >> 8) & 0x0f), dst);
modify_vram_offset(offset * 2, dst);
}
+
+ m_changed = true;
}
void topcat_device::get_cursor_pos(int &startx, int &starty, int &endx, int &endy)
@@ -103,10 +107,10 @@ void topcat_device::get_cursor_pos(int &startx, int &starty, int &endx, int &end
endx = m_cursor_x_pos + m_cursor_width;
endy = m_cursor_y_pos;
} else {
- startx = 0;
- starty = 0;
- endx = 0;
- endy = 0;
+ startx = -1;
+ starty = -1;
+ endx = -1;
+ endy = -1;
}
}
@@ -114,6 +118,7 @@ TIMER_CALLBACK_MEMBER(topcat_device::cursor_callback)
{
m_cursor_timer->adjust(attotime::from_hz(5));
m_cursor_state ^= true;
+ m_changed = true;
}
void topcat_device::update_cursor(int x, int y, uint16_t ctrl, uint8_t width)
@@ -347,6 +352,7 @@ WRITE16_MEMBER(topcat_device::ctrl_w)
if (!m_write_enable)
return;
+ m_changed = true;
switch (offset) {
case TOPCAT_REG_VBLANK:
m_vblank = data;
diff --git a/src/devices/video/topcat.h b/src/devices/video/topcat.h
index 1f73c90729e..bba7d5e077c 100644
--- a/src/devices/video/topcat.h
+++ b/src/devices/video/topcat.h
@@ -20,12 +20,11 @@
class topcat_device : public device_t
{
public:
-
template <class Object> devcb_base& set_int_write_cb(Object &&cb)
{ return m_int_write_func.set_callback(std::forward<Object>(cb)); }
topcat_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
-
+ bool has_changed() { bool ret = m_changed; m_changed = false; return ret; };
void set_fb_width(int _pixels) { m_fb_width = _pixels; }
void set_fb_height(int _pixels) { m_fb_height = _pixels; }
void set_planemask(int _mask) { m_plane_mask = _mask; }
@@ -157,6 +156,7 @@ private:
bool m_read_enable;
bool m_write_enable;
bool m_fb_enable;
+ bool m_changed;
required_shared_ptr<uint8_t> m_vram;
};