From a577f2e60284b61a43d4209bada7fe3b68d71e79 Mon Sep 17 00:00:00 2001 From: cracyc Date: Mon, 28 Oct 2024 18:16:59 -0500 Subject: upd7220: pass cursor height to drawing functions --- src/devices/video/upd7220.cpp | 4 ++-- src/devices/video/upd7220.h | 4 ++-- src/mame/nec/pc9801.h | 2 +- src/mame/nec/pc9801_v.cpp | 13 +++++++++---- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/devices/video/upd7220.cpp b/src/devices/video/upd7220.cpp index f26218d3a2e..138a4340fc1 100644 --- a/src/devices/video/upd7220.cpp +++ b/src/devices/video/upd7220.cpp @@ -1775,7 +1775,7 @@ void upd7220_device::update_text(bitmap_rgb32 &bitmap, const rectangle &cliprect for (y = sy; y < sy + len; y++) { uint32_t const addr = sad + (y * m_pitch); - m_draw_text_cb(bitmap, addr, (y * m_lr) + m_vbp, wd, m_pitch, m_lr, m_dc, m_ead); + m_draw_text_cb(bitmap, addr, (y * m_lr) + m_vbp, wd, m_pitch, m_lr, m_dc, m_ead, m_ctop, m_cbot); } sy = y + 1; @@ -1861,7 +1861,7 @@ void upd7220_device::update_graphics(bitmap_rgb32 &bitmap, const rectangle &clip { uint32_t const addr = (sad & 0x3ffff) + ((y / m_lr) * m_pitch); int yval = y * zoom + (tsy + m_vbp); - m_draw_text_cb(bitmap, addr, yval, wd, m_pitch, m_lr, m_dc, m_ead); + m_draw_text_cb(bitmap, addr, yval, wd, m_pitch, m_lr, m_dc, m_ead, m_ctop, m_cbot); } } } diff --git a/src/devices/video/upd7220.h b/src/devices/video/upd7220.h index 9cda6a6b0d8..cc060f69800 100644 --- a/src/devices/video/upd7220.h +++ b/src/devices/video/upd7220.h @@ -41,7 +41,7 @@ //************************************************************************** #define UPD7220_DISPLAY_PIXELS_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, int y, int x, uint32_t address) -#define UPD7220_DRAW_TEXT_LINE_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr) +#define UPD7220_DRAW_TEXT_LINE_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr, int cursor_bot, int cursor_top) //************************************************************************** @@ -57,7 +57,7 @@ class upd7220_device : public device_t, { public: using display_pixels_delegate = device_delegate; - using draw_text_delegate = device_delegate; + using draw_text_delegate = device_delegate; // construction/destruction upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); diff --git a/src/mame/nec/pc9801.h b/src/mame/nec/pc9801.h index 874be95db2e..5f7c017c240 100644 --- a/src/mame/nec/pc9801.h +++ b/src/mame/nec/pc9801.h @@ -222,7 +222,7 @@ private: void write_sasi_req(int state); uint8_t sasi_status_r(); void sasi_ctrl_w(uint8_t data); - void draw_text(bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr, bool lower); + void draw_text(bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr, int cursor_bot, int cursor_top, bool lower); // uint8_t winram_r(); // void winram_w(uint8_t data); diff --git a/src/mame/nec/pc9801_v.cpp b/src/mame/nec/pc9801_v.cpp index c0ff9780efc..0043f55828a 100644 --- a/src/mame/nec/pc9801_v.cpp +++ b/src/mame/nec/pc9801_v.cpp @@ -77,10 +77,10 @@ UPD7220_DISPLAY_PIXELS_MEMBER( pc9801_state::hgdc_display_pixels ) UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) { - draw_text(bitmap, addr, y, wd, pitch, lr, cursor_on, cursor_addr, false); + draw_text(bitmap, addr, y, wd, pitch, lr, cursor_on, cursor_addr, cursor_bot, cursor_top, false); } -void pc9801_state::draw_text(bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr, bool lower) +void pc9801_state::draw_text(bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr, int cursor_bot, int cursor_top, bool lower) { rgb_t const *const palette = m_palette->palette()->entry_list_raw(); @@ -105,6 +105,7 @@ void pc9801_state::draw_text(bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, uint8_t kanji_sel = 0; uint8_t kanji_lr = 0; uint8_t tile_lr = 0; + bool pair = false; uint16_t tile = m_video_ram[0][tile_addr & 0xfff] & 0xff; uint8_t knj_tile = m_video_ram[0][tile_addr & 0xfff] >> 8; @@ -132,9 +133,12 @@ void pc9801_state::draw_text(bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, { tile_lr = 1; lasttile = -1; + pair = true; } else { + if((lasttile & 0x7f7f) == tile) + pair = true; tile_lr = pcg_lr; lasttile = (tile | knj_tile); } @@ -149,6 +153,7 @@ void pc9801_state::draw_text(bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, { x_step = 2; lasttile = -1; + pair = true; } // kanji_lr = 0; } @@ -242,7 +247,7 @@ void pc9801_state::draw_text(bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, } if(v_line) { tile_data|=8; } - if(cursor_on && cursor_addr == tile_addr && is_blink_rate) + if(cursor_on && (cursor_addr == tile_addr || (pair && cursor_addr == (tile_addr - 1) && pair)) && is_blink_rate && cursor_top >= yi && cursor_bot <= yi) tile_data^=0xff; if(blink && is_blink_rate) @@ -275,7 +280,7 @@ void pc9801_state::draw_text(bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, } } if(scroll && !lower && (line >= scroll_start) && (line <= scroll_end)) - return draw_text(bitmap, addr += pitch, y, wd, pitch, lr, cursor_on, cursor_addr, true); + return draw_text(bitmap, addr += pitch, y, wd, pitch, lr, cursor_on, cursor_addr, cursor_bot, cursor_top, true); } /************************************************* -- cgit v1.2.3