diff options
author | 2019-09-09 02:15:57 +1000 | |
---|---|---|
committer | 2019-09-08 12:15:57 -0400 | |
commit | 5da69007d4a8aab8232514bd142c59dfa4e54651 (patch) | |
tree | 8dd9e6d8680d8f9b1fa594e49ea6d6e05befdfe5 | |
parent | fb13dcf7465c4877655bf08c444897d725cbd2ec (diff) |
HD6845: specialize the cursor emulation (#5598)
For the HD6845 the cursor does not wrap around as it does for the MC6845.
-rw-r--r-- | src/devices/video/mc6845.cpp | 36 | ||||
-rw-r--r-- | src/devices/video/mc6845.h | 3 |
2 files changed, 30 insertions, 9 deletions
diff --git a/src/devices/video/mc6845.cpp b/src/devices/video/mc6845.cpp index da971fb14ca..68ac2ee0af9 100644 --- a/src/devices/video/mc6845.cpp +++ b/src/devices/video/mc6845.cpp @@ -709,23 +709,17 @@ bool mc6845_device::check_cursor_visible(uint16_t ra, uint16_t line_addr) if (cursor_start_ras > max_ras_addr) { - // No cursor possible. + // No cursor. return false; } - // See the 'apricot' boot screen, it probably expects no cursor. // TODO explore the edge cases in the 'interlace and video' mode. - if (MODE_INTERLACE_AND_VIDEO && cursor_start_ras >= max_ras_addr) - { - // No cursor possible. - return false; - } if (cursor_start_ras <= m_cursor_end_ras) { if (m_cursor_end_ras > max_ras_addr) { - // Full cursor. + // Wraps to produce a full cursor. return true; } // Cursor from start to end inclusive. @@ -736,6 +730,32 @@ bool mc6845_device::check_cursor_visible(uint16_t ra, uint16_t line_addr) return (ra <= m_cursor_end_ras) || (ra >= cursor_start_ras); } +// The HD6845 cursor does not wrap as it does for the MC6845. +bool hd6845s_device::check_cursor_visible(uint16_t ra, uint16_t line_addr) +{ + if (!m_cursor_state) + return false; + + if ((m_cursor_addr < line_addr) || + (m_cursor_addr >= (line_addr + m_horiz_disp))) + { + // Not a cursor character line. + return false; + } + + uint16_t cursor_start_ras = m_cursor_start_ras & 0x1f; + uint16_t max_ras_addr = m_max_ras_addr + (MODE_INTERLACE_AND_VIDEO ? m_interlace_adjust : m_noninterlace_adjust) - 1; + + if (cursor_start_ras > max_ras_addr || cursor_start_ras > m_cursor_end_ras) + { + // No cursor. + return false; + } + + // Cursor from start to end inclusive. + return (ra >= cursor_start_ras) && (ra <= m_cursor_end_ras); +} + void mc6845_device::handle_line_timer() { diff --git a/src/devices/video/mc6845.h b/src/devices/video/mc6845.h index 2ff2b663779..d124dc6fde6 100644 --- a/src/devices/video/mc6845.h +++ b/src/devices/video/mc6845.h @@ -235,7 +235,7 @@ protected: void set_vsync(int state); void set_cur(int state); bool match_line(); - bool check_cursor_visible(uint16_t ra, uint16_t line_addr); + virtual bool check_cursor_visible(uint16_t ra, uint16_t line_addr); void handle_line_timer(); virtual void update_cursor_state(); virtual uint8_t draw_scanline(int y, bitmap_rgb32 &bitmap, const rectangle &cliprect); @@ -331,6 +331,7 @@ public: protected: virtual void device_start() override; virtual void device_reset() override; + virtual bool check_cursor_visible(uint16_t ra, uint16_t line_addr) override; }; class sy6545_1_device : public mc6845_device |