Some cleanup and added $4016 EPSG addressing to all mappers
This commit is contained in:
parent
7de782b486
commit
64efda4e0b
6 changed files with 12 additions and 90 deletions
28
Core/AXROM.h
28
Core/AXROM.h
|
@ -1,21 +1,9 @@
|
|||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "BaseMapper.h"
|
||||
#include "CPU.h"
|
||||
#include "EPSGAudio.h"
|
||||
|
||||
|
||||
using AudioClass = EPSGAudio;
|
||||
|
||||
class AXROM : public BaseMapper
|
||||
{
|
||||
public:
|
||||
unique_ptr<AudioClass> _audio;
|
||||
|
||||
void ProcessCpuClock() override
|
||||
{
|
||||
_audio->Clock();
|
||||
}
|
||||
protected:
|
||||
virtual uint16_t GetPRGPageSize() override { return 0x8000; }
|
||||
virtual uint16_t GetCHRPageSize() override { return 0x2000; }
|
||||
|
@ -24,16 +12,8 @@ class AXROM : public BaseMapper
|
|||
{
|
||||
SelectCHRPage(0, 0);
|
||||
WriteRegister(0, GetPowerOnByte());
|
||||
_audio.reset(new AudioClass(_console));
|
||||
}
|
||||
|
||||
virtual void StreamState(bool saving) override
|
||||
{
|
||||
BaseMapper::StreamState(saving);
|
||||
SnapshotInfo audio{ _audio.get() };
|
||||
Stream(audio);
|
||||
}
|
||||
|
||||
bool HasBusConflicts() override { return _romInfo.SubMapperID == 2; }
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value) override
|
||||
|
@ -42,12 +22,4 @@ class AXROM : public BaseMapper
|
|||
|
||||
SetMirroringType(((value & 0x10) == 0x10) ? MirroringType::ScreenBOnly : MirroringType::ScreenAOnly);
|
||||
}
|
||||
void WriteEPSG(uint16_t addr, uint8_t value) override
|
||||
{
|
||||
switch (addr & 0x4016) {
|
||||
case 0x4016:
|
||||
_audio->WriteRegister(addr, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
|
@ -13,7 +13,7 @@
|
|||
#include "EmulationSettings.h"
|
||||
|
||||
void BaseMapper::WriteRegister(uint16_t addr, uint8_t value) { }
|
||||
void BaseMapper::WriteEPSG(uint16_t addr, uint8_t value) { }
|
||||
void BaseMapper::WriteEPSG(uint16_t addr, uint8_t value) { _epsgaudio->WriteRegister(addr, value); }
|
||||
uint8_t BaseMapper::ReadRegister(uint16_t addr) { return 0; }
|
||||
void BaseMapper::InitMapper(RomData &romData) { }
|
||||
void BaseMapper::Reset(bool softReset) { }
|
||||
|
@ -509,8 +509,9 @@ void BaseMapper::StreamState(bool saving)
|
|||
ArrayInfo<ChrMemoryType> chrMemoryType = { _chrMemoryType, 0x40 };
|
||||
ArrayInfo<MemoryAccessType> prgMemoryAccess = { _prgMemoryAccess, 0x100 };
|
||||
ArrayInfo<MemoryAccessType> chrMemoryAccess = { _chrMemoryAccess, 0x40 };
|
||||
SnapshotInfo epsgaudio{ _epsgaudio.get() };
|
||||
|
||||
Stream(_mirroringType, chrRam, workRam, saveRam, nametableRam, prgMemoryOffset, chrMemoryOffset, prgMemoryType, chrMemoryType, prgMemoryAccess, chrMemoryAccess);
|
||||
Stream(_mirroringType, chrRam, workRam, saveRam, nametableRam, prgMemoryOffset, chrMemoryOffset, prgMemoryType, chrMemoryType, prgMemoryAccess, chrMemoryAccess, epsgaudio);
|
||||
|
||||
if(!saving) {
|
||||
RestorePrgChrState();
|
||||
|
@ -637,6 +638,7 @@ void BaseMapper::Initialize(RomData &romData)
|
|||
|
||||
InitMapper();
|
||||
InitMapper(romData);
|
||||
_epsgaudio.reset(new EPSGAudio(_console));
|
||||
|
||||
//Load battery data if present
|
||||
LoadBattery();
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include "IBattery.h"
|
||||
#include "RomData.h"
|
||||
#include "Console.h"
|
||||
#include "CPU.h"
|
||||
#include "EPSGAudio.h"
|
||||
|
||||
class BaseControlDevice;
|
||||
|
||||
|
@ -156,7 +158,7 @@ protected:
|
|||
public:
|
||||
static constexpr uint32_t NametableCount = 0x10;
|
||||
static constexpr uint32_t NametableSize = 0x400;
|
||||
|
||||
unique_ptr<EPSGAudio> _epsgaudio;
|
||||
void Initialize(RomData &romData);
|
||||
|
||||
virtual ~BaseMapper();
|
||||
|
@ -166,6 +168,7 @@ public:
|
|||
|
||||
virtual void SetNesModel(NesModel model) { }
|
||||
virtual void ProcessCpuClock() { }
|
||||
virtual void ProcessEPSGClock() { _epsgaudio->Clock(); }
|
||||
virtual void NotifyVRAMAddressChange(uint16_t addr);
|
||||
virtual void GetMemoryRanges(MemoryRanges &ranges) override;
|
||||
|
||||
|
|
|
@ -465,6 +465,7 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile, bool forP
|
|||
|
||||
void Console::ProcessCpuClock()
|
||||
{
|
||||
_mapper->ProcessEPSGClock();
|
||||
_mapper->ProcessCpuClock();
|
||||
_apu->ProcessCpuClock();
|
||||
}
|
||||
|
|
38
Core/MMC3.h
38
Core/MMC3.h
|
@ -5,28 +5,10 @@
|
|||
#include "CPU.h"
|
||||
#include "EmulationSettings.h"
|
||||
#include "A12Watcher.h"
|
||||
#include "EPSGAudio.h"
|
||||
#include "Sunsoft5bAudio.h"
|
||||
|
||||
#ifndef MMC3_DEFAULT_AUDIO
|
||||
#define MMC3_USE_EPSG
|
||||
#endif
|
||||
|
||||
#ifdef MMC3_USE_EPSG
|
||||
using AudioClass = EPSGAudio;
|
||||
#else
|
||||
using AudioClass = Sunsoft5bAudio;
|
||||
#endif
|
||||
|
||||
class MMC3 : public BaseMapper
|
||||
{
|
||||
public:
|
||||
unique_ptr<AudioClass> _audio;
|
||||
|
||||
void ProcessCpuClock() override
|
||||
{
|
||||
_audio->Clock();
|
||||
}
|
||||
|
||||
private:
|
||||
enum class MMC3Registers
|
||||
|
@ -208,10 +190,9 @@ public:
|
|||
BaseMapper::StreamState(saving);
|
||||
ArrayInfo<uint8_t> registers = { _registers, 8 };
|
||||
SnapshotInfo a12Watcher{ &_a12Watcher };
|
||||
SnapshotInfo audio{ _audio.get() };
|
||||
Stream(_state.Reg8000, _state.RegA000, _state.RegA001, _currentRegister, _chrMode, _prgMode,
|
||||
_irqReloadValue, _irqCounter, _irqReload, _irqEnabled, a12Watcher,
|
||||
_wramEnabled, _wramWriteProtected, registers, audio);
|
||||
_wramEnabled, _wramWriteProtected, registers);
|
||||
}
|
||||
|
||||
virtual uint16_t GetPRGPageSize() override { return 0x2000; }
|
||||
|
@ -221,7 +202,6 @@ public:
|
|||
|
||||
virtual void InitMapper() override
|
||||
{
|
||||
_audio.reset(new AudioClass(_console));
|
||||
|
||||
//Force MMC3A irqs for boards that are known to use the A revision.
|
||||
//Some MMC3B boards also have the A behavior, but currently no way to tell them apart.
|
||||
|
@ -278,22 +258,6 @@ public:
|
|||
_irqEnabled = true;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (addr & 0xE000) {
|
||||
case 0xC000:
|
||||
case 0xE000:
|
||||
_audio->WriteRegister(addr, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WriteEPSG(uint16_t addr, uint8_t value) override
|
||||
{
|
||||
switch (addr & 0x4016) {
|
||||
case 0x4016:
|
||||
_audio->WriteRegister(addr, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void TriggerIrq()
|
||||
|
|
|
@ -3,22 +3,11 @@
|
|||
#include "BaseMapper.h"
|
||||
#include "CPU.h"
|
||||
#include "Sunsoft5bAudio.h"
|
||||
#include "EPSGAudio.h"
|
||||
|
||||
#ifndef SUNSOFT_DEFAULT_AUDIO
|
||||
#define SUNSOFT_USE_EPSG
|
||||
#endif
|
||||
|
||||
#ifdef SUNSOFT_USE_EPSG
|
||||
using SunsoftFme7AudioClass = EPSGAudio;
|
||||
#else
|
||||
using SunsoftFme7AudioClass = Sunsoft5bAudio;
|
||||
#endif
|
||||
|
||||
class SunsoftFme7 : public BaseMapper
|
||||
{
|
||||
private:
|
||||
unique_ptr<SunsoftFme7AudioClass> _audio;
|
||||
unique_ptr<Sunsoft5bAudio> _audio;
|
||||
uint8_t _command;
|
||||
uint8_t _workRamValue;
|
||||
bool _irqEnabled;
|
||||
|
@ -35,7 +24,7 @@ protected:
|
|||
|
||||
void InitMapper() override
|
||||
{
|
||||
_audio.reset(new AudioClass(_console));
|
||||
_audio.reset(new Sunsoft5bAudio(_console));
|
||||
|
||||
_command = 0;
|
||||
_workRamValue = 0;
|
||||
|
@ -81,15 +70,6 @@ protected:
|
|||
SetCpuMemoryMapping(0x6000, 0x7FFF, _workRamValue & 0x3F, PrgMemoryType::PrgRom);
|
||||
}
|
||||
}
|
||||
|
||||
void WriteEPSG(uint16_t addr, uint8_t value) override
|
||||
{
|
||||
switch (addr & 0x4016) {
|
||||
case 0x4016:
|
||||
_audio->WriteRegister(addr, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WriteRegister(uint16_t addr, uint8_t value) override
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue