remove Spc Loader code

This commit is contained in:
twinaphex 2022-04-07 21:51:35 +02:00
parent 7ff9e892f0
commit 3694c7f969
14 changed files with 5 additions and 386 deletions

View File

@ -21,7 +21,6 @@
#include "BsxCart.h"
#include "BsxMemoryPack.h"
#include "FirmwareHelper.h"
#include "SpcFileData.h"
#include "SuperGameboy.h"
#include "Gameboy.h"
#include "../Utilities/HexUtilities.h"
@ -87,16 +86,7 @@ shared_ptr<BaseCartridge> BaseCartridge::CreateCartridge(Console* console, Virtu
memcpy(cart->_prgRom, romData.data(), romData.size());
}
if(memcmp(cart->_prgRom, "SNES-SPC700 Sound File Data", 27) == 0) {
if(cart->_prgRomSize >= 0x10200) {
//SPC files must be 0x10200 bytes long at minimum
cart->LoadSpc();
} else {
return nullptr;
}
} else {
cart->LoadRom();
}
cart->LoadRom();
return cart;
} else {
@ -623,7 +613,6 @@ void BaseCartridge::ApplyConfigOverrides()
void BaseCartridge::LoadSpc()
{
_spcData.reset(new SpcFileData(_prgRom));
SetupCpuHalt();
}
@ -869,8 +858,3 @@ vector<unique_ptr<IMemoryHandler>>& BaseCartridge::GetSaveRamHandlers()
{
return _saveRamHandlers;
}
SpcFileData* BaseCartridge::GetSpcData()
{
return _spcData.get();
}

View File

@ -56,7 +56,6 @@ private:
uint32_t _saveRamSize = 0;
uint32_t _coprocessorRamSize = 0;
shared_ptr<SpcFileData> _spcData;
vector<uint8_t> _embeddedFirmware;
void LoadBattery();
@ -130,7 +129,5 @@ public:
vector<unique_ptr<IMemoryHandler>>& GetPrgRomHandlers();
vector<unique_ptr<IMemoryHandler>>& GetSaveRamHandlers();
SpcFileData* GetSpcData();
void Serialize(Serializer &s) override;
};

View File

