diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua index f578e6ac969..77c93b5bb0c 100644 --- a/scripts/src/cpu.lua +++ b/scripts/src/cpu.lua @@ -2856,6 +2856,7 @@ end -- Rockwell A/B5000 family --@src/devices/cpu/rw5000/a5000.h,CPUS["RW5000"] = true --@src/devices/cpu/rw5000/a5500.h,CPUS["RW5000"] = true +--@src/devices/cpu/rw5000/a5900.h,CPUS["RW5000"] = true --@src/devices/cpu/rw5000/b5000.h,CPUS["RW5000"] = true --@src/devices/cpu/rw5000/b6000.h,CPUS["RW5000"] = true --@src/devices/cpu/rw5000/b6100.h,CPUS["RW5000"] = true @@ -2876,6 +2877,8 @@ if CPUS["RW5000"] then MAME_DIR .. "src/devices/cpu/rw5000/a5000.h", MAME_DIR .. "src/devices/cpu/rw5000/a5500.cpp", MAME_DIR .. "src/devices/cpu/rw5000/a5500.h", + MAME_DIR .. "src/devices/cpu/rw5000/a5900.cpp", + MAME_DIR .. "src/devices/cpu/rw5000/a5900.h", } end diff --git a/src/devices/cpu/rw5000/a5000.cpp b/src/devices/cpu/rw5000/a5000.cpp index 7380120a193..bb39455cc18 100644 --- a/src/devices/cpu/rw5000/a5000.cpp +++ b/src/devices/cpu/rw5000/a5000.cpp @@ -2,10 +2,7 @@ // copyright-holders:hap /* - Rockwell A5000/A5900 MCU - -TODO: -- what happens when 0 or >1 keys are held down on READ? + Rockwell A5000 MCU */ @@ -16,7 +13,6 @@ TODO: DEFINE_DEVICE_TYPE(A5000, a5000_cpu_device, "a5000", "Rockwell A5000") -DEFINE_DEVICE_TYPE(A5900, a5900_cpu_device, "a5900", "Rockwell A5900") // constructor @@ -28,17 +24,6 @@ a5000_cpu_device::a5000_cpu_device(const machine_config &mconfig, const char *ta a5000_cpu_device(mconfig, A5000, tag, owner, clock, 9, address_map_constructor(FUNC(a5000_cpu_device::program_448x8), this), 6, address_map_constructor(FUNC(a5000_cpu_device::data_45x4), this)) { } -a5900_cpu_device::a5900_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - a5000_cpu_device(mconfig, A5900, tag, owner, clock, 9, address_map_constructor(FUNC(a5900_cpu_device::program_512x8), this), 6, address_map_constructor(FUNC(a5900_cpu_device::data_45x4), this)) -{ } - - -// internal memory maps -void a5900_cpu_device::program_512x8(address_map &map) -{ - map(0x000, 0x1ff).rom(); -} - // disasm std::unique_ptr a5000_cpu_device::create_disassembler() @@ -99,11 +84,3 @@ void a5000_cpu_device::op_mtd_step() } m_mtd_step++; } - -void a5000_cpu_device::op_read() -{ - // READ: add _KB info to A, skip next on no overflow - m_a += ~((count_leading_zeros_32(m_read_kb() & 0xf) - 28) & 3) & 0xf; - m_skip = !BIT(m_a, 4); - m_a &= 0xf; -} diff --git a/src/devices/cpu/rw5000/a5000.h b/src/devices/cpu/rw5000/a5000.h index 69740b28f79..704c1e7e8e0 100644 --- a/src/devices/cpu/rw5000/a5000.h +++ b/src/devices/cpu/rw5000/a5000.h @@ -2,7 +2,7 @@ // copyright-holders:hap /* - Rockwell A5000/A5900 MCU + Rockwell A5000 MCU */ @@ -29,20 +29,9 @@ protected: // opcode handlers virtual void op_mtd_step() override; - virtual void op_read() override; -}; - -class a5900_cpu_device : public a5000_cpu_device -{ -public: - a5900_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - -protected: - void program_512x8(address_map &map); }; DECLARE_DEVICE_TYPE(A5000, a5000_cpu_device) -DECLARE_DEVICE_TYPE(A5900, a5900_cpu_device) #endif // MAME_CPU_RW5000_A5000_H diff --git a/src/devices/cpu/rw5000/a5500.cpp b/src/devices/cpu/rw5000/a5500.cpp index 1e228e2a8fb..cbd3897fb3e 100644 --- a/src/devices/cpu/rw5000/a5500.cpp +++ b/src/devices/cpu/rw5000/a5500.cpp @@ -16,12 +16,8 @@ DEFINE_DEVICE_TYPE(A5500, a5500_cpu_device, "a5500", "Rockwell A5500") // constructor -a5500_cpu_device::a5500_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data) : - a5000_cpu_device(mconfig, type, tag, owner, clock, prgwidth, program, datawidth, data) -{ } - a5500_cpu_device::a5500_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - a5500_cpu_device(mconfig, A5500, tag, owner, clock, 10, address_map_constructor(FUNC(a5500_cpu_device::program_768x8), this), 6, address_map_constructor(FUNC(a5500_cpu_device::data_48x4), this)) + a5000_cpu_device(mconfig, A5500, tag, owner, clock, 10, address_map_constructor(FUNC(a5500_cpu_device::program_768x8), this), 6, address_map_constructor(FUNC(a5500_cpu_device::data_48x4), this)) { } @@ -61,7 +57,6 @@ void a5500_cpu_device::execute_one() case 0x0c: op_sc(); break; case 0x0d: op_rsc(); break; - case 0x6f: b5000_cpu_device::op_read(); break; // rest is same as A5000 default: a5000_cpu_device::execute_one(); break; @@ -70,10 +65,10 @@ void a5500_cpu_device::execute_one() bool a5500_cpu_device::op_is_tl(u8 op) { - return ((op & 0xf8) == 0x30) || ((op & 0xfc) == 0x38); + return a5000_cpu_device::op_is_tl(op) || ((op & 0xfc) == 0x38); } bool a5500_cpu_device::op_is_lb(u8 op) { - return ((op & 0xfc) == 0x1c) || ((op & 0xf0) == 0x20) || ((op & 0xfc) == 0x3c); + return a5000_cpu_device::op_is_lb(op) || ((op & 0xfc) == 0x1c); } diff --git a/src/devices/cpu/rw5000/a5500.h b/src/devices/cpu/rw5000/a5500.h index 138c38df630..57495b662e5 100644 --- a/src/devices/cpu/rw5000/a5500.h +++ b/src/devices/cpu/rw5000/a5500.h @@ -20,8 +20,6 @@ public: a5500_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - a5500_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data); - // device_disasm_interface overrides virtual std::unique_ptr create_disassembler() override; diff --git a/src/devices/cpu/rw5000/a5900.cpp b/src/devices/cpu/rw5000/a5900.cpp new file mode 100644 index 00000000000..e294469f35b --- /dev/null +++ b/src/devices/cpu/rw5000/a5900.cpp @@ -0,0 +1,42 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/* + + Rockwell A5900 MCU + +TODO: +- what happens when 0 or >1 keys are held down on READ? + +*/ + +#include "emu.h" +#include "a5900.h" + + +DEFINE_DEVICE_TYPE(A5900, a5900_cpu_device, "a5900", "Rockwell A5900") + + +// constructor +a5900_cpu_device::a5900_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + a5000_cpu_device(mconfig, A5900, tag, owner, clock, 9, address_map_constructor(FUNC(a5900_cpu_device::program_512x8), this), 6, address_map_constructor(FUNC(a5900_cpu_device::data_45x4), this)) +{ } + + +// internal memory maps +void a5900_cpu_device::program_512x8(address_map &map) +{ + map(0x000, 0x1ff).rom(); +} + + +//------------------------------------------------- +// changed opcodes (no need for separate file) +//------------------------------------------------- + +void a5900_cpu_device::op_read() +{ + // READ: add _KB (prioritized) to A, skip next on no overflow + m_a += ~((count_leading_zeros_32(m_read_kb() & 0xf) - 28) & 3) & 0xf; + m_skip = !BIT(m_a, 4); + m_a &= 0xf; +} diff --git a/src/devices/cpu/rw5000/a5900.h b/src/devices/cpu/rw5000/a5900.h new file mode 100644 index 00000000000..b6b59508578 --- /dev/null +++ b/src/devices/cpu/rw5000/a5900.h @@ -0,0 +1,32 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/* + + Rockwell A5900 MCU + +*/ + +#ifndef MAME_CPU_RW5000_A5900_H +#define MAME_CPU_RW5000_A5900_H + +#pragma once + +#include "a5000.h" + + +class a5900_cpu_device : public a5000_cpu_device +{ +public: + a5900_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + void program_512x8(address_map &map); + + // opcode handlers + virtual void op_read() override; +}; + + +DECLARE_DEVICE_TYPE(A5900, a5900_cpu_device) + +#endif // MAME_CPU_RW5000_A5900_H diff --git a/src/devices/cpu/rw5000/b6100.cpp b/src/devices/cpu/rw5000/b6100.cpp index e0f66fca15e..17bc17b9f25 100644 --- a/src/devices/cpu/rw5000/b6100.cpp +++ b/src/devices/cpu/rw5000/b6100.cpp @@ -16,12 +16,8 @@ DEFINE_DEVICE_TYPE(B6100, b6100_cpu_device, "b6100", "Rockwell B6100") // constructor -b6100_cpu_device::b6100_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data) : - b6000_cpu_device(mconfig, type, tag, owner, clock, prgwidth, program, datawidth, data) -{ } - b6100_cpu_device::b6100_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : - b6100_cpu_device(mconfig, B6100, tag, owner, clock, 10, address_map_constructor(FUNC(b6100_cpu_device::program_896x8), this), 6, address_map_constructor(FUNC(b6100_cpu_device::data_48x4), this)) + b6000_cpu_device(mconfig, B6100, tag, owner, clock, 10, address_map_constructor(FUNC(b6100_cpu_device::program_896x8), this), 6, address_map_constructor(FUNC(b6100_cpu_device::data_48x4), this)) { } @@ -88,12 +84,12 @@ void b6100_cpu_device::execute_one() bool b6100_cpu_device::op_is_tl(u8 op) { - return ((op & 0xf8) == 0x30) || ((op & 0xfc) == 0x38); + return b6000_cpu_device::op_is_tl(op) || ((op & 0xfc) == 0x38); } bool b6100_cpu_device::op_is_lb(u8 op) { - return ((op & 0xfc) == 0x1c) || ((op & 0xf0) == 0x20) || ((op & 0xfc) == 0x3c); + return b6000_cpu_device::op_is_lb(op) || ((op & 0xfc) == 0x1c); } diff --git a/src/devices/cpu/rw5000/b6100.h b/src/devices/cpu/rw5000/b6100.h index 007919117aa..455afe786f0 100644 --- a/src/devices/cpu/rw5000/b6100.h +++ b/src/devices/cpu/rw5000/b6100.h @@ -47,8 +47,6 @@ public: b6100_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: - b6100_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data); - // device_disasm_interface overrides virtual std::unique_ptr create_disassembler() override; diff --git a/src/mame/drivers/hh_rw5000.cpp b/src/mame/drivers/hh_rw5000.cpp index ee862cec37e..d781ed5bf4c 100644 --- a/src/mame/drivers/hh_rw5000.cpp +++ b/src/mame/drivers/hh_rw5000.cpp @@ -17,6 +17,7 @@ ROM source notes when dumped from another model, but confident it's the same: #include "cpu/rw5000/a5000.h" #include "cpu/rw5000/a5500.h" +#include "cpu/rw5000/a5900.h" #include "cpu/rw5000/b5000.h" #include "cpu/rw5000/b6000.h" #include "cpu/rw5000/b6100.h" @@ -31,7 +32,7 @@ ROM source notes when dumped from another model, but confident it's the same: #include "mbaseb.lh" #include "mfootb.lh" #include "misatk.lh" -#include "rw18r.lh" +#include "rw10r.lh" #include "rw24k.lh" #include "rw31r.lh" @@ -608,7 +609,118 @@ ROM_END /*************************************************************************** - Rockwell 8R, Rockwell 18R + Rockwell 10R + * A5000 MCU (label A5000PA, die label A5000) + * 8-digit 7seg LED display + + Rockwell 12R "Square Root" + * A5000 MCU (label A5001, die label A5001) + * rest is same as 10R + + 12R supports square root by pressing × after ÷ (or the other way around). + +***************************************************************************/ + +class rw10r_state : public hh_rw5000_state +{ +public: + rw10r_state(const machine_config &mconfig, device_type type, const char *tag) : + hh_rw5000_state(mconfig, type, tag) + { } + + void rw10r(machine_config &config); + +private: + void write_str(u16 data); + void write_seg(u16 data); + u8 read_kb(); +}; + +// handlers + +void rw10r_state::write_str(u16 data) +{ + // STR0-STR7: digit select + // STR4-STR7: input mux + m_display->write_my(data); + m_inp_mux = data >> 4; +} + +void rw10r_state::write_seg(u16 data) +{ + // SEG0-SEG7: digit segment data + m_display->write_mx(bitswap<8>(data,0,7,6,5,4,3,2,1)); +} + +u8 rw10r_state::read_kb() +{ + // KB: multiplexed inputs + return read_inputs(4); +} + +// config + +static INPUT_PORTS_START( rw10r ) + PORT_START("IN.0") // STR4 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_BACKSPACE) PORT_NAME("CE/C") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_STOP) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME(".") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("+=") + + PORT_START("IN.1") // STR5 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_MINUS_PAD) PORT_NAME("-") + + PORT_START("IN.2") // STR6 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_ASTERISK) PORT_NAME(u8"×") + + PORT_START("IN.3") // STR7 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(u8"÷") +INPUT_PORTS_END + +void rw10r_state::rw10r(machine_config &config) +{ + // basic machine hardware + A5000(config, m_maincpu, 250000); // approximation + m_maincpu->write_str().set(FUNC(rw10r_state::write_str)); + m_maincpu->write_seg().set(FUNC(rw10r_state::write_seg)); + m_maincpu->read_kb().set(FUNC(rw10r_state::read_kb)); + + // video hardware + PWM_DISPLAY(config, m_display).set_size(8, 8); + m_display->set_segmask(0xff, 0xff); + config.set_default_layout(layout_rw10r); +} + +// roms + +ROM_START( rw10r ) + ROM_REGION( 0x200, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "a5000pa", 0x000, 0x0c0, CRC(db6cbbea) SHA1(3757f303a84e412e8763c4ec2170c9badc172454) ) + ROM_CONTINUE( 0x100, 0x100 ) +ROM_END + +ROM_START( rw12r ) + ROM_REGION( 0x200, "maincpu", ROMREGION_ERASE00 ) + ROM_LOAD( "a5001", 0x000, 0x0c0, CRC(4337a46b) SHA1(70f4683eac0afa31a6cd9dd44fdf1b6680575f67) ) + ROM_CONTINUE( 0x100, 0x100 ) +ROM_END + + + + + +/*************************************************************************** + + Rockwell 8R "Automatic Percent", Rockwell 18R "Memory" * B5000 MCU (label B5000CC, die label B5000) * 8-digit 7seg LED display @@ -701,7 +813,7 @@ void rw18r_state::rw18r(machine_config &config) // video hardware PWM_DISPLAY(config, m_display).set_size(8, 8); m_display->set_segmask(0xff, 0xff); - config.set_default_layout(layout_rw18r); + config.set_default_layout(layout_rw10r); } // roms @@ -718,7 +830,7 @@ ROM_END /*************************************************************************** - Rockwell 31R + Rockwell 31R "Slide Rule Memory" * A5500 MCU (label A5502PA, die label A5500) * 9-digit 7seg LED display @@ -942,7 +1054,7 @@ void rw24k_state::rw24k(machine_config &config) // roms ROM_START( rw24k ) - ROM_REGION( 0x200, "maincpu", ROMREGION_ERASE00 ) + ROM_REGION( 0x200, "maincpu", 0 ) ROM_LOAD( "a5901ca", 0x000, 0x200, CRC(00de7764) SHA1(0f24add4b6d2660aad63ddd4d0003d59a0e39df6) ) ROM_END @@ -963,6 +1075,8 @@ CONS( 1977, mfootb, 0, 0, mfootb, mfootb, mfootb_state, empty_ CONS( 1978, mbaseb, 0, 0, mbaseb, mbaseb, mbaseb_state, empty_init, "Mattel Electronics", "Baseball (Mattel)", MACHINE_SUPPORTS_SAVE ) CONS( 1980, gravity, 0, 0, gravity, gravity, gravity_state, empty_init, "Mattel Electronics", "Gravity (Mattel)", MACHINE_SUPPORTS_SAVE ) +COMP( 1974, rw10r, 0, 0, rw10r, rw10r, rw10r_state, empty_init, "Rockwell", "10R (Rockwell)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) +COMP( 1975, rw12r, 0, 0, rw10r, rw10r, rw10r_state, empty_init, "Rockwell", "12R (Rockwell)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) COMP( 1975, rw18r, 0, 0, rw18r, rw18r, rw18r_state, empty_init, "Rockwell", "18R (Rockwell)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) COMP( 1975, rw31r, 0, 0, rw31r, rw31r, rw31r_state, empty_init, "Rockwell", "31R (Rockwell)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) COMP( 1976, rw24k, 0, 0, rw24k, rw24k, rw24k_state, empty_init, "Rockwell", "24K (Rockwell)", MACHINE_SUPPORTS_SAVE | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/layout/rw18r.lay b/src/mame/layout/rw10r.lay similarity index 100% rename from src/mame/layout/rw18r.lay rename to src/mame/layout/rw10r.lay diff --git a/src/mame/mame.lst b/src/mame/mame.lst index f657e6bd0c6..fb9d1e51ff6 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -16552,6 +16552,8 @@ gravity // Mattel mbaseb // Mattel mfootb // Mattel misatk // Mattel +rw10r // Rockwell +rw12r // Rockwell rw18r // Rockwell rw24k // Rockwell rw31r // Rockwell