diff --git a/src/devices/cpu/mcs51/mcs51.cpp b/src/devices/cpu/mcs51/mcs51.cpp index 6ac3ca48e5d..b79dab6228f 100644 --- a/src/devices/cpu/mcs51/mcs51.cpp +++ b/src/devices/cpu/mcs51/mcs51.cpp @@ -234,6 +234,8 @@ DEFINE_DEVICE_TYPE(I87C51, i87c51_device, "i87c51", "Intel I87C51") DEFINE_DEVICE_TYPE(I80C32, i80c32_device, "i80c32", "Intel I80C32") DEFINE_DEVICE_TYPE(I80C52, i80c52_device, "i80c52", "Intel I80C52") DEFINE_DEVICE_TYPE(I87C52, i87c52_device, "i87c52", "Intel I87C52") +DEFINE_DEVICE_TYPE(AT89C52, at89c52_device, "at89c52", "Atmel AT89C52") +DEFINE_DEVICE_TYPE(AT89S52, at89s52_device, "at89s52", "Atmel AT89S52") DEFINE_DEVICE_TYPE(AT89C4051, at89c4051_device, "at89c4051", "Atmel AT89C4051") DEFINE_DEVICE_TYPE(DS5002FP, ds5002fp_device, "ds5002fp", "Dallas DS5002FP") @@ -363,6 +365,16 @@ i87c52_device::i87c52_device(const machine_config &mconfig, const char *tag, dev { } +at89c52_device::at89c52_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : i80c52_device(mconfig, AT89C52, tag, owner, clock, 13, 8) +{ +} + +at89s52_device::at89s52_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : i80c52_device(mconfig, AT89S52, tag, owner, clock, 13, 8) +{ +} + at89c4051_device::at89c4051_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : i80c51_device(mconfig, AT89C4051, tag, owner, clock, 12, 7) { diff --git a/src/devices/cpu/mcs51/mcs51.h b/src/devices/cpu/mcs51/mcs51.h index a0fa68d02f9..cb3c7f635f1 100644 --- a/src/devices/cpu/mcs51/mcs51.h +++ b/src/devices/cpu/mcs51/mcs51.h @@ -367,6 +367,8 @@ DECLARE_DEVICE_TYPE(I87C51, i87c51_device) DECLARE_DEVICE_TYPE(I80C32, i80c32_device) DECLARE_DEVICE_TYPE(I80C52, i80c52_device) DECLARE_DEVICE_TYPE(I87C52, i87c52_device) +DECLARE_DEVICE_TYPE(AT89C52, at89c52_device) +DECLARE_DEVICE_TYPE(AT89S52, at89s52_device) /* 4k internal perom and 128 internal ram and 2 analog comparators */ DECLARE_DEVICE_TYPE(AT89C4051, at89c4051_device) @@ -486,6 +488,20 @@ public: i87c52_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; +class at89c52_device : public i80c52_device +{ +public: + // construction/destruction + at89c52_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + +class at89s52_device : public i80c52_device +{ +public: + // construction/destruction + at89s52_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); +}; + class at89c4051_device : public i80c51_device { public: diff --git a/src/mame/drivers/controlid.cpp b/src/mame/drivers/controlid.cpp index 79e1bbcde32..5308bfbc65e 100644 --- a/src/mame/drivers/controlid.cpp +++ b/src/mame/drivers/controlid.cpp @@ -44,54 +44,83 @@ public: void controlidx628(machine_config &config); private: + virtual void machine_start() override; + DECLARE_WRITE8_MEMBER(p0_w); + DECLARE_READ8_MEMBER(p1_r); DECLARE_WRITE8_MEMBER(p1_w); + DECLARE_READ8_MEMBER(p2_r); + DECLARE_READ8_MEMBER(p3_r); DECLARE_WRITE8_MEMBER(p3_w); DECLARE_PALETTE_INIT(controlidx628); void io_map(address_map &map); - void prog_map(address_map &map); required_device m_lcdc; - uint8_t p0_data; - uint8_t p1_data; - uint8_t p3_data; + uint8_t m_p0_data; + uint8_t m_p1_data; + uint8_t m_p3_data; }; +void controlidx628_state::machine_start() +{ + m_p0_data = 0xff; + m_p1_data = 0xff; + m_p3_data = 0xff; + + save_item(NAME(m_p0_data)); + save_item(NAME(m_p1_data)); + save_item(NAME(m_p3_data)); +} + /************************* * Memory map information * *************************/ -void controlidx628_state::prog_map(address_map &map) -{ - map(0x0000, 0x1fff).rom(); -} - void controlidx628_state::io_map(address_map &map) { map(0x8000, 0xffff).ram(); } -WRITE8_MEMBER( controlidx628_state::p0_w ) +WRITE8_MEMBER(controlidx628_state::p0_w) { - p0_data = data; + m_p0_data = data; } -WRITE8_MEMBER( controlidx628_state::p1_w ) +READ8_MEMBER(controlidx628_state::p1_r) { - if ((BIT(p1_data, 6) == 0) && (BIT(data, 6) == 1)) // on raising-edge of bit 6 + // P1.1 is used for serial I/O; P1.4 and P1.5 are also used bidirectionally + return 0xcd; +} + +WRITE8_MEMBER(controlidx628_state::p1_w) +{ + if ((BIT(m_p1_data, 6) == 0) && (BIT(data, 6) == 1)) // on raising-edge of bit 6 { - m_lcdc->write(space, BIT(data, 7), p0_data); + m_lcdc->write(space, BIT(data, 7), m_p0_data); } - p1_data = data; + // P1.0 is also used as a serial I/O clock + m_p1_data = data; } -WRITE8_MEMBER( controlidx628_state::p3_w ) +READ8_MEMBER(controlidx628_state::p2_r) { - p3_data = data; + // Low nibble used for input + return 0xf0; +} + +READ8_MEMBER(controlidx628_state::p3_r) +{ + // P3.3 (INT1) and P3.4 (T0) used bidirectionally + return 0xff; +} + +WRITE8_MEMBER(controlidx628_state::p3_w) +{ + m_p3_data = data; } /************************* @@ -115,11 +144,13 @@ PALETTE_INIT_MEMBER(controlidx628_state, controlidx628) MACHINE_CONFIG_START(controlidx628_state::controlidx628) // basic machine hardware - MCFG_DEVICE_ADD("maincpu", I80C32, XTAL(11'059'200)) // Actually the board has an Atmel AT89S52 MCU. - MCFG_DEVICE_PROGRAM_MAP(prog_map) + MCFG_DEVICE_ADD("maincpu", AT89S52, XTAL(11'059'200)) MCFG_DEVICE_IO_MAP(io_map) MCFG_MCS51_PORT_P0_OUT_CB(WRITE8(*this, controlidx628_state, p0_w)) + MCFG_MCS51_PORT_P1_IN_CB(READ8(*this, controlidx628_state, p1_r)) MCFG_MCS51_PORT_P1_OUT_CB(WRITE8(*this, controlidx628_state, p1_w)) + MCFG_MCS51_PORT_P2_IN_CB(READ8(*this, controlidx628_state, p2_r)) + MCFG_MCS51_PORT_P3_IN_CB(READ8(*this, controlidx628_state, p3_r)) MCFG_MCS51_PORT_P3_OUT_CB(WRITE8(*this, controlidx628_state, p3_w)) // video hardware diff --git a/src/mame/drivers/dreamwld.cpp b/src/mame/drivers/dreamwld.cpp index dc7b1e5de60..5fded03d121 100644 --- a/src/mame/drivers/dreamwld.cpp +++ b/src/mame/drivers/dreamwld.cpp @@ -755,7 +755,7 @@ MACHINE_CONFIG_START(dreamwld_state::baryon) MCFG_DEVICE_PROGRAM_MAP(baryon_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", dreamwld_state, irq4_line_hold) - MCFG_DEVICE_ADD("mcu", I80C52, XTAL(32'000'000)/2) /* AT89C52 or 87(C)52, unknown clock (value from docs) */ + MCFG_DEVICE_ADD("mcu", AT89C52, XTAL(32'000'000)/2) /* AT89C52 or 87(C)52, unknown clock (value from docs) */ MCFG_DEVICE_DISABLE() /* Internal ROM aren't dumped */ /* video hardware */ diff --git a/src/mame/drivers/pasha2.cpp b/src/mame/drivers/pasha2.cpp index 263413dc634..87c5868a3cf 100644 --- a/src/mame/drivers/pasha2.cpp +++ b/src/mame/drivers/pasha2.cpp @@ -133,7 +133,7 @@ public: virtual void video_start() override; uint32_t screen_update_pasha2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); required_device m_maincpu; - required_device m_audiocpu; + required_device m_audiocpu; required_device_array m_oki; required_device m_palette; void pasha2(machine_config &config); @@ -403,7 +403,7 @@ MACHINE_CONFIG_START(pasha2_state::pasha2) MCFG_DEVICE_IO_MAP(pasha2_io) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", pasha2_state, irq0_line_hold) - MCFG_DEVICE_ADD("audiocpu", I80C52, 12000000) /* actually AT89C52; clock from docs */ + MCFG_DEVICE_ADD("audiocpu", AT89C52, 12000000) /* clock from docs */ /* TODO : ports are unimplemented; P0,P1,P2,P3 and Serial Port Used */ MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) diff --git a/src/mame/drivers/snowbros.cpp b/src/mame/drivers/snowbros.cpp index 932b061620c..04adc464a03 100644 --- a/src/mame/drivers/snowbros.cpp +++ b/src/mame/drivers/snowbros.cpp @@ -1821,7 +1821,7 @@ MACHINE_CONFIG_START(snowbros_state::semicom_mcu) /* basic machine hardware */ - MCFG_DEVICE_ADD("protection", I80C52, XTAL(16'000'000)) // AT89C52 + MCFG_DEVICE_ADD("protection", AT89C52, XTAL(16'000'000)) MCFG_MCS51_PORT_P0_OUT_CB(WRITE8(*this, snowbros_state, prot_p0_w)) MCFG_MCS51_PORT_P1_OUT_CB(WRITE8(*this, snowbros_state, prot_p1_w)) MCFG_MCS51_PORT_P2_OUT_CB(WRITE8(*this, snowbros_state, prot_p2_w)) diff --git a/src/mame/drivers/tumbleb.cpp b/src/mame/drivers/tumbleb.cpp index 5ad93534425..f45a99fc3d5 100644 --- a/src/mame/drivers/tumbleb.cpp +++ b/src/mame/drivers/tumbleb.cpp @@ -2262,7 +2262,7 @@ MACHINE_CONFIG_START(tumbleb_state::cookbib_mcu) htchctch(config); /* basic machine hardware */ - MCFG_DEVICE_ADD("protection", I8052, 16000000) // AT89C52 + MCFG_DEVICE_ADD("protection", AT89C52, 16000000) MCFG_MCS51_PORT_P0_OUT_CB(WRITE8(*this, tumbleb_state, prot_p0_w)) MCFG_MCS51_PORT_P1_OUT_CB(WRITE8(*this, tumbleb_state, prot_p1_w)) MCFG_MCS51_PORT_P2_OUT_CB(WRITE8(*this, tumbleb_state, prot_p2_w))