scc68070: Revert to use musashi for now, it's very much not a traditional 68000.

This commit is contained in:
Olivier Galibert 2023-02-05 16:48:15 +01:00
parent 5c3e2118c7
commit e76e82c9e4
9 changed files with 93 additions and 24 deletions

View File

@ -1955,6 +1955,8 @@ if CPUS["M680X0"] then
MAME_DIR .. "src/devices/cpu/m68000/m68030.cpp",
MAME_DIR .. "src/devices/cpu/m68000/m68040.h",
MAME_DIR .. "src/devices/cpu/m68000/m68040.cpp",
MAME_DIR .. "src/devices/cpu/m68000/scc68070.h",
MAME_DIR .. "src/devices/cpu/m68000/scc68070.cpp",
MAME_DIR .. "src/devices/cpu/m68000/fscpu32.h",
MAME_DIR .. "src/devices/cpu/m68000/fscpu32.cpp",
MAME_DIR .. "src/devices/cpu/m68000/mcf5206e.h",

View File

@ -0,0 +1,24 @@
// license:BSD-3-Clause
// copyright-holders:Karl Stenerud
#include "emu.h"
#include "scc68070.h"
#include "m68kdasm.h"
std::unique_ptr<util::disasm_interface> scc68070_base_device::create_disassembler()
{
return std::make_unique<m68k_disassembler>(m68k_disassembler::TYPE_68000);
}
scc68070_base_device::scc68070_base_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock,
const device_type type, address_map_constructor internal_map)
: m68000_musashi_device(mconfig, tag, owner, clock, type, 16,32, internal_map)
{
}
void scc68070_base_device::device_start()
{
m68000_musashi_device::device_start();
init_cpu_scc68070();
}

View File

@ -0,0 +1,26 @@
// license:BSD-3-Clause
// copyright-holders:Karl Stenerud
#ifndef MAME_CPU_M68000_SCC68070_H
#define MAME_CPU_M68000_SCC68070_H
#pragma once
#include "m68kmusashi.h"
class scc68070_base_device : public m68000_musashi_device
{
protected:
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
virtual u32 execute_min_cycles() const noexcept override { return 4; }
virtual u32 execute_max_cycles() const noexcept override { return 158; }
// device-level overrides
virtual void device_start() override;
scc68070_base_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock,
const device_type type, address_map_constructor internal_map);
};
#endif

View File

