Skip to content

Commit

Permalink
added MM76 disassembler and preliminary PPS-4/1 MCU core [hap]
Browse files Browse the repository at this point in the history
New machines marked as NOT_WORKING
----------------------------------
Electronic Master Mind (Invicta) [hap, Sean Riddle]
  • Loading branch information
happppp committed Feb 26, 2021
1 parent 1a0b950 commit 2f02c96
Show file tree
Hide file tree
Showing 38 changed files with 1,100 additions and 156 deletions.
28 changes: 24 additions & 4 deletions scripts/src/cpu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -452,17 +452,17 @@ if (CPUS["COSMAC"]~=null or _OPTIONS["with-tools"]) then
end

--------------------------------------------------
-- National Semiconductor COPS1 family
-- National Semiconductor COPS(MM57) family
--@src/devices/cpu/cops1/mm5799.h,CPUS["COPS1"] = true
--------------------------------------------------

if (CPUS["COPS1"]~=null) then
files {
MAME_DIR .. "src/devices/cpu/cops1/cops1base.cpp",
MAME_DIR .. "src/devices/cpu/cops1/cops1base.h",
MAME_DIR .. "src/devices/cpu/cops1/cops1op.cpp",
MAME_DIR .. "src/devices/cpu/cops1/mm5799.cpp",
MAME_DIR .. "src/devices/cpu/cops1/mm5799.h",
MAME_DIR .. "src/devices/cpu/cops1/mm5799op.cpp",
}
end

Expand All @@ -472,7 +472,7 @@ if (CPUS["COPS1"]~=null or _OPTIONS["with-tools"]) then
end

--------------------------------------------------
-- National Semiconductor COP400 family
-- National Semiconductor COPS(COP400) family
--@src/devices/cpu/cop400/cop400.h,CPUS["COP400"] = true
--------------------------------------------------

Expand Down Expand Up @@ -2178,7 +2178,7 @@ end

--------------------------------------------------
-- Panasonic MN1880
--@src/devices/cpu/mn1800/mn1880.h,CPUS["MN1880"] = true
--@src/devices/cpu/mn1880/mn1880.h,CPUS["MN1880"] = true
--------------------------------------------------

if (CPUS["MN1880"]~=null) then
Expand Down Expand Up @@ -2870,6 +2870,26 @@ if (CPUS["PPS4"]~=null or _OPTIONS["with-tools"]) then
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/pps4/pps4dasm.h")
end

--------------------------------------------------
-- Rockwell PPS-4/1
--@src/devices/cpu/pps41/mm76.h,CPUS["PPS41"] = true
--------------------------------------------------

if (CPUS["PPS41"]~=null) then
files {
MAME_DIR .. "src/devices/cpu/pps41/pps41base.cpp",
MAME_DIR .. "src/devices/cpu/pps41/pps41base.h",
MAME_DIR .. "src/devices/cpu/pps41/mm76.cpp",
MAME_DIR .. "src/devices/cpu/pps41/mm76.h",
MAME_DIR .. "src/devices/cpu/pps41/mm76op.cpp",
}
end

if (CPUS["PPS41"]~=null or _OPTIONS["with-tools"]) then
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/pps41/pps41d.cpp")
table.insert(disasm_files , MAME_DIR .. "src/devices/cpu/pps41/pps41d.h")
end

--------------------------------------------------
-- Hitachi HD61700
--@src/devices/cpu/hd61700/hd61700.h,CPUS["HD61700"] = true
Expand Down
1 change: 1 addition & 0 deletions scripts/target/mame/arcade.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ CPUS["COSMAC"] = true
CPUS["UNSP"] = true
CPUS["HCD62121"] = true
CPUS["PPS4"] = true
--CPUS["PPS41"] = true
CPUS["UPD7725"] = true
CPUS["HD61700"] = true
CPUS["LC8670"] = true
Expand Down
2 changes: 2 additions & 0 deletions scripts/target/mame/mess.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ CPUS["COSMAC"] = true
CPUS["UNSP"] = true
CPUS["HCD62121"] = true
CPUS["PPS4"] = true
CPUS["PPS41"] = true
CPUS["UPD7725"] = true
CPUS["HD61700"] = true
CPUS["LC8670"] = true
Expand Down Expand Up @@ -3456,6 +3457,7 @@ files {
MAME_DIR .. "src/mame/includes/aim65.h",
MAME_DIR .. "src/mame/machine/aim65.cpp",
MAME_DIR .. "src/mame/drivers/aim65_40.cpp",
MAME_DIR .. "src/mame/drivers/hh_pps41.cpp",
}

