diff options
Diffstat (limited to 'src/devices/machine/68307.cpp')
-rw-r--r-- | src/devices/machine/68307.cpp | 89 |
1 files changed, 40 insertions, 49 deletions
diff --git a/src/devices/machine/68307.cpp b/src/devices/machine/68307.cpp index ca98bbfa85b..a950be1fd2b 100644 --- a/src/devices/machine/68307.cpp +++ b/src/devices/machine/68307.cpp @@ -21,13 +21,13 @@ DEFINE_DEVICE_TYPE(M68307, m68307_cpu_device, "mc68307", "MC68307") a custom verson here, that may change later if subtle differences exist. */ -READ8_MEMBER( m68307_cpu_device::m68307_internal_serial_r ) +uint8_t m68307_cpu_device::m68307_internal_serial_r(offs_t offset) { if (offset&1) return m_duart->read(offset>>1); return 0x0000; } -WRITE8_MEMBER(m68307_cpu_device::m68307_internal_serial_w) +void m68307_cpu_device::m68307_internal_serial_w(offs_t offset, uint8_t data) { if (offset & 1) m_duart->write(offset >> 1, data); } @@ -56,13 +56,17 @@ void m68307_cpu_device::device_add_mconfig(machine_config &config) } -m68307_cpu_device::m68307_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : m68000_device(mconfig, tag, owner, clock, M68307, 16, 24, address_map_constructor(FUNC(m68307_cpu_device::internal_map), this)), +m68307_cpu_device::m68307_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + m68000_device(mconfig, M68307, tag, owner, clock), m_write_irq(*this), m_write_a_tx(*this), m_write_b_tx(*this), - m_read_inport(*this), + m_read_inport(*this, 0), m_write_outport(*this), + m_porta_r(*this), + m_porta_w(*this), + m_portb_r(*this), + m_portb_w(*this), m_duart(*this, "internal68681") { m_m68307SIM = nullptr; @@ -75,6 +79,11 @@ m68307_cpu_device::m68307_cpu_device(const machine_config &mconfig, const char * m_ipl = 0; m_cpu_space_config.m_internal_map = address_map_constructor(FUNC(m68307_cpu_device::cpu_space_map), this); + auto imap = address_map_constructor(FUNC(m68307_cpu_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; } @@ -97,7 +106,7 @@ void m68307_cpu_device::device_reset() set_ipl(0); } -void m68307_cpu_device::m68k_reset_peripherals() +void m68307_cpu_device::reset_peripherals(int state) { m_duart->reset(); @@ -123,22 +132,6 @@ inline int m68307_cpu_device::calc_cs(offs_t address) const return 0; } -void m68307_cpu_device::init16_m68307(address_space &space) -{ - m_space = &space; - auto cache = space.cache<1, 0, ENDIANNESS_BIG>(); - - m_readimm16 = [cache](offs_t address) -> u16 { /* m_m68307_currentcs = calc_cs(address); */ return cache->read_word(address); }; - m_read8 = [this](offs_t address) -> u8 { /* m_m68307_currentcs = calc_cs(address); */ return m_space->read_byte(address); }; - m_read16 = [this](offs_t address) -> u16 { /* m_m68307_currentcs = calc_cs(address); */ return m_space->read_word(address); }; - m_read32 = [this](offs_t address) -> u32 { /* m_m68307_currentcs = calc_cs(address); */ return m_space->read_dword(address); }; - m_write8 = [this](offs_t address, u8 data) { /* m_m68307_currentcs = calc_cs(address); */ m_space->write_byte(address, data); }; - m_write16 = [this](offs_t address, u16 data) { /* m_m68307_currentcs = calc_cs(address); */ m_space->write_word(address, data); }; - m_write32 = [this](offs_t address, u32 data) { /* m_m68307_currentcs = calc_cs(address); */ m_space->write_dword(address, data); }; -} - - - void m68307_cpu_device::set_port_callbacks( porta_read_delegate &&porta_r, porta_write_delegate &&porta_w, @@ -177,7 +170,7 @@ void m68307_cpu_device::set_ipl(int level) } } -WRITE_LINE_MEMBER(m68307_cpu_device::timer0_interrupt) +void m68307_cpu_device::timer0_interrupt(int state) { int prioritylevel = (m_m68307SIM->m_picr & 0x7000) >> 12; if (state && m_ipl < prioritylevel) @@ -186,7 +179,7 @@ WRITE_LINE_MEMBER(m68307_cpu_device::timer0_interrupt) set_ipl(m_m68307SIM->get_ipl(this)); } -WRITE_LINE_MEMBER(m68307_cpu_device::timer1_interrupt) +void m68307_cpu_device::timer1_interrupt(int state) { int prioritylevel = (m_m68307SIM->m_picr & 0x0700) >> 8; if (state && m_ipl < prioritylevel) @@ -195,7 +188,7 @@ WRITE_LINE_MEMBER(m68307_cpu_device::timer1_interrupt) set_ipl(m_m68307SIM->get_ipl(this)); } -WRITE_LINE_MEMBER(m68307_cpu_device::m68307_duart_irq_handler) +void m68307_cpu_device::m68307_duart_irq_handler(int state) { int prioritylevel = (m_m68307SIM->m_picr & 0x0070) >> 4; if (state && m_ipl < prioritylevel) @@ -204,7 +197,7 @@ WRITE_LINE_MEMBER(m68307_cpu_device::m68307_duart_irq_handler) set_ipl(m_m68307SIM->get_ipl(this)); } -WRITE_LINE_MEMBER(m68307_cpu_device::mbus_interrupt) +void m68307_cpu_device::mbus_interrupt(int state) { int prioritylevel = (m_m68307SIM->m_picr & 0x0007) >> 0; if (state && m_ipl < prioritylevel) @@ -237,14 +230,14 @@ uint8_t m68307_cpu_device::int_ack(offs_t offset) void m68307_cpu_device::device_start() { - init_cpu_m68000(); + reset_cb().append(*this, FUNC(m68307_cpu_device::reset_peripherals)); + + m68000_device::device_start(); /* basic CS logic, timers, mbus, serial logic set via remappable register */ - init16_m68307(*m_program); - m_m68307SIM = new m68307_sim(); m_m68307MBUS = new m68307_mbus(); m_m68307TIMER = new m68307_timer(); @@ -255,25 +248,21 @@ void m68307_cpu_device::device_start() m_m68307MBUS->reset(); m_m68307TIMER->reset(); - m_internal = &space(AS_PROGRAM); m_m68307_base = 0xbfff; m_m68307_scrhigh = 0x0007; m_m68307_scrlow = 0xf010; - m_write_irq.resolve_safe(); - m_write_a_tx.resolve_safe(); - m_write_b_tx.resolve_safe(); - m_read_inport.resolve(); - m_write_outport.resolve_safe(); - - set_port_callbacks(porta_read_delegate(), porta_write_delegate(), portb_read_delegate(), portb_write_delegate()); + m_porta_r.set(nullptr); + m_porta_w.set(nullptr); + m_portb_r.set(nullptr); + m_portb_w.set(nullptr); } -READ16_MEMBER( m68307_cpu_device::m68307_internal_base_r ) +uint16_t m68307_cpu_device::m68307_internal_base_r(offs_t offset, uint16_t mem_mask) { - logerror("%08x m68307_internal_base_r %08x, (%04x)\n", m_ppc, offset*2,mem_mask); + logerror("%08x m68307_internal_base_r %08x, (%04x)\n", m_ipc, offset*2,mem_mask); switch (offset<<1) { @@ -287,9 +276,11 @@ READ16_MEMBER( m68307_cpu_device::m68307_internal_base_r ) return 0x0000; } -WRITE16_MEMBER( m68307_cpu_device::m68307_internal_base_w ) +void m68307_cpu_device::m68307_internal_base_w(offs_t offset, uint16_t data, uint16_t mem_mask) { - logerror("%08x m68307_internal_base_w %08x, %04x (%04x)\n", m_ppc, offset*2,data,mem_mask); + // emumem needs some kind of overlay capability... it's probably not the only one + + logerror("%08x m68307_internal_base_w %08x, %04x (%04x)\n", m_ipc, offset*2,data,mem_mask); int base; //int mask = 0; @@ -300,10 +291,10 @@ WRITE16_MEMBER( m68307_cpu_device::m68307_internal_base_w ) base = (m_m68307_base & 0x0fff) << 12; //mask = (m_m68307_base & 0xe000) >> 13; //if ( m_m68307_base & 0x1000 ) mask |= 7; - m_internal->unmap_readwrite(base+0x000, base+0x04f); - m_internal->unmap_readwrite(base+0x100, base+0x11f); - m_internal->unmap_readwrite(base+0x120, base+0x13f); - m_internal->unmap_readwrite(base+0x140, base+0x149); + m_s_program->unmap_readwrite(base+0x000, base+0x04f); + m_s_program->unmap_readwrite(base+0x100, base+0x11f); + m_s_program->unmap_readwrite(base+0x120, base+0x13f); + m_s_program->unmap_readwrite(base+0x140, base+0x149); /* store new base address */ COMBINE_DATA(&m_m68307_base); @@ -312,10 +303,10 @@ WRITE16_MEMBER( m68307_cpu_device::m68307_internal_base_w ) base = (m_m68307_base & 0x0fff) << 12; //mask = (m_m68307_base & 0xe000) >> 13; //if ( m_m68307_base & 0x1000 ) mask |= 7; - m_internal->install_readwrite_handler(base + 0x000, base + 0x04f, read16_delegate(FUNC(m68307_cpu_device::m68307_internal_sim_r),this), write16_delegate(FUNC(m68307_cpu_device::m68307_internal_sim_w),this)); - m_internal->install_readwrite_handler(base + 0x100, base + 0x11f, read8_delegate(FUNC(m68307_cpu_device::m68307_internal_serial_r),this), write8_delegate(FUNC(m68307_cpu_device::m68307_internal_serial_w),this), 0xffff); - m_internal->install_readwrite_handler(base + 0x120, base + 0x13f, read16_delegate(FUNC(m68307_cpu_device::m68307_internal_timer_r),this), write16_delegate(FUNC(m68307_cpu_device::m68307_internal_timer_w),this)); - m_internal->install_readwrite_handler(base + 0x140, base + 0x149, read8_delegate(FUNC(m68307_cpu_device::m68307_internal_mbus_r),this), write8_delegate(FUNC(m68307_cpu_device::m68307_internal_mbus_w),this), 0xffff); + m_s_program->install_readwrite_handler(base + 0x000, base + 0x04f, read16_delegate(*this, FUNC(m68307_cpu_device::m68307_internal_sim_r)), write16_delegate(*this, FUNC(m68307_cpu_device::m68307_internal_sim_w))); + m_s_program->install_readwrite_handler(base + 0x100, base + 0x11f, read8sm_delegate(*this, FUNC(m68307_cpu_device::m68307_internal_serial_r)), write8sm_delegate(*this, FUNC(m68307_cpu_device::m68307_internal_serial_w)), 0xffff); + m_s_program->install_readwrite_handler(base + 0x120, base + 0x13f, read16s_delegate(*this, FUNC(m68307_cpu_device::m68307_internal_timer_r)), write16s_delegate(*this, FUNC(m68307_cpu_device::m68307_internal_timer_w))); + m_s_program->install_readwrite_handler(base + 0x140, base + 0x149, read8sm_delegate(*this, FUNC(m68307_cpu_device::m68307_internal_mbus_r)), write8sm_delegate(*this, FUNC(m68307_cpu_device::m68307_internal_mbus_w)), 0xffff); break; |