@ -230,7 +230,7 @@ uint8_t m68307_cpu_device::int_ack(offs_t offset)
void m68307_cpu_device::device_start()
{
reset_cb().append(FUNC(m68307_cpu_device::reset_peripherals));
reset_cb().append(*this, FUNC(m68307_cpu_device::reset_peripherals));
m68000_device::device_start();

View File

@ -256,7 +256,7 @@ WRITE_LINE_MEMBER( m68340_cpu_device::set_modck )
void m68340_cpu_device::device_start()
{
reset_cb().append(FUNC(m68340_cpu_device::reset_peripherals));
reset_cb().append(*this, FUNC(m68340_cpu_device::reset_peripherals));
fscpu32_device::device_start();

View File

@ -239,7 +239,7 @@ void scc68070_device::cpu_space_map(address_map &map)
//-------------------------------------------------
scc68070_device::scc68070_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: m68000_device(mconfig, SCC68070, tag, owner, clock)
: scc68070_base_device(mconfig, tag, owner, clock, SCC68070, address_map_constructor(FUNC(scc68070_device::internal_map), this))
, m_iack2_callback(*this)
, m_iack4_callback(*this)
, m_iack5_callback(*this)
@ -258,18 +258,6 @@ scc68070_device::scc68070_device(const machine_config &mconfig, const char *tag,
, m_int2_line(CLEAR_LINE)
{
m_cpu_space_config.m_internal_map = address_map_constructor(FUNC(scc68070_device::cpu_space_map), this);
m_cpu_space_config.m_addr_width = 32;
m_program_config.m_addr_width = 32;
m_opcodes_config.m_addr_width = 32;
m_uprogram_config.m_addr_width = 32;
m_uopcodes_config.m_addr_width = 32;
auto imap = address_map_constructor(FUNC(scc68070_device::internal_map), this);
m_program_config.m_internal_map = imap;
m_opcodes_config.m_internal_map = imap;
m_uprogram_config.m_internal_map = imap;
m_uopcodes_config.m_internal_map = imap;
}
//-------------------------------------------------
@ -280,7 +268,7 @@ scc68070_device::scc68070_device(const machine_config &mconfig, const char *tag,
void scc68070_device::device_resolve_objects()
{
m68000_device::device_resolve_objects();
scc68070_base_device::device_resolve_objects();
m_iack2_callback.resolve_safe(autovector(2));
m_iack4_callback.resolve_safe(autovector(4));
@ -299,9 +287,9 @@ void scc68070_device::device_resolve_objects()
void scc68070_device::device_start()
{
reset_cb().append(FUNC(scc68070_device::reset_peripherals));
reset_cb().append(*this, FUNC(scc68070_device::reset_peripherals));
m68000_device::device_start();
scc68070_base_device::device_start();
save_item(NAME(m_ipl));
@ -392,7 +380,7 @@ void scc68070_device::device_start()
void scc68070_device::device_reset()
{
m68000_device::device_reset();
scc68070_base_device::device_reset();
m_lir = 0;

View File

@ -26,7 +26,7 @@ TODO:
#pragma once
#include "cpu/m68000/m68000.h"
#include "cpu/m68000/scc68070.h"
//**************************************************************************
// TYPE DEFINITIONS
@ -43,7 +43,7 @@ enum scc68070_ocr_bits
// ======================> scc68070_device
class scc68070_device : public m68000_device
class scc68070_device : public scc68070_base_device
{
public:
scc68070_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@ -199,12 +199,12 @@ protected:
virtual u64 execute_clocks_to_cycles(u64 clocks) const noexcept override { return (clocks + 2 - 1) / 2; }
virtual u64 execute_cycles_to_clocks(u64 cycles) const noexcept override { return (cycles * 2); }
DECLARE_WRITE_LINE_MEMBER(reset_peripherals);
private:
void internal_map(address_map &map);
void cpu_space_map(address_map &map);
DECLARE_WRITE_LINE_MEMBER(reset_peripherals);
void update_ipl();
uint8_t iack_r(offs_t offset);

View File

@ -84,7 +84,7 @@ TODO:
void cdi_state::cdimono1_mem(address_map &map)
{
map(0x000000, 0xffffff).rw(m_maincpu, FUNC(scc68070_device::berr_r), FUNC(scc68070_device::berr_w));
map(0x000000, 0xffffff).rw(FUNC(cdi_state::bus_error_r), FUNC(cdi_state::bus_error_w));
map(0x000000, 0x07ffff).rw(FUNC(cdi_state::plane_r<0>), FUNC(cdi_state::plane_w<0>)).share("plane0");
map(0x200000, 0x27ffff).rw(FUNC(cdi_state::plane_r<1>), FUNC(cdi_state::plane_w<1>)).share("plane1");
map(0x300000, 0x303bff).rw(m_cdic, FUNC(cdicdic_device::ram_r), FUNC(cdicdic_device::ram_w));
@ -238,6 +238,32 @@ uint16_t cdi_state::main_rom_r(offs_t offset)
}
/**********************
* BERR Handling *
**********************/
uint16_t cdi_state::bus_error_r(offs_t offset)
{
if(!machine().side_effects_disabled())
{
m_maincpu->set_buserror_details(offset*2, true, m_maincpu->get_fc());
m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE);
m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE);
}
return 0xff;
}
void cdi_state::bus_error_w(offs_t offset, uint16_t data)
{
if(!machine().side_effects_disabled())
{
m_maincpu->set_buserror_details(offset*2, false, m_maincpu->get_fc());
m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE);
m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE);
}
}
/**********************
* Quizard Protection *
**********************/

View File

@ -69,6 +69,9 @@ private:
uint16_t dvc_r(offs_t offset, uint16_t mem_mask = ~0);
void dvc_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
uint16_t bus_error_r(offs_t offset);
void bus_error_w(offs_t offset, uint16_t data);
required_shared_ptr_array<uint16_t, 2> m_plane_ram;
optional_device<m68hc05c8_device> m_servo;
optional_device<m68hc05c8_device> m_slave;