createMESSProjects(_target, _subtarget, "rtpc")
Expand Down
4 changes: 3 additions & 1 deletion src/devices/cpu/amis2000/amis2000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,9 @@ void amis2000_base_device::execute_run()
// remember previous opcode
m_prev_op = m_op;

debugger_instruction_hook(m_pc);
// fetch next opcode
if (!m_skip)
debugger_instruction_hook(m_pc);
m_op = m_program->read_byte(m_pc);
m_pc = (m_pc + 1) & 0x1fff;

Expand Down
6 changes: 3 additions & 3 deletions src/devices/cpu/amis2000/amis2000op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void amis2000_base_device::op_inp()
void amis2000_base_device::op_out()
{
// OUT: pulse output ACC and RAM to D-pins
logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
logerror("unknown opcode $%02X at $%04X\n", m_op, m_pc);
}

void amis2000_base_device::op_disb()
Expand Down Expand Up @@ -359,7 +359,7 @@ void amis2000_base_device::op_nop()
void amis2000_base_device::op_halt()
{
// HALT: debugger breakpoint for devkit-use
logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
logerror("unknown opcode $%02X at $%04X\n", m_op, m_pc);
}


Expand Down Expand Up @@ -405,7 +405,7 @@ void amis2000_base_device::op_sam()
void amis2000_base_device::op_sos()
{
// SOS: skip next on SF(timer output), clear SF
logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc);
logerror("unknown opcode $%02X at $%04X\n", m_op, m_pc);
}

