diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2019-11-05 21:46:50 -0500 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2019-11-05 21:46:50 -0500 |
commit | ed5201ed3e9bbc577388c2fb57952aa34157a8c5 (patch) | |
tree | 5f4b254eaa2124234133e03ab37e2fdcf555313b /src/devices/cpu | |
parent | d502e18d24ca2e2424175307386e262c37f8b5f5 (diff) |
st2204: Create ST2202 variant type and downgrade dyndesk to it (nw)
Diffstat (limited to 'src/devices/cpu')
-rw-r--r-- | src/devices/cpu/m6502/st2204.cpp | 64 | ||||
-rw-r--r-- | src/devices/cpu/m6502/st2204.h | 19 |
2 files changed, 65 insertions, 18 deletions
diff --git a/src/devices/cpu/m6502/st2204.cpp b/src/devices/cpu/m6502/st2204.cpp index 222e3790b6f..0392fb43f15 100644 --- a/src/devices/cpu/m6502/st2204.cpp +++ b/src/devices/cpu/m6502/st2204.cpp @@ -2,6 +2,7 @@ // copyright-holders:AJR /********************************************************************** + Sitronix ST2202 8-Bit Integrated Microcontroller Sitronix ST2204 8-Bit Integrated Microcontroller Functional blocks: @@ -10,18 +11,23 @@ * External bus (up to 7 CS outputs, 48M maximum addressable) * Timers/event counters with clocking outputs (2 plus base timer) * Programmable sound generator (2 channels plus DAC) - * LCD controller (320x240 B/W or 240x160 4-gray) + * LCD controller (ST2202: 240x120 B/W, software gray levels) + (ST2204: 320x240 B/W or 240x160 4-gray) * Serial peripheral interface * UART (built-in BRG; RS-232 and IrDA modes) * Direct memory access (1 channel) * Power down modes (WAI-0, WAI-1, STP) * Watchdog timer * Low voltage detector - * 512K ROM (may be disabled) - * 10K RAM + * 256K (ST2202) or 512K (ST2204) ROM (may be disabled) + * 4K (ST2202) or 10K (ST2204) RAM - Emulation is largely based on documentation for the ST2202, which - has similar though somewhat lesser capabilities. + Emulation is largely based on documentation for the ST2202. The + ST2204 is believed to be almost entirely backward compatible. + + Two versions of the ST2204 were manufactured: ST2204A, fabricated + by TSMC, and ST2204B, fabricated by Hyundai. A PDF document + describing the differences between these two was once available. Reverse-engineered documentation for SS2204's internal registers: http://blog.kevtris.org/blogfiles/Game%20King%20Inside.txt @@ -31,13 +37,11 @@ #include "emu.h" #include "st2204.h" +DEFINE_DEVICE_TYPE(ST2202, st2202_device, "st2202", "Sitronix ST2202 Integrated Microcontroller") DEFINE_DEVICE_TYPE(ST2204, st2204_device, "st2204", "Sitronix ST2204 Integrated Microcontroller") -st2204_device::st2204_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : st2xxx_device(mconfig, ST2204, tag, owner, clock, - address_map_constructor(FUNC(st2204_device::int_map), this), - 26, // logical; only 23 address lines are brought out - false) +st2204_device::st2204_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, address_map_constructor map) + : st2xxx_device(mconfig, type, tag, owner, clock, map, 26, false) // logical; only 23 address lines are brought out , m_tmode{0} , m_tcntr{0} , m_dms(0) @@ -46,6 +50,16 @@ st2204_device::st2204_device(const machine_config &mconfig, const char *tag, dev { } +st2204_device::st2204_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : st2204_device(mconfig, ST2204, tag, owner, clock, address_map_constructor(FUNC(st2204_device::int_map), this)) +{ +} + +st2202_device::st2202_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : st2204_device(mconfig, ST2202, tag, owner, clock, address_map_constructor(FUNC(st2202_device::int_map), this)) +{ +} + void st2204_device::device_start() { std::unique_ptr<mi_st2204> intf = std::make_unique<mi_st2204>(); @@ -352,7 +366,7 @@ void st2204_device::dmem_w(offs_t offset, u8 data) downcast<mi_st2204 &>(*mintf).dwrite(offset, data); } -void st2204_device::int_map(address_map &map) +void st2204_device::common_map(address_map &map) { map(0x0000, 0x0004).rw(FUNC(st2204_device::pdata_r), FUNC(st2204_device::pdata_w)); map(0x0005, 0x0005).rw(FUNC(st2204_device::psc_r), FUNC(st2204_device::psc_w)); @@ -366,11 +380,10 @@ void st2204_device::int_map(address_map &map) map(0x0025, 0x0025).rw(FUNC(st2204_device::t0c_r), FUNC(st2204_device::t0c_w)); map(0x0026, 0x0026).rw(FUNC(st2204_device::t1m_r), FUNC(st2204_device::t1m_w)); map(0x0027, 0x0027).rw(FUNC(st2204_device::t1c_r), FUNC(st2204_device::t1c_w)); - // Source/destination registers are not readable on ST2202, but may be readable here (count register isn't) - map(0x0028, 0x0028).rw(FUNC(st2204_device::dmsl_r), FUNC(st2204_device::dmsl_w)); - map(0x0029, 0x0029).rw(FUNC(st2204_device::dmsh_r), FUNC(st2204_device::dmsh_w)); - map(0x002a, 0x002a).rw(FUNC(st2204_device::dmdl_r), FUNC(st2204_device::dmdl_w)); - map(0x002b, 0x002b).rw(FUNC(st2204_device::dmdh_r), FUNC(st2204_device::dmdh_w)); + map(0x0028, 0x0028).w(FUNC(st2204_device::dmsl_w)); + map(0x0029, 0x0029).w(FUNC(st2204_device::dmsh_w)); + map(0x002a, 0x002a).w(FUNC(st2204_device::dmdl_w)); + map(0x002b, 0x002b).w(FUNC(st2204_device::dmdh_w)); map(0x002c, 0x002c).w(FUNC(st2204_device::dcntl_w)); map(0x002d, 0x002d).w(FUNC(st2204_device::dcnth_w)); map(0x0030, 0x0030).rw(FUNC(st2204_device::sys_r), FUNC(st2204_device::sys_w)); @@ -398,8 +411,23 @@ void st2204_device::int_map(address_map &map) map(0x004a, 0x004a).rw(FUNC(st2204_device::lac_r), FUNC(st2204_device::lac_w)); map(0x004b, 0x004b).rw(FUNC(st2204_device::lpwm_r), FUNC(st2204_device::lpwm_w)); map(0x004c, 0x004c).rw(FUNC(st2204_device::pl_r), FUNC(st2204_device::pl_w)); - map(0x004e, 0x004e).w(FUNC(st2204_device::pcl_w)); - map(0x0080, 0x287f).ram(); // 2800-287F possibly not present in earlier versions + // 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(0x4000, 0x7fff).rw(FUNC(st2204_device::pmem_r), FUNC(st2204_device::pmem_w)); map(0x8000, 0xffff).rw(FUNC(st2204_device::dmem_r), FUNC(st2204_device::dmem_w)); } + +void st2202_device::int_map(address_map &map) +{
common_map(map); + map(0x0080, 0x0fff).ram();
} + +void st2204_device::int_map(address_map &map) +{ + common_map(map); + // Source/destination registers are supposedly not readable on ST2202, but may be readable here (count register isn't) + map(0x0028, 0x0028).r(FUNC(st2204_device::dmsl_r)); + map(0x0029, 0x0029).r(FUNC(st2204_device::dmsh_r)); + map(0x002a, 0x002a).r(FUNC(st2204_device::dmdl_r)); + map(0x002b, 0x002b).r(FUNC(st2204_device::dmdh_r)); + map(0x0080, 0x287f).ram(); // 2800-287F possibly not present in earlier versions +} diff --git a/src/devices/cpu/m6502/st2204.h b/src/devices/cpu/m6502/st2204.h index d0e2fa48358..de4530b5f85 100644 --- a/src/devices/cpu/m6502/st2204.h +++ b/src/devices/cpu/m6502/st2204.h @@ -2,6 +2,7 @@ // copyright-holders:AJR /********************************************************************** + Sitronix ST2202 8-Bit Integrated Microcontroller Sitronix ST2204 8-Bit Integrated Microcontroller **********************************************************************/ @@ -28,6 +29,8 @@ public: st2204_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: + st2204_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, address_map_constructor int_map); + virtual void device_start() override; virtual void device_reset() override; @@ -42,6 +45,8 @@ protected: virtual u8 st2xxx_lckr_mask() const override { return 0x1f; } virtual u8 st2xxx_lpwm_mask() const override { return 0x3f; } + void common_map(address_map &map); + private: class mi_st2204 : public mi_st2xxx { public: @@ -95,6 +100,20 @@ private: u8 m_dcnth; }; +class st2202_device : public st2204_device +{ +public: + st2202_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + virtual u8 st2xxx_misc_mask() const override { return 0x0f; } + virtual u8 st2xxx_lctr_mask() const override { return 0xe0; } + +private: + void int_map(address_map &map); +}; + +DECLARE_DEVICE_TYPE(ST2202, st2202_device) DECLARE_DEVICE_TYPE(ST2204, st2204_device) #endif // MAME_MACHINE_M6502_ST2204_H |