From 8624a3d013d67a1a756ba2c0451805811155c54c Mon Sep 17 00:00:00 2001 From: Brandon Wright Date: Sun, 10 Mar 2019 20:19:54 -0500 Subject: [PATCH] Revert IPL rom optimization. Something's not quite right with it. --- apu/bapu/smp/core.cpp | 7 +++---- apu/bapu/smp/memory.cpp | 25 +------------------------ apu/bapu/smp/smp.cpp | 2 -- apu/bapu/smp/smp.hpp | 1 - apu/bapu/smp/smp_state.cpp | 10 ---------- 5 files changed, 4 insertions(+), 41 deletions(-) diff --git a/apu/bapu/smp/core.cpp b/apu/bapu/smp/core.cpp index 3c814770..f5c2e6e6 100644 --- a/apu/bapu/smp/core.cpp +++ b/apu/bapu/smp/core.cpp @@ -27,15 +27,14 @@ void SMP::op_io(unsigned clocks) { uint8 SMP::op_read(uint16 addr) { tick(); if((addr & 0xfff0) == 0x00f0) return mmio_read(addr); + if(addr >= 0xffc0 && status.iplrom_enable) return iplrom[addr & 0x3f]; return apuram[addr]; } void SMP::op_write(uint16 addr, uint8 data) { tick(); - if((addr & 0xfff0) == 0x00f0 || addr >= 0xffc0) - mmio_write(addr, data); - else - apuram[addr] = data; + if((addr & 0xfff0) == 0x00f0) mmio_write(addr, data); + apuram[addr] = data; //all writes go to RAM, even MMIO writes } uint8 SMP::op_readstack() diff --git a/apu/bapu/smp/memory.cpp b/apu/bapu/smp/memory.cpp index 29cbfce7..3df43b15 100644 --- a/apu/bapu/smp/memory.cpp +++ b/apu/bapu/smp/memory.cpp @@ -51,31 +51,10 @@ unsigned SMP::mmio_read(unsigned addr) { } void SMP::mmio_write(unsigned addr, unsigned data) { - - if (addr >= 0xffc0) { - if (status.iplrom_enable) - highmem[addr & 0x3f] = data; - else - apuram[addr] = data; - return; - } - switch(addr) { case 0xf1: - if (((data & 0x80) > 0) != status.iplrom_enable) { - if (status.iplrom_enable) - { - status.iplrom_enable = false; - memcpy(&apuram[0xffc0], highmem, 64); - } - else - { - status.iplrom_enable = true; - memcpy(highmem, &apuram[0xffc0], 64); - memcpy(&apuram[0xffc0], iplrom, 64); - } - } + status.iplrom_enable = data & 0x80; if(data & 0x30) { if(data & 0x20) { @@ -144,6 +123,4 @@ void SMP::mmio_write(unsigned addr, unsigned data) { timer2.target = data; break; } - - apuram[addr] = data; //all writes go to RAM, even MMIO writes } diff --git a/apu/bapu/smp/smp.cpp b/apu/bapu/smp/smp.cpp index 247589aa..2cf58afd 100644 --- a/apu/bapu/smp/smp.cpp +++ b/apu/bapu/smp/smp.cpp @@ -50,8 +50,6 @@ void SMP::reset() { //$00f1 status.iplrom_enable = true; - memset(highmem, 0, 64); - memcpy(&apuram[0xffc0], iplrom, 64); //$00f2 status.dsp_addr = 0x00; diff --git a/apu/bapu/smp/smp.hpp b/apu/bapu/smp/smp.hpp index 41546ef4..e268755f 100644 --- a/apu/bapu/smp/smp.hpp +++ b/apu/bapu/smp/smp.hpp @@ -1,7 +1,6 @@ class SMP : public Processor { public: static const uint8 iplrom[64]; - uint8 highmem[64]; uint8 *apuram; unsigned port_read(unsigned port); diff --git a/apu/bapu/smp/smp_state.cpp b/apu/bapu/smp/smp_state.cpp index 7dd0c4e4..536850fa 100644 --- a/apu/bapu/smp/smp_state.cpp +++ b/apu/bapu/smp/smp_state.cpp @@ -73,11 +73,6 @@ void SMP::save_spc (uint8 *block) { void SMP::save_state(uint8 **block) { uint8 *ptr = *block; memcpy(ptr, apuram, 64 * 1024); - if (status.iplrom_enable) - { - memcpy(&ptr[0xffc0], highmem, 64); - } - ptr += 64 * 1024; #undef INT32 @@ -165,11 +160,6 @@ void SMP::load_state(uint8 **block) { INT32(regs.p.c); INT32(status.iplrom_enable); - if (status.iplrom_enable) - { - memcpy(highmem, &apuram[0xffc0], 64); - memcpy(&apuram[0xffc0], iplrom, 64); - } INT32(status.dsp_addr);