void amis2000_base_device::op_tf1()
Expand Down
12 changes: 7 additions & 5 deletions src/devices/cpu/cops1/cops1base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// copyright-holders:hap
/*
National Semiconductor COPS(MM57 MCU family) cores
National Semiconductor COPS(MM57 MCU family) cores
This is the first "COPS" series (Controller Oriented Processor Systems),
4-bit MCUs with internal RAM and most of them internal ROM too.
Expand Down Expand Up @@ -36,7 +36,7 @@ looks more like a complex state machine.
#include "debugger.h"


cops1_base_device::cops1_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data) :
cops1_base_device::cops1_base_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) :
cpu_device(mconfig, type, tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 8, prgwidth, 0, program),
m_data_config("data", ENDIANNESS_LITTLE, 8, datawidth, 0, data),
Expand Down Expand Up @@ -192,8 +192,9 @@ void cops1_base_device::cycle()
void cops1_base_device::increment_pc()
{
// low part is LFSR
u8 feed = (m_pc & 0x3f) == 0 || ((m_pc >> 1 ^ m_pc) & 1) ? 0x20 : 0;
m_pc = (m_pc & ~0x3f) | (m_pc >> 1 & 0x1f) | feed;
int feed = ((m_pc & 0x3e) == 0) ? 1 : 0;
feed ^= (m_pc >> 1 ^ m_pc) & 1;
m_pc = (m_pc & ~0x3f) | (m_pc >> 1 & 0x1f) | (feed << 5);
}

void cops1_base_device::execute_run()
Expand All @@ -209,7 +210,8 @@ void cops1_base_device::execute_run()
m_write_blk(0);

// fetch next opcode
debugger_instruction_hook(m_pc);
if (!m_skip)
debugger_instruction_hook(m_pc);
m_op = m_program->read_byte(m_pc);
increment_pc();
cycle();
Expand Down
63 changes: 5 additions & 58 deletions src/devices/cpu/cops1/cops1base.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,18 @@ class cops1_base_device : public cpu_device

protected:
// construction/destruction
cops1_base_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data);
cops1_base_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-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;

// device_execute_interface overrides
virtual uint64_t execute_clocks_to_cycles(uint64_t clocks) const noexcept override { return (clocks + 4 - 1) / 4; }
virtual uint64_t execute_cycles_to_clocks(uint64_t cycles) const noexcept override { return (cycles * 4); }
virtual uint32_t execute_min_cycles() const noexcept override { return 1; }
virtual uint32_t execute_max_cycles() const noexcept override { return 2; }
virtual u64 execute_clocks_to_cycles(u64 clocks) const noexcept override { return (clocks + 4 - 1) / 4; }
virtual u64 execute_cycles_to_clocks(u64 cycles) const noexcept override { return (cycles * 4); }
virtual u32 execute_min_cycles() const noexcept override { return 1; }
virtual u32 execute_max_cycles() const noexcept override { return 2; }
virtual void execute_run() override;
virtual void execute_one() = 0;
virtual bool op_argument() = 0;
Expand Down Expand Up @@ -138,59 +138,6 @@ class cops1_base_device : public cpu_device
// misc handlers
void cycle();
void increment_pc();

u8 ram_r();
void ram_w(u8 data);
void pop_pc();
void push_pc();

// opcode handlers
void op_ad();
void op_add();
void op_sub();
void op_comp();
void op_0ta();
void op_adx();
void op_hxa();
void op_tam();
void op_sc();
void op_rsc();
void op_tc();

void op_tin();
void op_tf();
void op_tkb();
void op_tir();

void op_btd();
void op_dspa();
void op_dsps();
void op_axo();
void op_ldf();
void op_read();

void op_go();
void op_call();
void op_ret();
void op_rets();
void op_lg();
void op_nop();

void op_exc();
void op_excm();
void op_excp();
void op_mta();
void op_lm();

void op_sm();
void op_rsm();
void op_tm();

void op_lb();
void op_lbl();
void op_atb();
void op_bta();
void op_hxbr();
};


Expand Down
5 changes: 3 additions & 2 deletions src/devices/cpu/cops1/cops1d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ cops1_common_disassembler::cops1_common_disassembler()

offs_t cops1_common_disassembler::increment_pc(offs_t pc)
{
u8 feed = (pc & 0x3f) == 0 || ((pc >> 1 ^ pc) & 1) ? 0x20 : 0;
return (pc & ~0x3f) | (pc >> 1 & 0x1f) | feed;
int feed = ((pc & 0x3e) == 0) ? 1 : 0;
feed ^= (pc >> 1 ^ pc) & 1;
return (pc & ~0x3f) | (pc >> 1 & 0x1f) | (feed << 5);
}


Expand Down
4 changes: 2 additions & 2 deletions src/devices/cpu/cops1/cops1d.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class cops1_common_disassembler : public util::disasm_interface
};

static const char *const s_name[];
static const uint8_t s_bits[];
static const uint32_t s_flags[];
static const u8 s_bits[];
static const u32 s_flags[];

u8 m_l2r[0x40];
u8 m_r2l[0x40];
Expand Down
2 changes: 1 addition & 1 deletion src/devices/cpu/cops1/mm5799.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void mm5799_device::data_map(address_map &map)


// device definitions
mm5799_device::mm5799_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
mm5799_device::mm5799_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) :
cops1_base_device(mconfig, MM5799, tag, owner, clock, 11, address_map_constructor(FUNC(mm5799_device::program_map), this), 7, address_map_constructor(FUNC(mm5799_device::data_map), this))
{ }

Expand Down
56 changes: 55 additions & 1 deletion src/devices/cpu/cops1/mm5799.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
class mm5799_device : public cops1_base_device
{
public:
mm5799_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
mm5799_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);

protected:
// device-level overrides
Expand All @@ -53,6 +53,60 @@ class mm5799_device : public cops1_base_device

void data_map(address_map &map);
void program_map(address_map &map);

// opcode helpers
u8 ram_r();
void ram_w(u8 data);
void pop_pc();
void push_pc();

// opcode handlers
void op_ad();
void op_add();
void op_sub();
void op_comp();
void op_0ta();
void op_adx();
void op_hxa();
void op_tam();
void op_sc();
void op_rsc();
void op_tc();

void op_tin();
void op_tf();
void op_tkb();
void op_tir();

void op_btd();
void op_dspa();
void op_dsps();
void op_axo();
void op_ldf();
void op_read();

void op_go();
void op_call();
void op_ret();
void op_rets();
void op_lg();
void op_nop();

void op_exc();
void op_excm();
void op_excp();
void op_mta();
void op_lm();

void op_sm();
void op_rsm();
void op_tm();

void op_lb();
void op_lbl();
void op_atb();
void op_bta();
void op_hxbr();
};


Expand Down
Loading

0 comments on commit 2f02c96

Please sign in to comment.