upd7220: pass cursor height to drawing functions

This commit is contained in:
cracyc 2024-10-28 18:16:59 -05:00
parent a2a60395dc
commit a577f2e602
4 changed files with 14 additions and 9 deletions

View file

@ -1775,7 +1775,7 @@ void upd7220_device::update_text(bitmap_rgb32 &bitmap, const rectangle &cliprect
for (y = sy; y < sy + len; y++) for (y = sy; y < sy + len; y++)
{ {
uint32_t const addr = sad + (y * m_pitch); 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; 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); uint32_t const addr = (sad & 0x3ffff) + ((y / m_lr) * m_pitch);
int yval = y * zoom + (tsy + m_vbp); 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);
} }
} }
} }

View file

@ -41,7 +41,7 @@
//************************************************************************** //**************************************************************************
#define UPD7220_DISPLAY_PIXELS_MEMBER(_name) void _name(bitmap_rgb32 &bitmap, int y, int x, uint32_t address) #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: public:
using display_pixels_delegate = device_delegate<void (bitmap_rgb32 &bitmap, int y, int x, uint32_t address)>; using display_pixels_delegate = device_delegate<void (bitmap_rgb32 &bitmap, int y, int x, uint32_t address)>;
using draw_text_delegate = device_delegate<void (bitmap_rgb32 &bitmap, uint32_t addr, int y, int wd, int pitch, int lr, int cursor_on, int cursor_addr)>; using draw_text_delegate = device_delegate<void (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)>;
// construction/destruction // construction/destruction
upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); upd7220_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

View file

@ -222,7 +222,7 @@ private:
void write_sasi_req(int state); void write_sasi_req(int state);
uint8_t sasi_status_r(); uint8_t sasi_status_r();
void sasi_ctrl_w(uint8_t data); 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(); // uint8_t winram_r();
// void winram_w(uint8_t data); // void winram_w(uint8_t data);

View file

@ -77,10 +77,10 @@ UPD7220_DISPLAY_PIXELS_MEMBER( pc9801_state::hgdc_display_pixels )
UPD7220_DRAW_TEXT_LINE_MEMBER( pc9801_state::hgdc_draw_text ) 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(); 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_sel = 0;
uint8_t kanji_lr = 0; uint8_t kanji_lr = 0;
uint8_t tile_lr = 0; uint8_t tile_lr = 0;
bool pair = false;
uint16_t tile = m_video_ram[0][tile_addr & 0xfff] & 0xff; uint16_t tile = m_video_ram[0][tile_addr & 0xfff] & 0xff;
uint8_t knj_tile = m_video_ram[0][tile_addr & 0xfff] >> 8; 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; tile_lr = 1;
lasttile = -1; lasttile = -1;
pair = true;
} }
else else
{ {
if((lasttile & 0x7f7f) == tile)
pair = true;
tile_lr = pcg_lr; tile_lr = pcg_lr;
lasttile = (tile | knj_tile); 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; x_step = 2;
lasttile = -1; lasttile = -1;
pair = true;
} }
// kanji_lr = 0; // 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(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; tile_data^=0xff;
if(blink && is_blink_rate) 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)) 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);
} }
/************************************************* /*************************************************