diff options
author | 2017-12-13 21:01:10 -0700 | |
---|---|---|
committer | 2017-12-13 21:01:10 -0700 | |
commit | 54155441e9ba9941e85d80c4834a66376a11e791 (patch) | |
tree | aa44bdaf0035cbe188d64c447f225f10f7d76d8d /src/devices/machine/68340.cpp | |
parent | f537428e5a40ba6dde8ca9bf0fe9ae6b1f189ac4 (diff) |
Revert "Merge branch 'master' of https://github.com/mamedev/mame"
This reverts commit f537428e5a40ba6dde8ca9bf0fe9ae6b1f189ac4, reversing
changes made to 0d70d798107d4e4e8fb9f230410aeb1e888d65c5.
Diffstat (limited to 'src/devices/machine/68340.cpp')
-rw-r--r-- | src/devices/machine/68340.cpp | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/src/devices/machine/68340.cpp b/src/devices/machine/68340.cpp index 2701909f18b..3427fb6c7e3 100644 --- a/src/devices/machine/68340.cpp +++ b/src/devices/machine/68340.cpp @@ -11,17 +11,17 @@ DEFINE_DEVICE_TYPE(M68340, m68340_cpu_device, "mc68340", "MC68340") int m68340_cpu_device::calc_cs(offs_t address) const { - if ( !(m_m68340SIM->m_ba[0] & 1) ) return 1; + if ( !(m68340SIM->m_ba[0] & 1) ) return 1; for (int i=0;i<4;i++) { - if (m_m68340SIM->m_ba[i] & 1) + if (m68340SIM->m_ba[i] & 1) { - int mask = ((m_m68340SIM->m_am[i]&0xffffff00) | 0xff); - int base = m_m68340SIM->m_ba[i] & 0xffffff00; - int fcmask = (m_m68340SIM->m_am[i] & 0xf0); - int fcbase = (m_m68340SIM->m_ba[i] & 0xf0) & ~(m_m68340SIM->m_am[i] & 0xf0); - int fc = m_mmu_tmp_fc; + int mask = ((m68340SIM->m_am[i]&0xffffff00) | 0xff); + int base = m68340SIM->m_ba[i] & 0xffffff00; + int fcmask = (m68340SIM->m_am[i] & 0xf0); + int fcbase = (m68340SIM->m_ba[i] & 0xf0) & ~(m68340SIM->m_am[i] & 0xf0); + int fc = mmu_tmp_fc; if ((address & ~mask) == base && ((fc << 4) & ~fcmask ) == fcbase ) return i+1; } @@ -45,56 +45,58 @@ uint16_t m68340_cpu_device::get_cs(offs_t address) READ32_MEMBER( m68340_cpu_device::m68340_internal_base_r ) { - logerror("%08x m68340_internal_base_r %08x, (%08x)\n", m_ppc, offset*4,mem_mask); - return m_m68340_base; + int pc = space.device().safe_pc(); + logerror("%08x m68340_internal_base_r %08x, (%08x)\n", pc, offset*4,mem_mask); + return m68340_base; } WRITE32_MEMBER( m68340_cpu_device::m68340_internal_base_w ) { - logerror("%08x m68340_internal_base_w %08x, %08x (%08x)\n", m_ppc, offset*4,data,mem_mask); + int pc = space.device().safe_pc(); + logerror("%08x m68340_internal_base_w %08x, %08x (%08x)\n", pc, offset*4,data,mem_mask); // other conditions? - if (m_dfc==0x7) + if (dfc==0x7) { // unmap old modules - if (m_m68340_base&1) + if (m68340_base&1) { - int base = m_m68340_base & 0xfffff000; + int base = m68340_base & 0xfffff000; - m_internal->unmap_readwrite(base + 0x000, base + 0x05f); - m_internal->unmap_readwrite(base + 0x600, base + 0x67f); - m_internal->unmap_readwrite(base + 0x700, base + 0x723); - m_internal->unmap_readwrite(base + 0x780, base + 0x7bf); + internal->unmap_readwrite(base + 0x000, base + 0x05f); + internal->unmap_readwrite(base + 0x600, base + 0x67f); + internal->unmap_readwrite(base + 0x700, base + 0x723); + internal->unmap_readwrite(base + 0x780, base + 0x7bf); } - COMBINE_DATA(&m_m68340_base); - logerror("%08x m68340_internal_base_w %08x, %08x (%08x) (m_m68340_base write)\n", pc(), offset*4,data,mem_mask); + COMBINE_DATA(&m68340_base); + logerror("%08x m68340_internal_base_w %08x, %08x (%08x) (m68340_base write)\n", pc, offset*4,data,mem_mask); // map new modules - if (m_m68340_base&1) + if (m68340_base&1) { - int base = m_m68340_base & 0xfffff000; + int base = m68340_base & 0xfffff000; - m_internal->install_readwrite_handler(base + 0x000, base + 0x03f, + internal->install_readwrite_handler(base + 0x000, base + 0x03f, read16_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_r),this), write16_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_w),this),0xffffffff); - m_internal->install_readwrite_handler(base + 0x010, base + 0x01f, // Intentionally punches a hole in previous address mapping + internal->install_readwrite_handler(base + 0x010, base + 0x01f, // Intentionally punches a hole in previous address mapping read8_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_ports_r),this), write8_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_ports_w),this),0xffffffff); - m_internal->install_readwrite_handler(base + 0x040, base + 0x05f, + internal->install_readwrite_handler(base + 0x040, base + 0x05f, read32_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_cs_r),this), write32_delegate(FUNC(m68340_cpu_device::m68340_internal_sim_cs_w),this)); - m_internal->install_readwrite_handler(base + 0x600, base + 0x63f, + internal->install_readwrite_handler(base + 0x600, base + 0x63f, READ16_DEVICE_DELEGATE(m_timer1, mc68340_timer_module_device, read), WRITE16_DEVICE_DELEGATE(m_timer1, mc68340_timer_module_device, write),0xffffffff); - m_internal->install_readwrite_handler(base + 0x640, base + 0x67f, + internal->install_readwrite_handler(base + 0x640, base + 0x67f, READ16_DEVICE_DELEGATE(m_timer2, mc68340_timer_module_device, read), WRITE16_DEVICE_DELEGATE(m_timer2, mc68340_timer_module_device, write),0xffffffff); - m_internal->install_readwrite_handler(base + 0x700, base + 0x723, + internal->install_readwrite_handler(base + 0x700, base + 0x723, READ8_DEVICE_DELEGATE(m_serial, mc68340_serial_module_device, read), WRITE8_DEVICE_DELEGATE(m_serial, mc68340_serial_module_device, write),0xffffffff); - m_internal->install_readwrite_handler(base + 0x780, base + 0x7bf, + internal->install_readwrite_handler(base + 0x780, base + 0x7bf, read32_delegate(FUNC(m68340_cpu_device::m68340_internal_dma_r),this), write32_delegate(FUNC(m68340_cpu_device::m68340_internal_dma_w),this)); @@ -103,7 +105,7 @@ WRITE32_MEMBER( m68340_cpu_device::m68340_internal_base_w ) } else { - logerror("%08x m68340_internal_base_w %08x, %04x (%04x) (should fall through?)\n", pc(), offset*4,data,mem_mask); + logerror("%08x m68340_internal_base_w %08x, %04x (%04x) (should fall through?)\n", pc, offset*4,data,mem_mask); } @@ -143,9 +145,9 @@ m68340_cpu_device::m68340_cpu_device(const machine_config &mconfig, const char * , m_pb_out_cb(*this) , m_pb_in_cb(*this) { - m_m68340SIM = nullptr; - m_m68340DMA = nullptr; - m_m68340_base = 0; + m68340SIM = nullptr; + m68340DMA = nullptr; + m68340_base = 0; } void m68340_cpu_device::device_reset() @@ -166,15 +168,15 @@ void m68340_cpu_device::device_start() { fscpu32_device::device_start(); - m_m68340SIM = new m68340_sim(); - m_m68340DMA = new m68340_dma(); + m68340SIM = new m68340_sim(); + m68340DMA = new m68340_dma(); - m_m68340SIM->reset(); - m_m68340DMA->reset(); + m68340SIM->reset(); + m68340DMA->reset(); start_68340_sim(); - m_m68340_base = 0x00000000; + m68340_base = 0x00000000; - m_internal = &space(AS_PROGRAM); + internal = &this->space(AS_PROGRAM); } |