@ -34,7 +34,6 @@
#include "CheatManager.h"
#include "MovieManager.h"
#include "SystemActionManager.h"
#include "SpcHud.h"
#include "Msu1.h"
#include "../Utilities/Serializer.h"
#include "../Utilities/Timer.h"
@ -220,13 +219,6 @@ void Console::Reset()
_notificationManager->SendNotification(ConsoleNotificationType::GameReset);
ProcessEvent(EventType::Reset);
if(_cart->GetSpcData()) {
_spc->LoadSpcFile(_cart->GetSpcData());
_spcHud.reset(new SpcHud(this, _cart->GetSpcData()));
} else {
_spcHud.reset();
}
if(debugger) {
//Debugger was suspended in SystemActionManager::Reset(), resume debugger here
debugger->SuspendDebugger(true);
@ -298,13 +290,6 @@ bool Console::LoadRom(VirtualFile romFile, VirtualFile patchFile, bool stopRom,
_msu1.reset(Msu1::Init(romFile, _spc.get()));
if(_cart->GetSpcData()) {
_spc->LoadSpcFile(_cart->GetSpcData());
_spcHud.reset(new SpcHud(this, _cart->GetSpcData()));
} else {
_spcHud.reset();
}
_cpu.reset(new Cpu(this));
_memoryManager->Initialize(this);
_internalRegisters->Initialize(this);
@ -776,10 +761,6 @@ void Console::ProcessInterrupt(uint32_t originalPc, uint32_t currentPc, bool for
void Console::ProcessEvent(EventType type)
{
if(type == EventType::EndFrame && _spcHud) {
_spcHud->Draw(GetFrameCount());
}
if(_debugger) {
_debugger->ProcessEvent(type);
}

View File

@ -68,7 +68,6 @@ private:
shared_ptr<RewindManager> _rewindManager;
shared_ptr<CheatManager> _cheatManager;
shared_ptr<MovieManager> _movieManager;
shared_ptr<SpcHud> _spcHud;
atomic<uint32_t> _lockCounter;
SimpleLock _runLock;

View File

@ -5,7 +5,6 @@
#include "EmuSettings.h"
#include "MemoryDumper.h"
#include "CpuDisUtils.h"
#include "SpcDisUtils.h"
#include "GsuDisUtils.h"
#include "NecDspDisUtils.h"
#include "Cx4DisUtils.h"
@ -73,7 +72,7 @@ void DisassemblyInfo::GetDisassembly(string &out, uint32_t memoryAddr, LabelMana
CpuDisUtils::GetDisassembly(*this, out, memoryAddr, labelManager, settings);
break;
case CpuType::Spc: SpcDisUtils::GetDisassembly(*this, out, memoryAddr, labelManager, settings); break;
case CpuType::Spc: break;
case CpuType::NecDsp: NecDspDisUtils::GetDisassembly(*this, out, memoryAddr, labelManager, settings); break;
case CpuType::Gsu: GsuDisUtils::GetDisassembly(*this, out, memoryAddr, labelManager, settings); break;
case CpuType::Cx4: Cx4DisUtils::GetDisassembly(*this, out, memoryAddr, labelManager, settings); break;
@ -88,7 +87,7 @@ int32_t DisassemblyInfo::GetEffectiveAddress(Console *console, void *cpuState, C
case CpuType::Cpu:
return CpuDisUtils::GetEffectiveAddress(*this, console, *(CpuState*)cpuState, cpuType);
case CpuType::Spc: return SpcDisUtils::GetEffectiveAddress(*this, console, *(SpcState*)cpuState);
case CpuType::Spc: break;
case CpuType::Gsu: return GsuDisUtils::GetEffectiveAddress(*this, console, *(GsuState*)cpuState);
case CpuType::Cx4:
@ -149,7 +148,7 @@ uint8_t DisassemblyInfo::GetOpSize(uint8_t opCode, uint8_t flags, CpuType type)
case CpuType::Cpu:
return CpuDisUtils::GetOpSize(opCode, flags);
case CpuType::Spc: return SpcDisUtils::GetOpSize(opCode);
case CpuType::Spc: break;
case CpuType::Gsu:
if(opCode >= 0x05 && opCode <= 0x0F) {

View File

@ -4,7 +4,6 @@
#include "KeyManager.h"
#include "MessageManager.h"
#include "Console.h"
#include "SpcDisUtils.h"
#include "NotificationManager.h"
#include "../Utilities/FolderUtilities.h"

View File

@ -4,7 +4,6 @@
#include "MemoryManager.h"
#include "SoundMixer.h"
#include "EmuSettings.h"
#include "SpcFileData.h"
#ifndef DUMMYSPC
#include "SPC_DSP.h"
#else
@ -550,36 +549,3 @@ uint16_t Spc::GetDirectAddress(uint8_t offset)
{
return (CheckFlag(SpcFlags::DirectPage) ? 0x100 : 0) + offset;
}
void Spc::LoadSpcFile(SpcFileData* data)
{
memcpy(_ram, data->SpcRam, Spc::SpcRamSize);
_dsp->load(data->DspRegs);
_state.PC = data->PC;
_state.A = data->A;
_state.X = data->X;
_state.Y = data->Y;
_state.PS = data->PS;
_state.SP = data->SP;
Write(0xF1, data->ControlReg);
_state.DspReg = data->DspRegSelect;
_state.CpuRegs[0] = data->CpuRegs[0];
_state.CpuRegs[1] = data->CpuRegs[1];
_state.CpuRegs[2] = data->CpuRegs[2];
_state.CpuRegs[3] = data->CpuRegs[3];
_state.RamReg[0] = data->RamRegs[0];
_state.RamReg[1] = data->RamRegs[1];
_state.Timer0.SetTarget(data->TimerTarget[0]);
_state.Timer1.SetTarget(data->TimerTarget[1]);
_state.Timer2.SetTarget(data->TimerTarget[2]);
_state.Timer0.SetOutput(data->TimerOutput[0]);
_state.Timer1.SetOutput(data->TimerOutput[0]);
_state.Timer2.SetOutput(data->TimerOutput[0]);
}

View File

@ -13,7 +13,6 @@
class Console;
class MemoryManager;
class SpcFileData;
class SPC_DSP;
struct AddressInfo;
@ -313,8 +312,6 @@ public:
uint8_t* GetSpcRam();
uint8_t* GetSpcRom();
void LoadSpcFile(SpcFileData* spcData);
void Serialize(Serializer &s) override;
#ifdef DUMMYSPC
@ -345,4 +342,4 @@ public:
#endif
};
#endif
#endif

View File

@ -1,155 +0,0 @@
#include "stdafx.h"
#include "SpcDisUtils.h"
#include "Console.h"
#include "DummySpc.h"
#include "DisassemblyInfo.h"
#include "EmuSettings.h"
#include "LabelManager.h"
#include "../Utilities/FastString.h"
#include "../Utilities/HexUtilities.h"
constexpr const char* _altOpTemplate[256] = {
"NOP", "TCALL 0", "SET1 d.0", "BBS d.0,q", "OR A,d", "OR A,!a", "OR A,(X)", "OR A,[d+X]", "OR A,#i", "OR t,s", "OR1 C,m.b", "ASL d", "ASL !a", "PUSH PSW", "TSET1 !a", "BRK",
"BPL r", "TCALL 1", "CLR1 d.0", "BBC d.0,q", "OR A,d+X", "OR A,!a+X", "OR A,!a+Y", "OR A,[d]+Y", "OR e,#i", "OR (X),(Y)", "DECW d", "ASL d+X", "ASL A", "DEC X", "CMP X,!a", "JMP [!a+X]",
"CLRP", "TCALL 2", "SET1 d.1", "BBS d.1,q", "AND A,d", "AND A,!a", "AND A,(X)", "AND A,[d+X]", "AND A,#i", "AND t,s", "OR1 C,/m.b", "ROL d", "ROL !a", "PUSH A", "CBNE d,q", "BRA r",
"BMI r", "TCALL 3", "CLR1 d.1", "BBC d.1,q", "AND A,d+X", "AND A,!a+X", "AND A,!a+Y", "AND A,[d]+Y", "AND e,#i", "AND (X),(Y)", "INCW d", "ROL d+X", "ROL A", "INC X", "CMP X,d", "CALL !a",
"SETP", "TCALL 4", "SET1 d.2", "BBS d.2,q", "EOR A,d", "EOR A,!a", "EOR A,(X)", "EOR A,[d+X]", "EOR A,#i", "EOR t,s", "AND1 C,m.b", "LSR d", "LSR !a", "PUSH X", "TCLR1 !a", "PCALL u",
"BVC r", "TCALL 5", "CLR1 d.2", "BBC d.2,q", "EOR A,d+X", "EOR A,!a+X", "EOR A,!a+Y", "EOR A,[d]+Y", "EOR e,#i", "EOR (X),(Y)", "CMPW YA,d", "LSR d+X", "LSR A", "MOV X,A", "CMP Y,!a", "JMP !a",
"CLRC", "TCALL 6", "SET1 d.3", "BBS d.3,q", "CMP A,d", "CMP A,!a", "CMP A,(X)", "CMP A,[d+X]", "CMP A,#i", "CMP t,s", "AND1 C,/m.b", "ROR d", "ROR !a", "PUSH Y", "DBNZ d,q", "RET",
"BVS r", "TCALL 7", "CLR1 d.3", "BBC d.3,q", "CMP A,d+X", "CMP A,!a+X", "CMP A,!a+Y", "CMP A,[d]+Y", "CMP e,#i", "CMP (X),(Y)", "ADDW YA,d", "ROR d+X", "ROR A", "MOV A,X", "CMP Y,d", "RET1",
"SETC", "TCALL 8", "SET1 d.4", "BBS d.4,q", "ADC A,d", "ADC A,!a", "ADC A,(X)", "ADC A,[d+X]", "ADC A,#i", "ADC t,s", "EOR1 C,m.b", "DEC d", "DEC !a", "MOV Y,#i", "POP PSW", "MOV e,#i",
"BCC r", "TCALL 9", "CLR1 d.4", "BBC d.4,q", "ADC A,d+X", "ADC A,!a+X", "ADC A,!a+Y", "ADC A,[d]+Y", "ADC e,#i", "ADC (X),(Y)", "SUBW YA,d", "DEC d+X", "DEC A", "MOV X,SP", "DIV YA,X", "XCN A",
"EI", "TCALL 10", "SET1 d.5", "BBS d.5,q", "SBC A,d", "SBC A,!a", "SBC A,(X)", "SBC A,[d+X]", "SBC A,#i", "SBC t,s", "MOV1 C,m.b", "INC d", "INC !a", "CMP Y,#i", "POP A", "MOV (X)+,A",
"BCS r", "TCALL 11", "CLR1 d.5", "BBC d.5,q", "SBC A,d+X", "SBC A,!a+X", "SBC A,!a+Y", "SBC A,[d]+Y", "SBC e,#i", "SBC (X),(Y)", "MOVW YA,d", "INC d+X", "INC A", "MOV SP,X", "DAS A", "MOV A,(X)+",
"DI", "TCALL 12", "SET1 d.6", "BBS d.6,q", "MOV d,A", "MOV !a,A", "MOV (X),A", "MOV [d+X],A", "CMP X,#i", "MOV !a,X", "MOV1 m.b,C", "MOV d,Y", "MOV !a,Y", "MOV X,#i", "POP X", "MUL YA",
"BNE r", "TCALL 13", "CLR1 d.6", "BBC d.6,q", "MOV d+X,A", "MOV !a+X,A", "MOV !a+Y,A", "MOV [d]+Y,A", "MOV e,X", "MOV d+Y,X", "MOVW d,YA", "MOV d+X,Y", "DEC Y", "MOV A,Y", "CBNE d+X,q", "DAA A",
"CLRV", "TCALL 14", "SET1 d.7", "BBS d.7,q", "MOV A,d", "MOV A,!a", "MOV A,(X)", "MOV A,[d+X]", "MOV A,#i", "MOV X,!a", "NOT1 m.b", "MOV Y,d", "MOV Y,!a", "NOTC", "POP Y", "SLEEP",
"BEQ r", "TCALL 15", "CLR1 d.7", "BBC d.7,q", "MOV A,d+X", "MOV A,!a+X", "MOV A,!a+Y", "MOV A,[d]+Y", "MOV X,d", "MOV X,d+Y", "MOV t,s", "MOV Y,d+X", "INC Y", "MOV Y,A", "DBNZ Y,q", "STOP"
};
constexpr const char* _opTemplate[256] = {
"NOP", "JST0", "SET1 d.0", "BBS d.0,q", "ORA d", "ORA a", "ORA (X)", "ORA [d,X]", "ORA #i", "OR t,s", "ORC m.b", "ASL d", "ASL a", "PHP", "SET1 a", "BRK",
"BPL r", "JST1", "CLR1 d.0", "BBC d.0,q", "ORA d,X", "ORA a,X", "ORA a,Y", "ORA [d],Y", "OR e,#i", "OR (X),(Y)", "DEW d", "ASL d,X", "ASL A", "DEX", "CPX a", "JMP [a,X]",
"CLP", "JST2", "SET1 d.1", "BBS d.1,q", "AND d", "AND a", "AND (X)", "AND [d,X]", "AND #i", "AND t,s", "ORC /m.b", "ROL d", "ROL a", "PHA", "CBNE d,q", "BRA r",
"BMI r", "JST3", "CLR1 d.1", "BBC d.1,q", "AND d,X", "AND a,X", "AND a,Y", "AND [d],Y", "AND e,#i", "AND (X),(Y)", "INW d", "ROL d,X", "ROL A", "INX", "CPX d", "JSR a",
"SEP", "JST4", "SET1 d.2", "BBS d.2,q", "EOR d", "EOR a", "EOR (X)", "EOR [d,X]", "EOR #i", "EOR t,s", "ANDC m.b", "LSR d", "LSR a", "PHX", "CLR1 a", "JSP u",
"BVC r", "JST5", "CLR1 d.2", "BBC d.2,q", "EOR d,X", "EOR a,X", "EOR a,Y", "EOR [d],Y", "EOR e,#i", "EOR (X),(Y)", "CPW d", "LSR d,X", "LSR A", "TAX", "CPY a", "JMP a",
"CLC", "JST6", "SET1 d.3", "BBS d.3,q", "CMP d", "CMP a", "CMP (X)", "CMP [d,X]", "CMP #i", "CMP t,s", "ANDC /m.b", "ROR d", "ROR a", "PHY", "DBNZ d,q", "RTS",
"BVS r", "JST7", "CLR1 d.3", "BBC d.3,q", "CMP d,X", "CMP a,X", "CMP a,Y", "CMP [d],Y", "CMP e,#i", "CMP (X),(Y)", "ADW d", "ROR d,X", "ROR A", "TXA", "CPY d", "RTI",
"SEC", "JST8", "SET1 d.4", "BBS d.4,q", "ADC d", "ADC a", "ADC (X)", "ADC [d,X]", "ADC #i", "ADC t,s", "EORC m.b", "DEC d", "DEC a", "LDY #i","PLP", "MOV e,#i",
"BCC r", "JST9", "CLR1 d.4", "BBC d.4,q", "ADC d,X", "ADC a,X", "ADC a,Y", "ADC [d],Y", "ADC e,#i", "ADC (X),(Y)", "SBW d", "DEC d,X", "DEC A", "TSX", "DIV YA,X", "XCN A",
"CLI", "JSTA", "SET1 d.5", "BBS d.5,q", "SBC d", "SBC a", "SBC (X)", "SBC [d,X]", "SBC #i", "SBC t,s", "LDC m.b", "INC d", "INC a", "CMY #i","PLA", "STA (X)+,A",
"BCS r", "JSTB", "CLR1 d.5", "BBC d.5,q", "SBC d,X", "SBC a,X", "SBC a,Y", "SBC [d],Y", "SBC e,#i", "SBC (X),(Y)", "LDW d", "INC d,X", "INC A", "TXS", "DAS A", "LDA (X)+",
"SEI", "JSTC", "SET1 d.6", "BBS d.6,q", "STA d", "STA a", "STA (X)", "STA [d,X]", "CPX #i", "STX a", "STC m.b", "STY d", "STY a", "LDX #i","PLX", "MUL YA",
"BNE r", "JSTD", "CLR1 d.6", "BBC d.6,q", "STA d,X", "STA a,X", "STA a,Y", "STA [d],Y", "STX d", "STX d,Y", "STW d", "STY d,X", "DEY", "TYA", "CBNE d,X, q", "DAA A",
"CLV", "JSTE", "SET1 d.7", "BBS d.7,q", "LDA d", "LDA a", "LDA (X)", "LDA [d,X]", "LDA #i", "LDX a", "NOT m.b", "LDY d", "LDY a", "NOTC", "PLY", "WAI",
"BEQ r", "JSTF", "CLR1 d.7", "BBC d.7,q", "LDA d,X", "LDA a,X", "LDA a,Y", "LDA [d],Y", "LDX d", "LDX d,Y", "MOV t,s", "LDY d,X", "INC Y", "TAY", "DBNZ Y,r", "STP"
};
constexpr const uint8_t _opSize[256] = {
1, 1, 2, 3, 2, 3, 1, 2, 2, 3, 3, 2, 3, 1, 3, 1,
2, 1, 2, 3, 2, 3, 3, 2, 3, 1, 2, 2, 1, 1, 3, 3,
1, 1, 2, 3, 2, 3, 1, 2, 2, 3, 3, 2, 3, 1, 3, 2,
2, 1, 2, 3, 2, 3, 3, 2, 3, 1, 2, 2, 1, 1, 2, 3,
1, 1, 2, 3, 2, 3, 1, 2, 2, 3, 3, 2, 3, 1, 3, 2,
2, 1, 2, 3, 2, 3, 3, 2, 3, 1, 2, 2, 1, 1, 3, 3,
1, 1, 2, 3, 2, 3, 1, 2, 2, 3, 3, 2, 3, 1, 3, 1,
2, 1, 2, 3, 2, 3, 3, 2, 3, 1, 2, 2, 1, 1, 2, 1,
1, 1, 2, 3, 2, 3, 1, 2, 2, 3, 3, 2, 3, 2, 1, 3,
2, 1, 2, 3, 2, 3, 3, 2, 3, 1, 2, 2, 1, 1, 1, 1,
1, 1, 2, 3, 2, 3, 1, 2, 2, 3, 3, 2, 3, 2, 1, 1,
2, 1, 2, 3, 2, 3, 3, 2, 3, 1, 2, 2, 1, 1, 1, 1,
1, 1, 2, 3, 2, 3, 1, 2, 2, 3, 3, 2, 3, 2, 1, 1,
2, 1, 2, 3, 2, 3, 3, 2, 2, 2, 2, 2, 1, 1, 3, 1,
1, 1, 2, 3, 2, 3, 1, 2, 2, 3, 3, 2, 3, 1, 1, 1,
2, 1, 2, 3, 2, 3, 3, 2, 2, 2, 3, 2, 1, 1, 2, 1,
};
constexpr bool _needAddress[256] = {
false, true, true, true, true, false, true, true, false, false, false, true, false, false, false, false,
false, true, true, true, true, true, true, true, true, false, true, true, false, false, false, true,
false, true, true, true, true, false, true, true, false, false, false, true, false, false, true, false,
false, true, true, true, true, true, true, true, true, false, true, true, false, false, true, false,
false, true, true, true, true, false, true, true, false, false, false, true, false, false, false, false,
false, true, true, true, true, true, true, true, true, false, true, true, false, false, false, false,
false, true, true, true, true, false, true, true, false, false, false, true, false, false, true, false,
false, true, true, true, true, true, true, true, true, false, true, true, false, false, true, false,
false, true, true, true, true, false, true, true, false, false, false, true, false, false, false, true,
false, true, true, true, true, true, true, true, true, false, true, true, false, false, false, false,
false, true, true, true, true, false, true, true, false, false, false, true, false, false, false, true,
false, true, true, true, true, true, true, true, true, false, true, true, false, false, false, true,
false, true, true, true, true, false, true, true, false, false, false, true, false, false, false, false,
false, true, true, true, true, true, true, true, true, true, true, true, false, false, true, false,
false, true, true, true, true, false, true, true, false, false, false, true, false, false, false, false,
false, true, true, true, true, true, true, true, true, true, false, true, false, false, false, false
};
void SpcDisUtils::GetDisassembly(DisassemblyInfo &info, string &out, uint32_t memoryAddr, LabelManager* labelManager, EmuSettings* settings)
{
FastString str(settings->CheckDebuggerFlag(DebuggerFlags::UseLowerCaseDisassembly));
AddressInfo addrInfo { 0, SnesMemoryType::SpcMemory };
auto getOperand = [&str, &addrInfo, labelManager](uint16_t addr) {
addrInfo.Address = addr;
string label = labelManager ? labelManager->GetLabel(addrInfo) : "";
if(label.empty()) {
str.WriteAll('$', HexUtilities::ToHex(addr));
} else {
str.Write(label, true);
}
};
uint8_t* byteCode = info.GetByteCode();
const char* op = settings->CheckDebuggerFlag(DebuggerFlags::UseAltSpcOpNames) ? _altOpTemplate[byteCode[0]] : _opTemplate[byteCode[0]];
int i = 0;
while(op[i]) {
switch(op[i]) {
case 'r': getOperand((uint16_t)(memoryAddr + (int8_t)byteCode[1] + GetOpSize(byteCode[0]))); break;
case 'q': getOperand((uint16_t)(memoryAddr + (int8_t)byteCode[2] + GetOpSize(byteCode[0]))); break; //relative 2nd byte
case 'a': getOperand((uint16_t)(byteCode[1] | (byteCode[2] << 8))); break;
case 'd': str.WriteAll('$', HexUtilities::ToHex(byteCode[1])); break;
case 'e': str.WriteAll('$', HexUtilities::ToHex(byteCode[2])); break; //direct 2nd byte
case 's': str.WriteAll('$', HexUtilities::ToHex(byteCode[1])); break;
case 't': str.WriteAll('$', HexUtilities::ToHex(byteCode[2])); break;
case 'i': str.WriteAll('$', HexUtilities::ToHex(byteCode[1])); break;
case 'm': getOperand((uint16_t)((byteCode[1] | (byteCode[2] << 8)) & 0x1FFF)); break;
case 'b': str.WriteAll((char)('0' + (byteCode[2] >> 5))); break;
default: str.Write(op[i]); break;
}
i++;
}
out += str.ToString();
}
int32_t SpcDisUtils::GetEffectiveAddress(DisassemblyInfo &info, Console *console, SpcState &state)
{
if(_needAddress[info.GetOpCode()]) {
Spc* spc = console->GetSpc().get();
DummySpc dummySpc(spc->GetSpcRam(), state);
dummySpc.Step();
uint32_t addr;
uint8_t value;
uint32_t writeCount = dummySpc.GetWriteCount();
if(writeCount > 0) {
dummySpc.GetWriteInfo(writeCount - 1, addr, value);
} else {
uint32_t readCount = dummySpc.GetReadCount();
dummySpc.GetReadInfo(readCount - 1, addr, value);
}
return addr;
}
return -1;
}
uint8_t SpcDisUtils::GetOpSize(uint8_t opCode)
{
return _opSize[opCode];
}

View File

@ -1,16 +0,0 @@
#pragma once
#include "stdafx.h"
class DisassemblyInfo;
class Console;
class LabelManager;
class EmuSettings;
struct SpcState;
class SpcDisUtils
{
public:
static void GetDisassembly(DisassemblyInfo &info, string &out, uint32_t memoryAddr, LabelManager* labelManager, EmuSettings* settings);
static int32_t GetEffectiveAddress(DisassemblyInfo &info, Console *console, SpcState &state);
static uint8_t GetOpSize(uint8_t opCode);
};

View File

@ -1,69 +0,0 @@
#pragma once
#include "stdafx.h"
class SpcFileData
{
public:
string SongTitle;
string GameTitle;
string Dumper;
string Artist;
string Comment;
uint16_t PC;
uint8_t A;
uint8_t X;
uint8_t Y;
uint8_t PS;
uint8_t SP;
uint8_t CpuRegs[4];
uint8_t ControlReg;
uint8_t RamRegs[2];
uint8_t TimerOutput[3];
uint8_t TimerTarget[3];
uint8_t DspRegSelect;
uint8_t DspRegs[128];
uint8_t SpcRam[0x10000];
SpcFileData(uint8_t* spcData)
{
SongTitle = string(spcData + 0x2E, spcData + 0x2E + 0x20);
GameTitle = string(spcData + 0x4E, spcData + 0x4E + 0x20);
Dumper = string(spcData + 0x6E, spcData + 0x6E + 0x10);
Artist = string(spcData + 0xB1, spcData + 0xB1 + 0x20);
Comment = string(spcData + 0x7E, spcData + 0x7E + 0x20);
memcpy(SpcRam, spcData + 0x100, 0xFFC0);
memcpy(SpcRam + 0xFFC0, spcData + 0x101C0, 0x40);
memcpy(DspRegs, spcData + 0x10100, 128);
PC = spcData[0x25] | (spcData[0x26] << 8);
A = spcData[0x27];
X = spcData[0x28];
Y = spcData[0x29];
PS = spcData[0x2A];
SP = spcData[0x2B];
ControlReg = spcData[0x100 + 0xF1];
DspRegSelect = spcData[0x100 + 0xF2];
CpuRegs[0] = spcData[0x100 + 0xF4];
CpuRegs[1] = spcData[0x100 + 0xF5];
CpuRegs[2] = spcData[0x100 + 0xF6];
CpuRegs[3] = spcData[0x100 + 0xF7];
RamRegs[0] = spcData[0x100 + 0xF8];
RamRegs[1] = spcData[0x100 + 0xF9];
TimerTarget[0] = spcData[0x100 + 0xFA];
TimerTarget[1] = spcData[0x100 + 0xFB];
TimerTarget[2] = spcData[0x100 + 0xFC];
TimerOutput[0] = spcData[0x100 + 0xFD];
TimerOutput[1] = spcData[0x100 + 0xFE];
TimerOutput[2] = spcData[0x100 + 0xFF];
}
};

View File

@ -1,36 +0,0 @@
#include "stdafx.h"
#include "SpcHud.h"
#include "Console.h"
#include "SoundMixer.h"
#include "DebugHud.h"
#include "SpcFileData.h"
SpcHud::SpcHud(Console * console, SpcFileData* spcData)
{
_mixer = console->GetSoundMixer().get();
_hud = console->GetDebugHud().get();
_spcData = spcData;
}
void SpcHud::Draw(uint32_t frame)
{
_hud->DrawString(20, 20, "Game:", 0xBBBBBB, 0, 1, frame);
_hud->DrawString(20, 30, "Track:", 0xBBBBBB, 0, 1, frame);
_hud->DrawString(20, 40, "Artist:", 0xBBBBBB, 0, 1, frame);
_hud->DrawString(20, 50, "Comment:", 0xBBBBBB, 0, 1, frame);
_hud->DrawString(70, 20, _spcData->GameTitle, 0xFFFFFF, 0, 1, frame);
_hud->DrawString(70, 30, _spcData->SongTitle, 0xFFFFFF, 0, 1, frame);
_hud->DrawString(70, 40, _spcData->Artist, 0xFFFFFF, 0, 1, frame);
_hud->DrawString(70, 50, _spcData->Comment, 0xFFFFFF, 0, 1, frame);
int16_t left, right;
_mixer->GetLastSamples(left, right);
_volumesL[_volPosition] = left / 128;
_volumesR[_volPosition] = right / 128;
_volPosition = (_volPosition + 1) & 0x7F;
for(int i = 1; i < 128; i++) {
_hud->DrawLine((i - 1)*2, 160 + _volumesL[(_volPosition + i - 1) & 0x7F], i*2, 160 + _volumesL[(_volPosition + i) & 0x7F], 0x30FFAAAA, 1, frame);
_hud->DrawLine((i - 1)*2, 160 + _volumesR[(_volPosition + i - 1) & 0x7F], i*2, 160 + _volumesR[(_volPosition + i) & 0x7F], 0x30AAAAFF, 1, frame);
}
}

View File

@ -1,25 +0,0 @@
#pragma once
#include "stdafx.h"
class Console;
class SoundMixer;
class DebugHud;
class SpcFileData;
class SpcHud
{
private:
DebugHud* _hud;
SoundMixer* _mixer;
int8_t _volumesL[128] = {};
int8_t _volumesR[128] = {};
uint8_t _volPosition = 0;
SpcFileData* _spcData;
public:
SpcHud(Console* console, SpcFileData* spcData);
void Draw(uint32_t frame);
};

View File

@ -121,8 +121,6 @@ SOURCES_CXX := $(LIBRETRO_DIR)/libretro.cpp \
$(CORE_DIR)/Spc.cpp \
$(CORE_DIR)/Spc.Instructions.cpp \
$(CORE_DIR)/SpcDebugger.cpp \
$(CORE_DIR)/SpcDisUtils.cpp \
$(CORE_DIR)/SpcHud.cpp \
$(CORE_DIR)/SPC_DSP.cpp \
$(CORE_DIR)/SPC_Filter.cpp \
$(CORE_DIR)/Spc7110.cpp \