summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/wy50.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/wy50.cpp')
-rw-r--r--src/mame/drivers/wy50.cpp58
1 files changed, 52 insertions, 6 deletions
diff --git a/src/mame/drivers/wy50.cpp b/src/mame/drivers/wy50.cpp
index 97ea61d0a19..7186ef1676c 100644
--- a/src/mame/drivers/wy50.cpp
+++ b/src/mame/drivers/wy50.cpp
@@ -41,6 +41,7 @@ public:
, m_pvtc(*this, "pvtc")
, m_sio(*this, "sio")
, m_chargen(*this, "chargen")
+ , m_videoram(*this, "videoram%u", 0U)
{
}
@@ -51,6 +52,7 @@ protected:
virtual void machine_reset() override;
private:
+ u8 pvtc_videoram_r(offs_t offset);
SCN2672_DRAW_CHARACTER_MEMBER(draw_character);
u8 pvtc_r(offs_t offset);
@@ -65,6 +67,7 @@ private:
void prg_map(address_map &map);
void io_map(address_map &map);
+ void row_buffer_map(address_map &map);
required_device<mcs51_cpu_device> m_maincpu;
required_device<er1400_device> m_earom;
@@ -72,10 +75,19 @@ private:
required_device<mc2661_device> m_sio;
required_region_ptr<u8> m_chargen;
+ required_shared_ptr_array<u8, 2> m_videoram;
+
+ u8 m_row_buffer_char;
+ bool m_is_132;
};
void wy50_state::machine_start()
{
+ m_row_buffer_char = 0;
+ m_is_132 = false;
+
+ save_item(NAME(m_row_buffer_char));
+ save_item(NAME(m_is_132));
}
void wy50_state::machine_reset()
@@ -84,8 +96,27 @@ void wy50_state::machine_reset()
earom_w(0);
}
+u8 wy50_state::pvtc_videoram_r(offs_t offset)
+{
+ m_row_buffer_char = m_videoram[BIT(offset, 13)][offset & 0x07ff];
+ return m_row_buffer_char;
+}
+
SCN2672_DRAW_CHARACTER_MEMBER(wy50_state::draw_character)
{
+ bool is_attr = (charcode & 0xe0) == 0x80;
+ u16 dots = is_attr ? 0 : m_chargen[charcode << 4 | linecount] << 1;
+
+ if (cursor)
+ dots = ~dots;
+
+ for (int i = 0; i < 9; i++)
+ {
+ bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black();
+ dots <<= 1;
+ }
+ if (!m_is_132)
+ bitmap.pix32(y, x++) = BIT(dots, 8) ? rgb_t::white() : rgb_t::black();
}
u8 wy50_state::pvtc_r(offs_t offset)
@@ -111,7 +142,7 @@ void wy50_state::sio_w(offs_t offset, u8 data)
u8 wy50_state::rbreg_r()
{
// LS374 row buffer diagnostic register
- return 0;
+ return m_row_buffer_char;
}
void wy50_state::keyboard_w(u8 data)
@@ -132,8 +163,8 @@ u8 wy50_state::p1_r()
{
// P1.0 = AUX RDY
// P1.1 = NVD OUT
- // P1.4 = KEY (inverted)
- return 0xfd | (m_earom->data_r() << 1);
+ // P1.4 = KEY (inverted, active high)
+ return 0xed | (m_earom->data_r() << 1);
}
void wy50_state::p1_w(u8 data)
@@ -143,6 +174,13 @@ void wy50_state::p1_w(u8 data)
// P1.5 = BEEPER
// P1.6 = REV/DIM PROT
// P1.7 (inverted) = 80/132
+
+ if (m_is_132 != BIT(data, 7))
+ {
+ m_is_132 = BIT(data, 7);
+ m_pvtc->set_character_width(m_is_132 ? 9 : 10);
+ m_pvtc->set_unscaled_clock(68.85_MHz_XTAL / (m_is_132 ? 20 : 30));
+ }
}
void wy50_state::prg_map(address_map &map)
@@ -152,8 +190,8 @@ void wy50_state::prg_map(address_map &map)
void wy50_state::io_map(address_map &map)
{
- map(0x0000, 0x07ff).mirror(0x1800).ram();
- map(0x2000, 0x27ff).mirror(0x1800).ram();
+ map(0x0000, 0x07ff).mirror(0x1800).ram().share("videoram0");
+ map(0x2000, 0x27ff).mirror(0x1800).ram().share("videoram1");
map(0x4000, 0x47ff).mirror(0x1800).rw(FUNC(wy50_state::pvtc_r), FUNC(wy50_state::pvtc_w));
map(0x6000, 0x63ff).mirror(0x1c00).rw(FUNC(wy50_state::sio_r), FUNC(wy50_state::sio_w));
map(0x8000, 0x8000).mirror(0x1fff).r(FUNC(wy50_state::rbreg_r));
@@ -161,6 +199,12 @@ void wy50_state::io_map(address_map &map)
map(0xc000, 0xc000).mirror(0x1fff).w(FUNC(wy50_state::earom_w));
}
+void wy50_state::row_buffer_map(address_map &map)
+{
+ map.global_mask(0x0ff);
+ map(0x000, 0x0ff).ram();
+}
+
static INPUT_PORTS_START(wy50)
INPUT_PORTS_END
@@ -183,12 +227,14 @@ void wy50_state::wy50(machine_config &config)
SCN2672(config, m_pvtc, 68.85_MHz_XTAL / 30); // SCN2672A or SCN2672B
m_pvtc->set_screen("screen");
m_pvtc->set_character_width(10); // 9 in 132-column mode
+ m_pvtc->set_addrmap(0, &wy50_state::row_buffer_map);
m_pvtc->set_display_callback(FUNC(wy50_state::draw_character));
m_pvtc->intr_callback().set_inputline(m_maincpu, MCS51_T0_LINE);
m_pvtc->breq_callback().set_inputline(m_maincpu, MCS51_INT0_LINE);
+ m_pvtc->mbc_char_callback().set(FUNC(wy50_state::pvtc_videoram_r));
MC2661(config, m_sio, 4.9152_MHz_XTAL); // SCN2661B
- m_sio->txrdy_handler().set_inputline(m_maincpu, MCS51_INT1_LINE);
+ m_sio->rxrdy_handler().set_inputline(m_maincpu, MCS51_INT1_LINE);
}
ROM_START(wy50)