mirror of
https://github.com/holub/mame
synced 2025-07-04 01:18:59 +03:00
tv912b, tv912c: Add protected, underline, invert and blink field attributes; make cursor blinking more accurate
This commit is contained in:
parent
9cff09c902
commit
f13d2bd1ca
@ -89,6 +89,11 @@ public:
|
|||||||
, m_option(*this, "OPTION")
|
, m_option(*this, "OPTION")
|
||||||
, m_dtr(*this, "DTR")
|
, m_dtr(*this, "DTR")
|
||||||
, m_baudgen_timer(nullptr)
|
, m_baudgen_timer(nullptr)
|
||||||
|
, m_force_blank(false)
|
||||||
|
, m_4hz_flasher(false)
|
||||||
|
, m_2hz_flasher(false)
|
||||||
|
, m_lpt_select(false)
|
||||||
|
, m_keyboard_scan(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void tv912(machine_config &config);
|
void tv912(machine_config &config);
|
||||||
@ -143,6 +148,7 @@ private:
|
|||||||
|
|
||||||
bool m_force_blank;
|
bool m_force_blank;
|
||||||
bool m_4hz_flasher;
|
bool m_4hz_flasher;
|
||||||
|
bool m_2hz_flasher;
|
||||||
bool m_lpt_select;
|
bool m_lpt_select;
|
||||||
u8 m_keyboard_scan;
|
u8 m_keyboard_scan;
|
||||||
std::unique_ptr<u8[]> m_dispram;
|
std::unique_ptr<u8[]> m_dispram;
|
||||||
@ -177,6 +183,8 @@ WRITE8_MEMBER(tv912_state::p2_w)
|
|||||||
m_bankdev->set_bank(data & 0x0f);
|
m_bankdev->set_bank(data & 0x0f);
|
||||||
|
|
||||||
// P24: +4Hz Flasher
|
// P24: +4Hz Flasher
|
||||||
|
if (BIT(data, 4) && !m_4hz_flasher)
|
||||||
|
m_2hz_flasher = !m_2hz_flasher;
|
||||||
m_4hz_flasher = BIT(data, 4);
|
m_4hz_flasher = BIT(data, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,13 +288,20 @@ u32 tv912_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, cons
|
|||||||
|
|
||||||
int scroll = m_crtc->upscroll_offset();
|
int scroll = m_crtc->upscroll_offset();
|
||||||
|
|
||||||
for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
|
u8 charctrl = 0x8, charctrl_latch = 0x8;
|
||||||
|
|
||||||
|
for (int y = 0; y < 240; y++)
|
||||||
{
|
{
|
||||||
int row = ((y / 10) + scroll) % 24;
|
int row = ((y / 10) + scroll) % 24;
|
||||||
int ra = y % 10;
|
int ra = y % 10;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
u8 *charbase = &m_p_chargen[(ra & 7) | BIT(videoctrl, 1) << 10];
|
u8 *charbase = &m_p_chargen[(ra & 7) | BIT(videoctrl, 1) << 10];
|
||||||
|
|
||||||
|
if (ra == 0)
|
||||||
|
charctrl_latch = charctrl;
|
||||||
|
else
|
||||||
|
charctrl = charctrl_latch;
|
||||||
|
|
||||||
for (int pos = 0; pos < 80; pos++)
|
for (int pos = 0; pos < 80; pos++)
|
||||||
{
|
{
|
||||||
u8 ch = (pos < 64)
|
u8 ch = (pos < 64)
|
||||||
@ -296,25 +311,49 @@ u32 tv912_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, cons
|
|||||||
if (CHARSET_TEST && pos >= 32 && pos < 64)
|
if (CHARSET_TEST && pos >= 32 && pos < 64)
|
||||||
ch = (pos & 0x1f) | (row & 7) << 5;
|
ch = (pos & 0x1f) | (row & 7) << 5;
|
||||||
|
|
||||||
u8 data = (ra > 0 && ra < 9) ? charbase[(ch & 0x7f) << 3] : 0;
|
bool inhibit = ra == 0 || ra == 9;
|
||||||
u8 dots = (data & 0xfc) >> 1;
|
bool underline = ra == 9 && BIT(charctrl, 0);
|
||||||
|
bool invert = BIT(charctrl, 1);
|
||||||
|
if ((ch & 0x60) == 0)
|
||||||
|
{
|
||||||
|
inhibit = true;
|
||||||
|
if (BIT(ch, 4))
|
||||||
|
charctrl = ch & 0xf;
|
||||||
|
else
|
||||||
|
charctrl = (charctrl & 0xc) | (ch & 0x3);
|
||||||
|
if (!BIT(ch, 0))
|
||||||
|
underline = false;
|
||||||
|
if (!BIT(ch, 1))
|
||||||
|
invert = false;
|
||||||
|
}
|
||||||
|
else if ((charctrl & 0xc) == 0xc && m_2hz_flasher)
|
||||||
|
inhibit = true;
|
||||||
|
|
||||||
|
u8 data = inhibit ? 0 : charbase[(ch & 0x7f) << 3];
|
||||||
|
u8 dots = underline ? 0xff : (data & 0xfc) >> 1;
|
||||||
bool adv = BIT(data, 1);
|
bool adv = BIT(data, 1);
|
||||||
|
|
||||||
if (x == curs.left() && y >= curs.top() && y <= curs.bottom())
|
if (x == curs.left() && y >= curs.top() && y <= curs.bottom())
|
||||||
{
|
{
|
||||||
if (BIT(videoctrl, 0) || !m_4hz_flasher)
|
if (m_4hz_flasher && !BIT(videoctrl, 0))
|
||||||
|
dots = 0;
|
||||||
|
else
|
||||||
dots ^= 0xff;
|
dots ^= 0xff;
|
||||||
}
|
}
|
||||||
|
if (invert)
|
||||||
|
dots ^= 0xff;
|
||||||
|
|
||||||
|
// Protected characters are displayed at half intensity
|
||||||
|
rgb_t fg = BIT(ch, 7) ? rgb_t(0xc0, 0xc0, 0xc0) : rgb_t::white();
|
||||||
for (int d = 0; d < TV912_CH_WIDTH / 2; d++)
|
for (int d = 0; d < TV912_CH_WIDTH / 2; d++)
|
||||||
{
|
{
|
||||||
if (x >= cliprect.left() && x <= cliprect.right())
|
if (x >= cliprect.left() && x <= cliprect.right())
|
||||||
bitmap.pix(y, x) = BIT(dots, 7) ? rgb_t::white() : rgb_t::black();
|
bitmap.pix(y, x) = BIT(dots, 7) ? fg : rgb_t::black();
|
||||||
x++;
|
x++;
|
||||||
if (adv)
|
if (adv)
|
||||||
dots <<= 1;
|
dots <<= 1;
|
||||||
if (x >= cliprect.left() && x <= cliprect.right())
|
if (x >= cliprect.left() && x <= cliprect.right())
|
||||||
bitmap.pix(y, x) = BIT(dots, 7) ? rgb_t::white() : rgb_t::black();
|
bitmap.pix(y, x) = BIT(dots, 7) ? fg : rgb_t::black();
|
||||||
x++;
|
x++;
|
||||||
if (!adv)
|
if (!adv)
|
||||||
dots <<= 1;
|
dots <<= 1;
|
||||||
@ -339,6 +378,7 @@ void tv912_state::machine_start()
|
|||||||
save_item(NAME(m_force_blank));
|
save_item(NAME(m_force_blank));
|
||||||
save_item(NAME(m_lpt_select));
|
save_item(NAME(m_lpt_select));
|
||||||
save_item(NAME(m_4hz_flasher));
|
save_item(NAME(m_4hz_flasher));
|
||||||
|
save_item(NAME(m_2hz_flasher));
|
||||||
save_item(NAME(m_keyboard_scan));
|
save_item(NAME(m_keyboard_scan));
|
||||||
save_pointer(NAME(m_dispram), 0x1000);
|
save_pointer(NAME(m_dispram), 0x1000);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user