summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2020-08-31 23:10:56 -0400
committer AJR <ajrhacker@users.noreply.github.com>2020-08-31 23:10:56 -0400
commit973ed97ca8806902a71c87d651d3f8b5274e2b5e (patch)
tree0c26748e728e8f6d040ad2a8d3c0c0b9fe0a5381
parent665e6c968c5bb67bb1c0cfe937d3cc4a239c83f9 (diff)
st2205u: Fix duplicate state registration; add more UART stubs
-rw-r--r--src/devices/cpu/m6502/st2204.cpp6
-rw-r--r--src/devices/cpu/m6502/st2205u.cpp11
-rw-r--r--src/devices/cpu/m6502/st2xxx.cpp39
-rw-r--r--src/devices/cpu/m6502/st2xxx.h14
4 files changed, 51 insertions, 19 deletions
diff --git a/src/devices/cpu/m6502/st2204.cpp b/src/devices/cpu/m6502/st2204.cpp
index 091d4158d76..0d7162ac207 100644
--- a/src/devices/cpu/m6502/st2204.cpp
+++ b/src/devices/cpu/m6502/st2204.cpp
@@ -152,7 +152,8 @@ void st2204_device::device_start()
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_USR, "USTR", m_usr).mask(0x7f);
+ state_add(ST_IRCTR, "IRCTR", m_irctr).mask(0xc7);
state_add(ST_BCTR, "BCTR", m_bctr).mask(0x87);
state_add(ST_BRS, "BRS", m_brs);
state_add(ST_BDIV, "BDIV", m_bdiv);
@@ -657,7 +658,8 @@ void st2204_device::common_map(address_map &map)
// 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(0x0061, 0x0061).rw(FUNC(st2204_device::usr_r), FUNC(st2204_device::ustr_trg_w));
+ map(0x0062, 0x0062).rw(FUNC(st2204_device::irctr_r), FUNC(st2204_device::irctr_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/st2205u.cpp b/src/devices/cpu/m6502/st2205u.cpp
index 94d6d778bc5..4d5e11dad3a 100644
--- a/src/devices/cpu/m6502/st2205u.cpp
+++ b/src/devices/cpu/m6502/st2205u.cpp
@@ -124,12 +124,10 @@ void st2205u_device::device_start()
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_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_FIFOS0 + i, string_format("FIFOS%d", i).c_str(), m_fifo_filled[i]).mask(0x1f);
state_add(ST_PSGC, "PSGC", m_psgc);
state_add(ST_PSGM, "PSGM", m_psgm);
for (int i = 0; i < 4; i++)
@@ -148,7 +146,8 @@ void st2205u_device::device_start()
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_USR, "USR", m_usr).mask(0x7f);
+ state_add(ST_IRCTR, "IRCTR", m_irctr).mask(0xc7);
state_add(ST_BCTR, "BCTR", m_bctr).mask(0xb7);
state_add(ST_BRS, "BRS", m_brs);
state_add(ST_BDIV, "BDIV", m_bdiv);
@@ -629,8 +628,10 @@ void st2205u_device::int_map(address_map &map)
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(0x0061, 0x0061).rw(FUNC(st2205u_device::usr_r), FUNC(st2205u_device::usr_clr_w));
+ map(0x0062, 0x0062).rw(FUNC(st2205u_device::irctr_r), FUNC(st2205u_device::irctr_w));
map(0x0063, 0x0063).rw(FUNC(st2205u_device::bctr_r), FUNC(st2205u_device::bctr_w));
+ map(0x0064, 0x0064).rw(FUNC(st2205u_device::udata_r), FUNC(st2205u_device::udata_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));
diff --git a/src/devices/cpu/m6502/st2xxx.cpp b/src/devices/cpu/m6502/st2xxx.cpp
index 097a2b8f470..89de90f3b20 100644
--- a/src/devices/cpu/m6502/st2xxx.cpp
+++ b/src/devices/cpu/m6502/st2xxx.cpp
@@ -70,7 +70,8 @@ st2xxx_device::st2xxx_device(const machine_config &mconfig, device_type type, co
, m_lcd_ireq(0)
, m_lcd_timer(nullptr)
, m_uctr(0)
- , m_ustr(0)
+ , m_usr(0)
+ , m_irctr(0)
, m_bctr(0)
{
program_config.m_internal_map = std::move(internal_map);
@@ -192,7 +193,8 @@ void st2xxx_device::save_common_registers()
if (st2xxx_uctr_mask() != 0)
{
save_item(NAME(m_uctr));
- save_item(NAME(m_ustr));
+ save_item(NAME(m_usr));
+ save_item(NAME(m_irctr));
save_item(NAME(m_bctr));
save_item(NAME(m_brs));
save_item(NAME(m_bdiv));
@@ -251,7 +253,8 @@ void st2xxx_device::device_reset()
// reset UART and BRG
m_uctr = 0;
- m_ustr = 0;
+ m_usr = 0x01;
+ m_irctr = 0;
m_bctr = 0;
}
@@ -792,19 +795,39 @@ void st2xxx_device::uctr_w(u8 data)
m_uctr = data & st2xxx_uctr_mask();
}
-u8 st2xxx_device::ustr_r()
+u8 st2xxx_device::usr_r()
{
- return m_ustr | 0x80;
+ return m_usr | 0x80;
}
void st2xxx_device::ustr_trg_w(u8 data)
{
- m_ustr = (m_ustr & 0x7a) | (data & 0x05);
+ m_usr = (m_usr & 0x7a) | (data & 0x05);
}
-void st2xxx_device::ustr_clr_w(u8 data)
+void st2xxx_device::usr_clr_w(u8 data)
{
- m_ustr &= ~data;
+ m_usr &= ~data;
+}
+
+u8 st2xxx_device::irctr_r()
+{
+ return m_irctr | 0x3c;
+}
+
+void st2xxx_device::irctr_w(u8 data)
+{
+ m_irctr = data & 0xc7;
+}
+
+u8 st2xxx_device::udata_r()
+{
+ return 0;
+}
+
+void st2xxx_device::udata_w(u8 data)
+{
+ logerror("Writing %02X to UART transmitter (PC = %04X)\n", data, PPC);
}
u8 st2xxx_device::bctr_r()
diff --git a/src/devices/cpu/m6502/st2xxx.h b/src/devices/cpu/m6502/st2xxx.h
index 618d8e01d02..9980c1aafbb 100644
--- a/src/devices/cpu/m6502/st2xxx.h
+++ b/src/devices/cpu/m6502/st2xxx.h
@@ -58,7 +58,8 @@ public:
ST_LAC,
ST_LPWM,
ST_UCTR,
- ST_USTR,
+ ST_USR,
+ ST_IRCTR,
ST_BCTR,
ST_BRS,
ST_BDIV
@@ -218,9 +219,13 @@ protected:
u8 uctr_r();
void uctr_w(u8 data);
- u8 ustr_r();
+ u8 usr_r();
void ustr_trg_w(u8 data);
- void ustr_clr_w(u8 data);
+ void usr_clr_w(u8 data);
+ u8 irctr_r();
+ void irctr_w(u8 data);
+ u8 udata_r();
+ void udata_w(u8 data);
u8 bctr_r();
void bctr_w(u8 data);
u8 brs_r();
@@ -280,7 +285,8 @@ protected:
emu_timer *m_lcd_timer;
u8 m_uctr;
- u8 m_ustr;
+ u8 m_usr;
+ u8 m_irctr;
u8 m_bctr;
u8 m_brs;
u8 m_bdiv;