abc1600: Some cleanup in the MAC. [Curt Coder]

This commit is contained in:
Curt Coder 2021-01-04 14:33:02 +02:00
parent 60b09c329b
commit 83ed267f2d
4 changed files with 29 additions and 10 deletions

View File

@ -103,6 +103,16 @@ enum
// READ/WRITE HANDLERS
//**************************************************************************
//-------------------------------------------------
// fc_r -
//-------------------------------------------------
uint8_t abc1600_state::fc_r()
{
return m_maincpu->get_fc() & 0x07;
}
//-------------------------------------------------
// bus_r -
//-------------------------------------------------
@ -865,7 +875,8 @@ void abc1600_state::abc1600(machine_config &config)
// devices
ABC1600_MAC(config, m_mac, 0);
m_mac->set_addrmap(AS_PROGRAM, &abc1600_state::mac_mem);
m_mac->set_cpu_tag(m_maincpu);
m_mac->fc_cb().set(FUNC(abc1600_state::fc_r));
m_mac->buserr_cb().set_inputline(m_maincpu, M68K_LINE_BUSERROR);
Z80DMA(config, m_dma0, 64_MHz_XTAL / 16);
m_dma0->out_busreq_callback().set(FUNC(abc1600_state::dbrq_w));

View File

@ -105,6 +105,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
uint8_t fc_r();
uint8_t bus_r(offs_t offset);
void bus_w(offs_t offset, uint8_t data);
uint8_t dart_r(offs_t offset);

View File

@ -110,12 +110,13 @@ const tiny_rom_entry *abc1600_mac_device::device_rom_region() const
abc1600_mac_device::abc1600_mac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, ABC1600_MAC, tag, owner, clock),
device_memory_interface(mconfig, *this),
m_space_config("program", ENDIANNESS_LITTLE, 8, 22, 0, address_map_constructor(FUNC(abc1600_mac_device::program_map), this)),
m_program_config("program", ENDIANNESS_BIG, 8, 21, 0, address_map_constructor(FUNC(abc1600_mac_device::program_map), this)),
m_rom(*this, "boot"),
m_segment_ram(*this, "segment_ram", 0x400, ENDIANNESS_LITTLE),
m_page_ram(*this, "page_ram", 0x800, ENDIANNESS_LITTLE),
m_watchdog(*this, "watchdog"),
m_cpu(*this, finder_base::DUMMY_TAG),
m_read_fc(*this),
m_write_buserr(*this),
m_task(0),
m_cause(0)
{
@ -128,6 +129,10 @@ abc1600_mac_device::abc1600_mac_device(const machine_config &mconfig, const char
void abc1600_mac_device::device_start()
{
// resolve callbacks
m_read_fc.resolve_safe(0);
m_write_buserr.resolve_safe();
// HACK fill segment RAM or abcenix won't boot
memset(m_segment_ram, 0xcd, 0x400);
//memset(m_page_ram, 0xcd, 0x400);
@ -159,7 +164,7 @@ void abc1600_mac_device::device_reset()
device_memory_interface::space_config_vector abc1600_mac_device::memory_space_config() const
{
return space_config_vector {
std::make_pair(AS_PROGRAM, &m_space_config)
std::make_pair(AS_PROGRAM, &m_program_config)
};
}
@ -222,8 +227,8 @@ offs_t abc1600_mac_device::translate_address(offs_t offset, int *nonx, int *wp)
if (PAGE_NONX)
{
//logerror("Bus error %06x : %06x\n", offset, virtual_offset);
//m_cpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE);
//m_cpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE);
//m_write_buserr(ASSERT_LINE);
//m_write_buserr(CLEAR_LINE);
}
*nonx = PAGE_NONX;
@ -326,7 +331,7 @@ void abc1600_mac_device::write_supervisor_memory(offs_t offset, uint8_t data)
int abc1600_mac_device::get_fc()
{
uint16_t fc = m_cpu->get_fc();
uint16_t fc = m_read_fc();
m_ifc2 = !(!(MAGIC || FC0) || FC2);

View File

@ -35,7 +35,8 @@ class abc1600_mac_device : public device_t,
public:
abc1600_mac_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
template <typename T> void set_cpu_tag(T &&tag) { m_cpu.set_tag(std::forward<T>(tag)); }
auto fc_cb() { return m_read_fc.bind(); }
auto buserr_cb() { return m_write_buserr.bind(); }
virtual void map(address_map &map);
@ -102,7 +103,7 @@ private:
uint8_t dma_iorq_r(int index, uint16_t offset);
void dma_iorq_w(int index, uint16_t offset, uint8_t data);
const address_space_config m_space_config;
const address_space_config m_program_config;
required_memory_region m_rom;
memory_share_creator<uint8_t> m_segment_ram;
@ -110,7 +111,8 @@ private:
required_device<watchdog_timer_device> m_watchdog;
required_device<m68000_base_device> m_cpu;
devcb_read8 m_read_fc;
devcb_write_line m_write_buserr;
int m_ifc2;
uint8_t m_task;