diff options
-rw-r--r-- | src/devices/cpu/m6502/st2204.cpp | 14 | ||||
-rw-r--r-- | src/devices/cpu/m6502/st2204.h | 1 | ||||
-rw-r--r-- | src/devices/cpu/m6502/st2205u.cpp | 188 | ||||
-rw-r--r-- | src/devices/cpu/m6502/st2205u.h | 48 | ||||
-rw-r--r-- | src/devices/cpu/m6502/st2xxx.cpp | 39 | ||||
-rw-r--r-- | src/devices/cpu/m6502/st2xxx.h | 11 |
6 files changed, 286 insertions, 15 deletions
diff --git a/src/devices/cpu/m6502/st2204.cpp b/src/devices/cpu/m6502/st2204.cpp index 7636db9479d..091d4158d76 100644 --- a/src/devices/cpu/m6502/st2204.cpp +++ b/src/devices/cpu/m6502/st2204.cpp @@ -113,8 +113,8 @@ void st2204_device::device_start() state_add(ST_IRR, "IRR", downcast<mi_st2204 &>(*mintf).irr).mask(0xff); state_add(ST_PRR, "PRR", downcast<mi_st2204 &>(*mintf).prr).mask(0xfff); state_add(ST_DRR, "DRR", downcast<mi_st2204 &>(*mintf).drr).mask(0x7ff); - state_add<u16>(ST_IREQ, "IREQ", [this]() { return m_ireq; }, [this](u16 data) { m_ireq = data; update_irq_state(); }).mask(st2xxx_ireq_mask()); - state_add<u16>(ST_IENA, "IENA", [this]() { return m_iena; }, [this](u16 data) { m_iena = data; update_irq_state(); }).mask(st2xxx_ireq_mask()); + state_add(ST_IREQ, "IREQ", m_ireq, [this](u16 data) { m_ireq = data; update_irq_state(); }).mask(st2xxx_ireq_mask()); + state_add(ST_IENA, "IENA", m_iena, [this](u16 data) { m_iena = data; update_irq_state(); }).mask(st2xxx_ireq_mask()); for (int i = 0; i < 5; i++) { state_add(ST_PAOUT + i, string_format("P%cOUT", 'A' + i).c_str(), m_pdata[i]); @@ -127,8 +127,8 @@ void st2204_device::device_start() state_add(ST_PLOUT, "PLOUT", m_pdata[6]); state_add(ST_PCL, "PCL", m_pctrl[6]); state_add(ST_PMCR, "PMCR", m_pmcr); - state_add<u8>(ST_PRS, "PRS", [this]() { return m_prs; }, [this](u8 data) { prs_w(data); }).mask(0x60); - state_add<u8>(ST_BTEN, "BTEN", [this]() { return m_bten; }, [this](u8 data) { bten_w(data); }).mask(0x1f); + state_add(ST_PRS, "PRS", m_prs, [this](u8 data) { prs_w(data); }).mask(0x60); + state_add(ST_BTEN, "BTEN", m_bten, [this](u8 data) { bten_w(data); }).mask(0x1f); state_add(ST_BTSR, "BTSR", m_btsr).mask(0x1f); state_add(ST_T0M, "T0M", m_tmode[0]).mask(0x37); state_add(ST_T0C, "T0C", m_tload[0]); @@ -139,7 +139,7 @@ void st2204_device::device_start() state_add(ST_PSGC, "PSGC", m_psgc).mask(0x7f); state_add(ST_VOL, "VOL", m_vol); state_add(ST_DAC, "DAC", m_dac); - state_add<u8>(ST_SYS, "SYS", [this]() { return m_sys; }, [this](u8 data) { sys_w(data); }); + state_add(ST_SYS, "SYS", m_sys, [this](u8 data) { sys_w(data); }); state_add(ST_MISC, "MISC", m_misc).mask(st2xxx_misc_mask()); state_add(ST_LSSA, "LSSA", m_lssa); state_add(ST_LVPW, "LVPW", m_lvpw); @@ -151,6 +151,8 @@ void st2204_device::device_start() state_add(ST_LFRA, "LFRA", m_lfra).mask(0x3f); state_add(ST_LAC, "LAC", m_lac).mask(0x1f); state_add(ST_LPWM, "LPWM", m_lpwm).mask(st2xxx_lpwm_mask()); + state_add(ST_UCTR, "UCTR", m_uctr).mask(st2xxx_uctr_mask()); + state_add(ST_USTR, "USTR", m_ustr).mask(0x7f); state_add(ST_BCTR, "BCTR", m_bctr).mask(0x87); state_add(ST_BRS, "BRS", m_brs); state_add(ST_BDIV, "BDIV", m_bdiv); @@ -654,6 +656,8 @@ void st2204_device::common_map(address_map &map) map(0x004c, 0x004c).rw(FUNC(st2204_device::pl_r), FUNC(st2204_device::pl_w)); // PCL is listed as write-only in ST2202 specification, but DynamiDesk suggests otherwise map(0x004e, 0x004e).rw(FUNC(st2204_device::pcl_r), FUNC(st2204_device::pcl_w)); + map(0x0060, 0x0060).rw(FUNC(st2204_device::uctr_r), FUNC(st2204_device::uctr_w)); + map(0x0061, 0x0061).rw(FUNC(st2204_device::ustr_r), FUNC(st2204_device::ustr_trg_w)); map(0x0063, 0x0063).rw(FUNC(st2204_device::bctr_r), FUNC(st2204_device::bctr_w)); map(0x0066, 0x0066).rw(FUNC(st2204_device::brs_r), FUNC(st2204_device::brs_w)); map(0x0067, 0x0067).rw(FUNC(st2204_device::bdiv_r), FUNC(st2204_device::bdiv_w)); diff --git a/src/devices/cpu/m6502/st2204.h b/src/devices/cpu/m6502/st2204.h index 0608b4b3a47..42af8ad9612 100644 --- a/src/devices/cpu/m6502/st2204.h +++ b/src/devices/cpu/m6502/st2204.h @@ -56,6 +56,7 @@ protected: virtual u8 st2xxx_lckr_mask() const override { return 0x1f; } virtual u8 st2xxx_lpwm_mask() const override { return 0x3f; } virtual unsigned st2xxx_lfr_clocks() const override; + virtual u8 st2xxx_uctr_mask() const override { return 0x0f; } virtual u8 st2xxx_bctr_mask() const override { return 0x87; } void common_map(address_map &map); diff --git a/src/devices/cpu/m6502/st2205u.cpp b/src/devices/cpu/m6502/st2205u.cpp index 20436151600..834fcb1f388 100644 --- a/src/devices/cpu/m6502/st2205u.cpp +++ b/src/devices/cpu/m6502/st2205u.cpp @@ -44,6 +44,18 @@ st2205u_device::st2205u_device(const machine_config &mconfig, const char *tag, d , m_tc_12bit{0} , m_t4c(0) , m_tien(0) + , m_dac_fifo{0} + , m_fifo_filled{0} + , m_psgc(0) + , m_psgm(0) + , m_psg_vol{0} + , m_psg_volm{0} + , m_lbuf(0) + , m_lpal_index(0) + , m_gray_levels{0} + , m_usbcon(0) + , m_usbien(0) + , m_rctr(0) , m_lvctr(0) { } @@ -68,6 +80,18 @@ void st2205u_device::device_start() save_item(NAME(m_tc_12bit)); save_item(NAME(m_t4c)); save_item(NAME(m_tien)); + save_item(NAME(m_dac_fifo)); + save_item(NAME(m_fifo_filled)); + save_item(NAME(m_psgc)); + save_item(NAME(m_psgm)); + save_item(NAME(m_psg_vol)); + save_item(NAME(m_psg_volm)); + save_item(NAME(m_lbuf)); + save_item(NAME(m_lpal_index)); + save_item(NAME(m_gray_levels)); + save_item(NAME(m_usbcon)); + save_item(NAME(m_usbien)); + save_item(NAME(m_rctr)); save_item(NAME(m_lvctr)); save_item(NAME(intf->brr)); save_pointer(NAME(intf->ram), 0x8000); @@ -80,8 +104,8 @@ void st2205u_device::device_start() state_add(ST_PRR, "PRR", downcast<mi_st2205u &>(*mintf).prr).mask(0x87ff); state_add(ST_DRR, "DRR", downcast<mi_st2205u &>(*mintf).drr).mask(0x8fff); state_add(ST_BRR, "BRR", downcast<mi_st2205u &>(*mintf).brr).mask(0x9fff); - state_add<u16>(ST_IREQ, "IREQ", [this]() { return m_ireq; }, [this](u16 data) { m_ireq = data; update_irq_state(); }).mask(st2xxx_ireq_mask()); - state_add<u16>(ST_IENA, "IENA", [this]() { return m_iena; }, [this](u16 data) { m_iena = data; update_irq_state(); }).mask(st2xxx_ireq_mask()); + state_add(ST_IREQ, "IREQ", m_ireq, [this](u16 data) { m_ireq = data; update_irq_state(); }).mask(st2xxx_ireq_mask()); + state_add(ST_IENA, "IENA", m_iena, [this](u16 data) { m_iena = data; update_irq_state(); }).mask(st2xxx_ireq_mask()); for (int i = 0; i < 6; i++) { state_add(ST_PAOUT + i, string_format("P%cOUT", 'A' + i).c_str(), m_pdata[i]); @@ -95,28 +119,42 @@ void st2205u_device::device_start() state_add(ST_PCL, "PCL", m_pctrl[6]); state_add(ST_PMCR, "PMCR", m_pmcr); state_add(ST_MISC, "MISC", m_misc).mask(st2xxx_misc_mask()); - state_add<u8>(ST_SYS, "SYS", [this]() { return m_sys; }, [this](u8 data) { sys_w(data); }).mask(0xfe); - state_add<u8>(ST_PRS, "PRS", [this]() { return m_prs; }, [this](u8 data) { prs_w(data); }).mask(0x40); - state_add<u8>(ST_BTEN, "BTEN", [this]() { return m_bten; }, [this](u8 data) { bten_w(data); }); + state_add(ST_SYS, "SYS", m_sys, [this](u8 data) { sys_w(data); }).mask(0xfe); + state_add(ST_PRS, "PRS", m_prs, [this](u8 data) { prs_w(data); }).mask(0x40); + state_add(ST_BTEN, "BTEN", m_bten, [this](u8 data) { bten_w(data); }); state_add(ST_BTSR, "BTREQ", m_btsr); state_add(ST_BTC, "BTC", m_btc); for (int i = 0; i < 4; i++) - state_add(ST_T0C + i, string_format("T%dC", i).c_str(), m_tc_12bit[i]); + state_add(ST_FIFOS0 + i, string_format("FIFOS%d", i).c_str(), m_fifo_filled[i]).mask(0x1f); state_add(ST_T4C, "T4C", m_t4c); state_add(ST_TIEN, "TIEN", m_tien); + for (int i = 0; i < 4; i++) + state_add(ST_VOL0 + i, string_format("VOL%d", i).c_str(), m_psg_vol[i]).mask(0xbf); + state_add(ST_PSGC, "PSGC", m_psgc); + state_add(ST_PSGM, "PSGM", m_psgm); + for (int i = 0; i < 4; i++) + state_add(ST_VOL0 + i, string_format("VOL%d", i).c_str(), m_psg_vol[i]).mask(0xbf); + state_add(ST_VOLM0, "VOLM0", m_psg_volm[0]).mask(0x3f); + state_add(ST_VOLM1, "VOLM1", m_psg_volm[1]).mask(0x7f); state_add(ST_LSSA, "LSSA", m_lssa); state_add(ST_LVPW, "LVPW", m_lvpw); state_add(ST_LXMAX, "LXMAX", m_lxmax); state_add(ST_LYMAX, "LYMAX", m_lymax); state_add(ST_LPAN, "LPAN", m_lpan).mask(st2xxx_lpan_mask()); + state_add(ST_LBUF, "LBUF", m_lbuf); state_add(ST_LCTR, "LCTR", m_lctr).mask(st2xxx_lctr_mask()); state_add(ST_LCKR, "LCKR", m_lckr).mask(st2xxx_lckr_mask()); state_add(ST_LFRA, "LFRA", m_lfra).mask(0x3f); state_add(ST_LAC, "LAC", m_lac).mask(0x1f); state_add(ST_LPWM, "LPWM", m_lpwm).mask(st2xxx_lpwm_mask()); + state_add(ST_UCTR, "UCTR", m_uctr).mask(st2xxx_uctr_mask()); + state_add(ST_USTR, "USTR", m_ustr).mask(0x7f); state_add(ST_BCTR, "BCTR", m_bctr).mask(0xb7); state_add(ST_BRS, "BRS", m_brs); state_add(ST_BDIV, "BDIV", m_bdiv); + state_add(ST_USBCON, "USBCON", m_usbcon).mask(0xfc); + state_add(ST_USBIEN, "USBIEN", m_usbien).mask(0xbf); + state_add(ST_RCTR, "RCTR", m_rctr).mask(0xef); state_add(ST_LVCTR, "LVCTR", m_lvctr).mask(0x0f); } @@ -132,6 +170,21 @@ void st2205u_device::device_reset() m_t4c = 0; m_tien = 0; + std::fill(std::begin(m_fifo_filled), std::end(m_fifo_filled), 0); + m_psgc = 0; + m_psgm = 0; + std::fill(std::begin(m_psg_vol), std::end(m_psg_vol), 0); + std::fill(std::begin(m_psg_volm), std::end(m_psg_volm), 0); + + m_lbuf = 0; + m_lpal_index = 0; + std::fill(std::begin(m_gray_levels), std::end(m_gray_levels), 0); + + m_usbcon = 0; + m_usbien = 0x20; + + m_rctr = 0; + m_lvctr = 0; } @@ -342,6 +395,67 @@ void st2205u_device::tien_w(u8 data) m_tien = data; } +u8 st2205u_device::psg_r(offs_t offset) +{ + u8 index = 0; + if (BIT(offset, 0)) + { + bool fwra = m_fifo_filled[offset >> 1] < 8; + return (m_dac_fifo[offset >> 1][index] & 0x100) >> 1 | (fwra ? 0x60 : 0x40) | m_fifo_filled[offset >> 1]; + } + else + return m_dac_fifo[offset >> 1][index] & 0xff; +} + +void st2205u_device::psg_w(offs_t offset, u8 data) +{ + if (m_fifo_filled[offset >> 1] < 16) + { + u8 index = m_fifo_filled[offset >> 1]++; + m_dac_fifo[offset >> 1][index] = data | (BIT(offset, 0) ? 0x100 : 0); + } +} + +u8 st2205u_device::psgc_r() +{ + return m_psgc; +} + +void st2205u_device::psgc_w(u8 data) +{ + m_psgc = data; +} + +u8 st2205u_device::psgm_r() +{ + return m_psgm; +} + +void st2205u_device::psgm_w(u8 data) +{ + m_psgm = data; +} + +u8 st2205u_device::vol_r(offs_t offset) +{ + return m_psg_vol[offset] | 0x40; +} + +void st2205u_device::vol_w(offs_t offset, u8 data) +{ + m_psg_vol[offset] = data & 0xbf; +} + +u8 st2205u_device::volm_r(offs_t offset) +{ + return m_psg_volm[offset] | (offset == 1 ? 0x80 : 0xc0); +} + +void st2205u_device::volm_w(offs_t offset, u8 data) +{ + m_psg_volm[offset] = data & (offset == 1 ? 0x7f : 0x3f); +} + void st2205u_device::st2xxx_tclk_start() { } @@ -360,6 +474,56 @@ unsigned st2205u_device::st2xxx_lfr_clocks() const return lcdcks * std::max((m_lckr & 0x0f) * 2, 1); } +u8 st2205u_device::lbuf_r() +{ + return m_lbuf; +} + +void st2205u_device::lbuf_w(u8 data) +{ + m_lbuf = data; +} + +void st2205u_device::lpal_w(u8 data) +{ + u8 index = m_lpal_index++; + m_lpal_index &= 0x0f; + if ((m_lctr & 0x0c) == 0x04) + index = (m_lpwm & 0xc0) >> 4 | (index & 0x03); + + m_gray_levels[index] = data & 0x1f; +} + +u8 st2205u_device::usbcon_r() +{ + return m_usbcon | 0x03; +} + +void st2205u_device::usbcon_w(u8 data) +{ + m_usbcon = data & 0xfc; +} + +u8 st2205u_device::usbien_r() +{ + return m_usbien | 0x40; +} + +void st2205u_device::usbien_w(u8 data) +{ + m_usbien = data & 0xbf; +} + +u8 st2205u_device::rctr_r() +{ + return (m_rctr & 0xe0) | 0x10; +} + +void st2205u_device::rctr_w(u8 data) +{ + m_rctr = data & 0xef; +} + u8 st2205u_device::lvctr_r() { return m_lvctr | 0x01; @@ -418,6 +582,11 @@ void st2205u_device::int_map(address_map &map) map(0x0008, 0x000d).rw(FUNC(st2205u_device::pctrl_r), FUNC(st2205u_device::pctrl_w)); map(0x000e, 0x000e).rw(FUNC(st2205u_device::pfc_r), FUNC(st2205u_device::pfc_w)); map(0x000f, 0x000f).rw(FUNC(st2205u_device::pfd_r), FUNC(st2205u_device::pfd_w)); + map(0x0010, 0x0017).rw(FUNC(st2205u_device::psg_r), FUNC(st2205u_device::psg_w)); + map(0x0018, 0x001b).rw(FUNC(st2205u_device::vol_r), FUNC(st2205u_device::vol_w)); + map(0x001c, 0x001d).rw(FUNC(st2205u_device::volm_r), FUNC(st2205u_device::volm_w)); + map(0x001e, 0x001e).rw(FUNC(st2205u_device::psgc_r), FUNC(st2205u_device::psgc_w)); + map(0x001f, 0x001f).rw(FUNC(st2205u_device::psgm_r), FUNC(st2205u_device::psgm_w)); map(0x0020, 0x0027).rw(FUNC(st2205u_device::tc_12bit_r), FUNC(st2205u_device::tc_12bit_w)); map(0x0028, 0x0028).rw(FUNC(st2205u_device::tien_r), FUNC(st2205u_device::tien_w)); map(0x0029, 0x0029).rw(FUNC(st2205u_device::prs_r), FUNC(st2205u_device::prs_w)); @@ -425,6 +594,7 @@ void st2205u_device::int_map(address_map &map) map(0x002b, 0x002b).rw(FUNC(st2205u_device::btsr_r), FUNC(st2205u_device::btclr_w)); map(0x002c, 0x002c).rw(FUNC(st2205u_device::btc_r), FUNC(st2205u_device::btc_w)); map(0x002d, 0x002d).rw(FUNC(st2205u_device::t4c_r), FUNC(st2205u_device::t4c_w)); + map(0x002e, 0x002e).rw(FUNC(st2205u_device::rctr_r), FUNC(st2205u_device::rctr_w)); map(0x0030, 0x0030).rw(FUNC(st2205u_device::irrl_r), FUNC(st2205u_device::irrl_w)); map(0x0031, 0x0031).rw(FUNC(st2205u_device::irrh_r), FUNC(st2205u_device::irrh_w)); map(0x0032, 0x0032).rw(FUNC(st2205u_device::prrl_r), FUNC(st2205u_device::prrl_w)); @@ -446,19 +616,25 @@ void st2205u_device::int_map(address_map &map) map(0x0043, 0x0043).rw(FUNC(st2205u_device::lxmax_r), FUNC(st2205u_device::lxmax_w)); map(0x0044, 0x0044).rw(FUNC(st2205u_device::lymax_r), FUNC(st2205u_device::lymax_w)); map(0x0045, 0x0045).rw(FUNC(st2205u_device::lpan_r), FUNC(st2205u_device::lpan_w)); + map(0x0046, 0x0046).rw(FUNC(st2205u_device::lbuf_r), FUNC(st2205u_device::lbuf_w)); map(0x0047, 0x0047).rw(FUNC(st2205u_device::lctr_r), FUNC(st2205u_device::lctr_w)); map(0x0048, 0x0048).w(FUNC(st2205u_device::lckr_w)); map(0x0049, 0x0049).w(FUNC(st2205u_device::lfra_w)); map(0x004a, 0x004a).rw(FUNC(st2205u_device::lac_r), FUNC(st2205u_device::lac_w)); map(0x004b, 0x004b).rw(FUNC(st2205u_device::lpwm_r), FUNC(st2205u_device::lpwm_w)); + map(0x004c, 0x004c).w(FUNC(st2205u_device::lpal_w)); map(0x004e, 0x004e).rw(FUNC(st2205u_device::pl_r), FUNC(st2205u_device::pl_w)); map(0x004f, 0x004f).rw(FUNC(st2205u_device::pcl_r), FUNC(st2205u_device::pcl_w)); map(0x0057, 0x0057).rw(FUNC(st2205u_device::lvctr_r), FUNC(st2205u_device::lvctr_w)); map(0x005a, 0x005a).rw(FUNC(st2205u_device::dmrl_r), FUNC(st2205u_device::dmrl_w)); map(0x005b, 0x005b).rw(FUNC(st2205u_device::dmrh_r), FUNC(st2205u_device::dmrh_w)); + map(0x0060, 0x0060).rw(FUNC(st2205u_device::uctr_r), FUNC(st2205u_device::uctr_w)); + map(0x0061, 0x0061).rw(FUNC(st2205u_device::ustr_r), FUNC(st2205u_device::ustr_clr_w)); map(0x0063, 0x0063).rw(FUNC(st2205u_device::bctr_r), FUNC(st2205u_device::bctr_w)); map(0x0066, 0x0066).rw(FUNC(st2205u_device::brs_r), FUNC(st2205u_device::brs_w)); map(0x0067, 0x0067).rw(FUNC(st2205u_device::bdiv_r), FUNC(st2205u_device::bdiv_w)); + map(0x0070, 0x0070).rw(FUNC(st2205u_device::usbcon_r), FUNC(st2205u_device::usbcon_w)); + map(0x0071, 0x0071).rw(FUNC(st2205u_device::usbien_r), FUNC(st2205u_device::usbien_w)); map(0x0080, 0x1fff).rw(FUNC(st2205u_device::ram_r), FUNC(st2205u_device::ram_w)); // assumed to be shared with banked RAM map(0x2000, 0x3fff).rw(FUNC(st2205u_device::bmem_r), FUNC(st2205u_device::bmem_w)); map(0x4000, 0x7fff).rw(FUNC(st2205u_device::pmem_r), FUNC(st2205u_device::pmem_w)); diff --git a/src/devices/cpu/m6502/st2205u.h b/src/devices/cpu/m6502/st2205u.h index f8ee13649d1..767d6a4f2be 100644 --- a/src/devices/cpu/m6502/st2205u.h +++ b/src/devices/cpu/m6502/st2205u.h @@ -24,7 +24,23 @@ public: ST_T3C, ST_T4C, ST_TIEN, + ST_FIFOS0, + ST_FIFOS1, + ST_FIFOS2, + ST_FIFOS3, + ST_PSGC, + ST_PSGM, + ST_VOL0, + ST_VOL1, + ST_VOL2, + ST_VOL3, + ST_VOLM0, + ST_VOLM1, + ST_LBUF, ST_BRR, + ST_USBCON, + ST_USBIEN, + ST_RCTR, ST_LVCTR }; @@ -50,6 +66,7 @@ protected: virtual u8 st2xxx_lckr_mask() const override { return 0x3f; } virtual u8 st2xxx_lpwm_mask() const override { return 0xff; } virtual unsigned st2xxx_lfr_clocks() const override; + virtual u8 st2xxx_uctr_mask() const override { return 0x3f; } virtual u8 st2xxx_bctr_mask() const override { return 0xb7; } private: @@ -90,6 +107,25 @@ private: void t4c_w(u8 data); u8 tien_r(); void tien_w(u8 data); + u8 psg_r(offs_t offset); + void psg_w(offs_t offset, u8 data); + u8 psgc_r(); + void psgc_w(u8 data); + u8 psgm_r(); + void psgm_w(u8 data); + u8 vol_r(offs_t offset); + void vol_w(offs_t offset, u8 data); + u8 volm_r(offs_t offset); + void volm_w(offs_t offset, u8 data); + u8 lbuf_r(); + void lbuf_w(u8 data); + void lpal_w(u8 data); + u8 usbcon_r(); + void usbcon_w(u8 data); + u8 usbien_r(); + void usbien_w(u8 data); + u8 rctr_r(); + void rctr_w(u8 data); u8 lvctr_r(); void lvctr_w(u8 data); @@ -108,6 +144,18 @@ private: u16 m_tc_12bit[4]; u8 m_t4c; u8 m_tien; + u16 m_dac_fifo[4][16]; + u8 m_fifo_filled[4]; + u8 m_psgc; + u8 m_psgm; + u8 m_psg_vol[4]; + u8 m_psg_volm[2]; + u8 m_lbuf; + u8 m_lpal_index; + u8 m_gray_levels[16]; + u8 m_usbcon; + u8 m_usbien; + u8 m_rctr; u8 m_lvctr; }; diff --git a/src/devices/cpu/m6502/st2xxx.cpp b/src/devices/cpu/m6502/st2xxx.cpp index 873aebf64e7..097a2b8f470 100644 --- a/src/devices/cpu/m6502/st2xxx.cpp +++ b/src/devices/cpu/m6502/st2xxx.cpp @@ -69,6 +69,8 @@ st2xxx_device::st2xxx_device(const machine_config &mconfig, device_type type, co , m_lpwm(0) , m_lcd_ireq(0) , m_lcd_timer(nullptr) + , m_uctr(0) + , m_ustr(0) , m_bctr(0) { program_config.m_internal_map = std::move(internal_map); @@ -187,8 +189,10 @@ void st2xxx_device::save_common_registers() save_item(NAME(m_lfra)); save_item(NAME(m_lac)); save_item(NAME(m_lpwm)); - if (st2xxx_bctr_mask() != 0) + if (st2xxx_uctr_mask() != 0) { + save_item(NAME(m_uctr)); + save_item(NAME(m_ustr)); save_item(NAME(m_bctr)); save_item(NAME(m_brs)); save_item(NAME(m_bdiv)); @@ -246,6 +250,8 @@ void st2xxx_device::device_reset() m_lcd_timer->adjust(attotime::never); // reset UART and BRG + m_uctr = 0; + m_ustr = 0; m_bctr = 0; } @@ -758,7 +764,7 @@ void st2xxx_device::lfr_recalculate_period() u8 st2xxx_device::lac_r() { - return m_lac; + return m_lac | 0xe0; } void st2xxx_device::lac_w(u8 data) @@ -768,7 +774,7 @@ void st2xxx_device::lac_w(u8 data) u8 st2xxx_device::lpwm_r() { - return m_lpwm; + return m_lpwm | ~st2xxx_lpwm_mask(); } void st2xxx_device::lpwm_w(u8 data) @@ -776,9 +782,34 @@ void st2xxx_device::lpwm_w(u8 data) m_lpwm = data & st2xxx_lpwm_mask(); } +u8 st2xxx_device::uctr_r() +{ + return m_uctr | ~st2xxx_uctr_mask(); +} + +void st2xxx_device::uctr_w(u8 data) +{ + m_uctr = data & st2xxx_uctr_mask(); +} + +u8 st2xxx_device::ustr_r() +{ + return m_ustr | 0x80; +} + +void st2xxx_device::ustr_trg_w(u8 data) +{ + m_ustr = (m_ustr & 0x7a) | (data & 0x05); +} + +void st2xxx_device::ustr_clr_w(u8 data) +{ + m_ustr &= ~data; +} + u8 st2xxx_device::bctr_r() { - return m_bctr; + return m_bctr | ~st2xxx_bctr_mask(); } void st2xxx_device::bctr_w(u8 data) diff --git a/src/devices/cpu/m6502/st2xxx.h b/src/devices/cpu/m6502/st2xxx.h index a895a95f24a..618d8e01d02 100644 --- a/src/devices/cpu/m6502/st2xxx.h +++ b/src/devices/cpu/m6502/st2xxx.h @@ -57,6 +57,8 @@ public: ST_LFRA, ST_LAC, ST_LPWM, + ST_UCTR, + ST_USTR, ST_BCTR, ST_BRS, ST_BDIV @@ -103,6 +105,7 @@ protected: virtual u8 st2xxx_lckr_mask() const = 0; virtual u8 st2xxx_lpwm_mask() const = 0; virtual unsigned st2xxx_lfr_clocks() const = 0; + virtual u8 st2xxx_uctr_mask() const = 0; virtual u8 st2xxx_bctr_mask() const = 0; class mi_st2xxx : public memory_interface { @@ -212,6 +215,12 @@ protected: void lac_w(u8 data); u8 lpwm_r(); void lpwm_w(u8 data); + + u8 uctr_r(); + void uctr_w(u8 data); + u8 ustr_r(); + void ustr_trg_w(u8 data); + void ustr_clr_w(u8 data); u8 bctr_r(); void bctr_w(u8 data); u8 brs_r(); @@ -270,6 +279,8 @@ protected: u16 m_lcd_ireq; emu_timer *m_lcd_timer; + u8 m_uctr; + u8 m_ustr; u8 m_bctr; u8 m_brs; u8 m_bdiv; |