From cea74d2d000db156811cdc533c198f20a4c0be33 Mon Sep 17 00:00:00 2001 From: org Date: Mon, 13 Nov 2023 19:37:44 +0300 Subject: [PATCH] Moved FastAPU in private zone --- Chips/FastAPU/FastAPU.vcxproj | 192 ---------------- Chips/FastAPU/FastAPU.vcxproj.filters | 108 --------- Chips/FastAPU/Readme.md | 11 - Chips/FastAPU/apu.cpp | 157 ------------- Chips/FastAPU/apu.h | 303 -------------------------- Chips/FastAPU/clkgen.cpp | 61 ------ Chips/FastAPU/clkgen.h | 49 ----- Chips/FastAPU/core.cpp | 60 ----- Chips/FastAPU/core.h | 23 -- Chips/FastAPU/dac.cpp | 247 --------------------- Chips/FastAPU/dac.h | 41 ---- Chips/FastAPU/dma.cpp | 41 ---- Chips/FastAPU/dma.h | 43 ---- Chips/FastAPU/dpcm.cpp | 116 ---------- Chips/FastAPU/dpcm.h | 101 --------- Chips/FastAPU/env.cpp | 27 --- Chips/FastAPU/env.h | 30 --- Chips/FastAPU/length.cpp | 41 ---- Chips/FastAPU/length.h | 36 --- Chips/FastAPU/noise.cpp | 56 ----- Chips/FastAPU/noise.h | 39 ---- Chips/FastAPU/pads.cpp | 41 ---- Chips/FastAPU/pads.h | 33 --- Chips/FastAPU/pch.cpp | 1 - Chips/FastAPU/pch.h | 10 - Chips/FastAPU/regs.cpp | 46 ---- Chips/FastAPU/regs.h | 28 --- Chips/FastAPU/square.cpp | 65 ------ Chips/FastAPU/square.h | 75 ------- Chips/FastAPU/triangle.cpp | 56 ----- Chips/FastAPU/triangle.h | 44 ---- Chips/private/Readme.md | 3 + Tools/ApuPumpkin/ApuPumpkin.sln | 10 - Tools/ApuPumpkin/ApuPumpkin.vcxproj | 3 - Tools/ApuPumpkin/pch.h | 2 +- 35 files changed, 4 insertions(+), 2195 deletions(-) delete mode 100644 Chips/FastAPU/FastAPU.vcxproj delete mode 100644 Chips/FastAPU/FastAPU.vcxproj.filters delete mode 100644 Chips/FastAPU/Readme.md delete mode 100644 Chips/FastAPU/apu.cpp delete mode 100644 Chips/FastAPU/apu.h delete mode 100644 Chips/FastAPU/clkgen.cpp delete mode 100644 Chips/FastAPU/clkgen.h delete mode 100644 Chips/FastAPU/core.cpp delete mode 100644 Chips/FastAPU/core.h delete mode 100644 Chips/FastAPU/dac.cpp delete mode 100644 Chips/FastAPU/dac.h delete mode 100644 Chips/FastAPU/dma.cpp delete mode 100644 Chips/FastAPU/dma.h delete mode 100644 Chips/FastAPU/dpcm.cpp delete mode 100644 Chips/FastAPU/dpcm.h delete mode 100644 Chips/FastAPU/env.cpp delete mode 100644 Chips/FastAPU/env.h delete mode 100644 Chips/FastAPU/length.cpp delete mode 100644 Chips/FastAPU/length.h delete mode 100644 Chips/FastAPU/noise.cpp delete mode 100644 Chips/FastAPU/noise.h delete mode 100644 Chips/FastAPU/pads.cpp delete mode 100644 Chips/FastAPU/pads.h delete mode 100644 Chips/FastAPU/pch.cpp delete mode 100644 Chips/FastAPU/pch.h delete mode 100644 Chips/FastAPU/regs.cpp delete mode 100644 Chips/FastAPU/regs.h delete mode 100644 Chips/FastAPU/square.cpp delete mode 100644 Chips/FastAPU/square.h delete mode 100644 Chips/FastAPU/triangle.cpp delete mode 100644 Chips/FastAPU/triangle.h create mode 100644 Chips/private/Readme.md diff --git a/Chips/FastAPU/FastAPU.vcxproj b/Chips/FastAPU/FastAPU.vcxproj deleted file mode 100644 index 144bf6f2..00000000 --- a/Chips/FastAPU/FastAPU.vcxproj +++ /dev/null @@ -1,192 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 16.0 - Win32Proj - {2c9982f5-51f1-4bda-b331-c88690cc3bee} - FastAPU - 10.0 - - - - StaticLibrary - true - v143 - Unicode - - - StaticLibrary - false - v143 - true - Unicode - - - StaticLibrary - true - v143 - Unicode - - - StaticLibrary - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - Level3 - true - WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - true - Use - pch.h - MultiThreadedDebug - - - - - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - true - Use - pch.h - MultiThreaded - AnySuitable - Speed - - - - - true - true - true - - - - - Level3 - true - _DEBUG;_LIB;%(PreprocessorDefinitions) - true - Use - pch.h - MultiThreadedDebug - - - - - true - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions) - true - Use - pch.h - MultiThreaded - AnySuitable - Speed - - - - - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - Create - Create - Create - - - - - - - - - - - - \ No newline at end of file diff --git a/Chips/FastAPU/FastAPU.vcxproj.filters b/Chips/FastAPU/FastAPU.vcxproj.filters deleted file mode 100644 index 26e29d6f..00000000 --- a/Chips/FastAPU/FastAPU.vcxproj.filters +++ /dev/null @@ -1,108 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - - \ No newline at end of file diff --git a/Chips/FastAPU/Readme.md b/Chips/FastAPU/Readme.md deleted file mode 100644 index 30a76e41..00000000 --- a/Chips/FastAPU/Readme.md +++ /dev/null @@ -1,11 +0,0 @@ -# FastAPU - -A priori fast version of APUSim, so as not to confuse code with "fast" branches. - -- BaseLogicLib is not used (regular C logical operators are used) -- All vectorized signals, buses and modules (e.g. counters) are packed into multi-bit variables -- No debugging yet - -Otherwise, the code structure is the same as in APUSim, so don't get lost. - -WIP. diff --git a/Chips/FastAPU/apu.cpp b/Chips/FastAPU/apu.cpp deleted file mode 100644 index 5a5e3edd..00000000 --- a/Chips/FastAPU/apu.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include "pch.h" - -namespace FastAPU -{ - FastAPU::FastAPU(M6502Core::M6502* _core, APUSim::Revision _rev) - { - // For ease of integration, the core instance is created by the consumer - core = _core; - rev = _rev; - - core_int = new CoreBinding(this); - clkgen = new CLKGen(this); - lc[0] = new LengthCounter(this); - lc[1] = new LengthCounter(this); - lc[2] = new LengthCounter(this); - lc[3] = new LengthCounter(this); - dpcm = new DpcmChan(this); - noise = new NoiseChan(this); - square[0] = new SquareChan(this, SquareChanCarryIn::Vdd); - square[1] = new SquareChan(this, SquareChanCarryIn::Inc); - tri = new TriangleChan(this); - regs = new RegsDecoder(this); - dma = new DMA(this); - pads = new Pads(this); - dac = new DAC(this); - - wire.RDY2 = 1; - } - - FastAPU::~FastAPU() - { - delete core_int; - delete clkgen; - delete lc[0]; - delete lc[1]; - delete lc[2]; - delete lc[3]; - delete dpcm; - delete noise; - delete square[0]; - delete square[1]; - delete tri; - delete regs; - delete dma; - delete pads; - delete dac; - } - - void FastAPU::sim(BaseLogic::TriState inputs[], BaseLogic::TriState outputs[], uint8_t* data, uint16_t* addr, APUSim::AudioOutSignal& AUX) - { - pads->sim_InputPads(inputs); - pads->sim_DataBusInput(data); - - dpcm->sim(); - - dma->sim(); - dma->sim_DMA_Buffer(); - dma->sim_AddressMux(); - - sim_CoreIntegration(); - - sim_SoundGenerators(); - - pads->sim_OutputPads(outputs, addr); - pads->sim_DataBusOutput(data); - dac->sim(AUX); - } - - void FastAPU::sim_CoreIntegration() - { - // Core & stuff - - core_int->sim(); - clkgen->sim(); - regs->sim(); - regs->sim_DebugRegisters(); - } - - void FastAPU::sim_SoundGenerators() - { - // The audio generator circuits are discrete to PHI (Core clock), there is no point in simulating them every CLK - - if (wire.PHI0 == PrevPHI_SoundGen) { - return; - } - PrevPHI_SoundGen = wire.PHI0; - - // Sound channels - - wire.SQA_LC = square[0]->get_LC(); - wire.SQB_LC = square[1]->get_LC(); - wire.TRI_LC = tri->get_LC(); - wire.RND_LC = noise->get_LC(); - - lc[0]->sim(0, RegOps.W4003, wire.SQA_LC, wire.NOSQA); - lc[1]->sim(1, RegOps.W4007, wire.SQB_LC, wire.NOSQB); - lc[2]->sim(2, RegOps.W400B, wire.TRI_LC, wire.NOTRI); - lc[3]->sim(3, RegOps.W400F, wire.RND_LC, wire.NORND); - - square[0]->sim(RegOps.W4000, RegOps.W4001, RegOps.W4002, RegOps.W4003, wire.NOSQA, &SQA_Out); - square[1]->sim(RegOps.W4004, RegOps.W4005, RegOps.W4006, RegOps.W4007, wire.NOSQB, &SQB_Out); - tri->sim(); - noise->sim(); - } - - void FastAPU::SetRAWOutput(bool enable) - { - dac->SetRAWOutput(enable); - } - - void FastAPU::SetNormalizedOutput(bool enable) - { - dac->SetNormalizedOutput(enable); - } - - size_t FastAPU::GetACLKCounter() - { - return aclk_counter; - } - - void FastAPU::ResetACLKCounter() - { - aclk_counter = 0; - } - - size_t FastAPU::GetPHICounter() - { - return phi_counter; - } - - void FastAPU::ResetPHICounter() - { - phi_counter = 0; - } - - int FastAPU::GetDBBit(size_t n) - { - return (DB & (1 << n)) != 0 ? 1 : 0; - } - - void FastAPU::SetDBBit(size_t n, int bit_val) - { - uint8_t out = DB & ~(1 << n); - out |= (bit_val & 1) << n; - DB = out; - } - - void FastAPU::GetSignalFeatures(APUSim::AudioSignalFeatures& features) - { - size_t clk = 21477272; // Hz - size_t div = 12; - - features.SampleRate = (int32_t)(clk * 2); - - // TBD: Add other APU - } -} diff --git a/Chips/FastAPU/apu.h b/Chips/FastAPU/apu.h deleted file mode 100644 index ffbc61bf..00000000 --- a/Chips/FastAPU/apu.h +++ /dev/null @@ -1,303 +0,0 @@ -#pragma once - -namespace APUSim -{ -#pragma pack(push,1) - - /// - /// A software descriptor of the current audio sample. - /// - union AudioOutSignal - { - struct AnalogOut - { - float a; // Analog output AUX_A in mV - float b; // Analog output AUX_B in mV - } AUX; - - struct NormalizedOut - { - float a; // Analog output AUX_A, normalized to the interval [0.0; 1.0] - float b; // Analog output AUX_B, normalized to the interval [0.0; 1.0] - } normalized; - - /// - /// "Raw" output from the sound generators. - /// - struct RAWOut - { - uint8_t sqa; // Square0 channel digital output 0..15 (4 bit) - uint8_t sqb; // Square1 channel digital output 0..15 (4 bit) - uint8_t tri; // Triangle channel digital output 0..15 (4 bit) - uint8_t rnd; // Noise channel digital output 0..15 (4 bit) - uint8_t dmc; // DeltaMod channel digital output 0..127 (7 bit) - } RAW; - }; - - /// - /// The structure describes all the features of the signal and helps organize its rendering. - /// - struct AudioSignalFeatures - { - int32_t SampleRate; // The sampling frequency of the audio signal (samples per "virtual" second). The audio is actually sampled every PHI (core clock) cycle. - float AUXA_LowLevel; // Lower signal level for AUX_A (mV) - float AUXA_HighLevel; // Upper signal level for AUX_A (mV) - float AUXB_LowLevel; // Lower signal level for AUX_B (mV) - float AUXB_HighLevel; // Upper signal level for AUX_B (mV) - }; - -#pragma pack(pop) - - /// - /// All known revisions of official APUs and compatible clones. - /// - enum class Revision - { - Unknown = 0, - RP2A03G, - RP2A03H, - RP2A07, - UA6527P, - TA03NP1, - Max, - }; - - enum class APU_Input - { - CLK = 0, - n_NMI, - n_IRQ, - n_RES, - DBG, - Max, - }; - - enum class APU_Output - { - n_IN0 = 0, - n_IN1, - OUT_0, - OUT_1, - OUT_2, - M2, - RnW, - Max, - }; -} - -namespace FastAPU -{ - class FastAPU; -} - -#include "clkgen.h" -#include "core.h" -#include "dma.h" -#include "dpcm.h" -#include "length.h" -#include "env.h" -#include "noise.h" -#include "square.h" -#include "triangle.h" -#include "regs.h" -#include "pads.h" -#include "dac.h" - -namespace FastAPU -{ - class FastAPU - { - friend CoreBinding; - friend CLKGen; - friend RegsDecoder; - friend LengthCounter; - friend EnvelopeUnit; - friend DpcmChan; - friend NoiseChan; - friend SquareChan; - friend TriangleChan; - friend DMA; - friend Pads; - friend DAC; - - /// - /// Internal auxiliary and intermediate connections. - /// - struct InternalWires - { - int n_CLK; - int PHI0; - int PHI1; - int PHI2; - int RDY; // To core - int RDY2; // Default 1 (2A03) - int nACLK2; - int ACLK1; - int RES; - int n_M2; - int n_NMI; - int n_IRQ; - int INT; - int n_LFO1; - int n_LFO2; - int RnW; // From core - int SPR_CPU; - int SPR_PPU; - int RW; // To pad - int RD; // To DataBus pads - int WR; // To DataBus pads - int SYNC; // From core - - int n_DMC_AB; - int RUNDMC; - int DMCINT; - int DMCRDY; - - int SQA_LC; - int SQB_LC; - int TRI_LC; - int RND_LC; - int NOSQA; - int NOSQB; - int NOTRI; - int NORND; - - // Auxiliary signals associated with the Test mode, which seems to be present only on 2A03. - int DBG; // from pad - int n_DBGRD; // from regs decoder - int LOCK; - } wire{}; - - union - { - struct - { - unsigned n_R4015 : 1; - unsigned n_R4016 : 1; - unsigned n_R4017 : 1; - unsigned n_R4018 : 1; - unsigned n_R4019 : 1; - unsigned n_R401A : 1; - unsigned W4000 : 1; - unsigned W4001 : 1; - unsigned W4002 : 1; - unsigned W4003 : 1; - unsigned W4004 : 1; - unsigned W4005 : 1; - unsigned W4006 : 1; - unsigned W4007 : 1; - unsigned W4008 : 1; - unsigned W400A : 1; - unsigned W400B : 1; - unsigned W400C : 1; - unsigned W400E : 1; - unsigned W400F : 1; - unsigned W4010 : 1; - unsigned W4011 : 1; - unsigned W4012 : 1; - unsigned W4013 : 1; - unsigned W4014 : 1; - unsigned W4015 : 1; - unsigned W4016 : 1; - unsigned W4017 : 1; - unsigned W401A : 1; - }; - uint32_t raw_bits; - } RegOps{}; - - APUSim::Revision rev = APUSim::Revision::Unknown; - - // Instances of internal APU modules, including the core - - M6502Core::M6502* core = nullptr; - CoreBinding* core_int = nullptr; - CLKGen* clkgen = nullptr; - RegsDecoder* regs = nullptr; - LengthCounter* lc[4]{}; - DpcmChan* dpcm = nullptr; - NoiseChan* noise = nullptr; - SquareChan* square[2]{}; - TriangleChan* tri = nullptr; - DMA* dma = nullptr; - Pads* pads = nullptr; - DAC* dac = nullptr; - - // Internal buses. - - uint8_t DB = 0; - - uint16_t DMC_Addr{}; - uint16_t SPR_Addr{}; - uint16_t CPU_Addr{}; // Core to mux & regs predecoder - uint16_t Ax{}; // Mux to pads & regs decoder - - // DAC Inputs - - uint8_t SQA_Out{}; - uint8_t SQB_Out{}; - uint8_t TRI_Out{}; - uint8_t RND_Out{}; - uint8_t DMC_Out{}; - - int GetDBBit(size_t n); - void SetDBBit(size_t n, int bit_val); - - size_t aclk_counter = 0; - size_t phi_counter = 0; - - int PrevPHI_Core = -1; // to optimize - int PrevPHI_SoundGen = -1; // to optimize - - void sim_CoreIntegration(); - void sim_SoundGenerators(); - - public: - FastAPU(M6502Core::M6502* core, APUSim::Revision rev); - ~FastAPU(); - - /// - /// Simulate one half cycle - /// - void sim(BaseLogic::TriState inputs[], BaseLogic::TriState outputs[], uint8_t* data, uint16_t* addr, APUSim::AudioOutSignal& AUX); - - /// - /// Turn on the digital output, instead of the analog DAC levels. - /// - /// - void SetRAWOutput(bool enable); - - /// - /// Turn on the normalized analog level output from the DAC. - /// - /// - void SetNormalizedOutput(bool enable); - - /// - /// Get the value of the ACLK cycle counter (PHI/2) - /// - /// - size_t GetACLKCounter(); - - /// - /// Reset the ACLK cycle counter - /// - void ResetACLKCounter(); - - /// - /// Get the value of the 6502 core cycle counter. - /// - /// - size_t GetPHICounter(); - - /// - /// Reset the 6502 core cycle counter. - /// - void ResetPHICounter(); - - /// - /// Get the audio signal properties of the current APU revision. - /// - /// - void GetSignalFeatures(APUSim::AudioSignalFeatures& features); - }; -} diff --git a/Chips/FastAPU/clkgen.cpp b/Chips/FastAPU/clkgen.cpp deleted file mode 100644 index a7d79964..00000000 --- a/Chips/FastAPU/clkgen.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// Timing Generator - -#include "pch.h" - -namespace FastAPU -{ - CLKGen::CLKGen(FastAPU* parent) - { - apu = parent; - } - - CLKGen::~CLKGen() - { - } - - void CLKGen::sim() - { - sim_ACLK(); - sim_SoftCLK_Mode(); - sim_SoftCLK_PLA(); - sim_SoftCLK_Control(); - sim_SoftCLK_LFSR(); - } - - int CLKGen::GetINTFF() - { - return int_ff; - } - - void CLKGen::sim_ACLK() - { - - } - - void CLKGen::sim_SoftCLK_Mode() - { - if (apu->RegOps.W4017 && !apu->wire.ACLK1) { - reg_mode = apu->GetDBBit(7); - } - n_mode = !reg_mode; - if (apu->wire.ACLK1) { - md_latch = n_mode; - } - mode = !md_latch; - } - - void CLKGen::sim_SoftCLK_Control() - { - - } - - void CLKGen::sim_SoftCLK_PLA() - { - - } - - void CLKGen::sim_SoftCLK_LFSR() - { - - } -} diff --git a/Chips/FastAPU/clkgen.h b/Chips/FastAPU/clkgen.h deleted file mode 100644 index 6a03a388..00000000 --- a/Chips/FastAPU/clkgen.h +++ /dev/null @@ -1,49 +0,0 @@ -// Timing Generator - -#pragma once - -namespace FastAPU -{ - class CLKGen - { - FastAPU* apu = nullptr; - - int phi1_latch{}; - int phi2_latch{}; - - int shift_in{}; - int F1{}; - int F2{}; - int Z1{}; - int Z2{}; - int mode{}; - int n_mode{}; - int pla[6]{}; - - int z_ff{}; - int z1{}; - int z2{}; - int md_latch{}; - int int_status{}; - int int_ff{}; - - uint16_t lfsr{}; - - int reg_mode{}; - int reg_mask{}; - - void sim_ACLK(); - void sim_SoftCLK_Mode(); - void sim_SoftCLK_Control(); - void sim_SoftCLK_PLA(); - void sim_SoftCLK_LFSR(); - - public: - CLKGen(FastAPU* parent); - ~CLKGen(); - - void sim(); - - int GetINTFF(); - }; -} diff --git a/Chips/FastAPU/core.cpp b/Chips/FastAPU/core.cpp deleted file mode 100644 index ad6a123b..00000000 --- a/Chips/FastAPU/core.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// 6502 Core Binding - -#include "pch.h" - -using namespace BaseLogic; - -namespace FastAPU -{ - CoreBinding::CoreBinding(FastAPU* parent) - { - apu = parent; - } - - CoreBinding::~CoreBinding() - { - } - - void CoreBinding::sim() - { - sim_DividerBeforeCore(); - - // The 6502 core uses TriState from BaseLogicLib, so you have to convert the values - - if (apu->wire.PHI0 != apu->PrevPHI_Core) - { - TriState inputs[(size_t)M6502Core::InputPad::Max]{}; - TriState outputs[(size_t)M6502Core::OutputPad::Max]; - - auto IRQINT = (!apu->wire.n_IRQ || apu->wire.INT); - - inputs[(size_t)M6502Core::InputPad::n_NMI] = apu->wire.n_NMI ? TriState::One : TriState::Zero; - inputs[(size_t)M6502Core::InputPad::n_IRQ] = IRQINT ? TriState::Zero : TriState::One; - inputs[(size_t)M6502Core::InputPad::n_RES] = apu->wire.RES ? TriState::Zero : TriState::One; - inputs[(size_t)M6502Core::InputPad::PHI0] = apu->wire.PHI0 ? TriState::One : TriState::Zero; - inputs[(size_t)M6502Core::InputPad::RDY] = (apu->wire.RDY && apu->wire.RDY2) ? TriState::One : TriState::Zero; - inputs[(size_t)M6502Core::InputPad::SO] = TriState::One; - - apu->core->sim(inputs, outputs, &apu->CPU_Addr, &apu->DB); - - apu->wire.PHI1 = outputs[(size_t)M6502Core::OutputPad::PHI1] == TriState::One ? 1 : 0; - apu->wire.PHI2 = outputs[(size_t)M6502Core::OutputPad::PHI2] == TriState::One ? 1 : 0; - apu->wire.RnW = outputs[(size_t)M6502Core::OutputPad::RnW] == TriState::One ? 1 : 0; - apu->wire.SYNC = outputs[(size_t)M6502Core::OutputPad::SYNC] == TriState::One ? 1 : 0; - - apu->PrevPHI_Core = apu->wire.PHI0; - } - - sim_DividerAfterCore(); - } - - void CoreBinding::sim_DividerBeforeCore() - { - - } - - void CoreBinding::sim_DividerAfterCore() - { - - } -} diff --git a/Chips/FastAPU/core.h b/Chips/FastAPU/core.h deleted file mode 100644 index bc10f4c9..00000000 --- a/Chips/FastAPU/core.h +++ /dev/null @@ -1,23 +0,0 @@ -// 6502 Core Binding - -#pragma once - -namespace FastAPU -{ - class CoreBinding - { - FastAPU* apu = nullptr; - - int CLK_FF{}; - uint8_t div{}; - - void sim_DividerBeforeCore(); - void sim_DividerAfterCore(); - - public: - CoreBinding(FastAPU* parent); - ~CoreBinding(); - - void sim(); - }; -} diff --git a/Chips/FastAPU/dac.cpp b/Chips/FastAPU/dac.cpp deleted file mode 100644 index 344d8d38..00000000 --- a/Chips/FastAPU/dac.cpp +++ /dev/null @@ -1,247 +0,0 @@ -#include "pch.h" - -namespace FastAPU -{ - DAC::DAC(FastAPU* parent) - { - apu = parent; - gen_DACTabs(); - } - - DAC::~DAC() - { - } - - void DAC::sim(APUSim::AudioOutSignal& AUX) - { - sim_DACA(AUX); - sim_DACB(AUX); - } - - void DAC::sim_DACA(APUSim::AudioOutSignal& aout) - { - if (raw_mode) - { - aout.RAW.sqa = apu->SQA_Out; - aout.RAW.sqb = apu->SQB_Out; - } - else - { - size_t v = ((size_t)apu->SQB_Out << 4) | apu->SQA_Out; - if (norm_mode) - { - aout.normalized.a = auxa_norm[v]; - } - else - { - aout.AUX.a = auxa_mv[v]; - } - } - } - - void DAC::sim_DACB(APUSim::AudioOutSignal& aout) - { - if (raw_mode) - { - aout.RAW.tri = apu->TRI_Out; - aout.RAW.rnd = apu->RND_Out; - aout.RAW.dmc = apu->DMC_Out; - } - else - { - size_t v = ((size_t)apu->DMC_Out << 8) | ((size_t)apu->RND_Out << 4) | apu->TRI_Out; - if (norm_mode) - { - aout.normalized.b = auxb_norm[v]; - } - else - { - aout.AUX.b = auxb_mv[v]; - } - } - } - - void DAC::SetRAWOutput(bool enable) - { - raw_mode = enable; - } - - void DAC::SetNormalizedOutput(bool enable) - { - norm_mode = enable; - } - - void DAC::gen_DACTabs() - { - // AUX A - - float maxv = 0.f; - - for (size_t sqb = 0; sqb < 16; sqb++) - { - for (size_t sqa = 0; sqa < 16; sqa++) - { - float r = AUX_A_Resistance(sqa, sqb); - float i = Vdd / (r + ExtRes); - float v = i * ExtRes * 1000.f; - if (v > maxv) - { - maxv = v; - } - auxa_mv[(sqb << 4) | sqa] = v; - } - } - - for (size_t sqb = 0; sqb < 16; sqb++) - { - for (size_t sqa = 0; sqa < 16; sqa++) - { - float r = AUX_A_Resistance(sqa, sqb); - float i = Vdd / (r + ExtRes); - float v = i * ExtRes * 1000.f; - auxa_norm[(sqb << 4) | sqa] = v / maxv; - } - } - - // AUX B - - maxv = 0.f; - - for (size_t dmc = 0; dmc < 128; dmc++) - { - for (size_t rnd = 0; rnd < 16; rnd++) - { - for (size_t tri = 0; tri < 16; tri++) - { - float r = AUX_B_Resistance(tri, rnd, dmc); - float i = Vdd / (r + ExtRes); - float v = i * ExtRes * 1000.f; - if (v > maxv) - { - maxv = v; - } - auxb_mv[(dmc << 8) | (rnd << 4) | tri] = v; - } - } - } - - for (size_t dmc = 0; dmc < 128; dmc++) - { - for (size_t rnd = 0; rnd < 16; rnd++) - { - for (size_t tri = 0; tri < 16; tri++) - { - float r = AUX_B_Resistance(tri, rnd, dmc); - float i = Vdd / (r + ExtRes); - float v = i * ExtRes * 1000.f; - auxb_norm[(dmc << 8) | (rnd << 4) | tri] = v / maxv; - } - } - } - } - - /// - /// Return the internal resistance of the AUX A terminal based on the SQA/SQB digital inputs. - /// - /// - /// - /// - float DAC::AUX_A_Resistance(size_t sqa, size_t sqb) - { - bool sqa_r_exists[] = { false, false, false, false }; - bool sqb_r_exists[] = { false, false, false, false }; - static float stage_reciprocal[] = { 1.f, 2.f, 4.f, 8.f }; - bool any_exists = false; - - // First determine which resistances are present - - for (size_t n = 0; n < 4; n++) - { - if ((sqa >> n) & 1) - { - sqa_r_exists[n] = true; - any_exists = true; - } - if ((sqb >> n) & 1) - { - sqb_r_exists[n] = true; - any_exists = true; - } - } - - // Calculate the total resistance - - float r = 0.f; - - for (size_t n = 0; n < 4; n++) - { - if (sqa_r_exists[n]) - r += 1.f / (IntRes / stage_reciprocal[n]); - if (sqb_r_exists[n]) - r += 1.f / (IntRes / stage_reciprocal[n]); - } - - return any_exists ? (1.f / r) : IntUnloaded; - } - - /// - /// Return the internal resistance of the AUX B terminal based on the TRI/RND/DMC digital inputs. - /// - /// - /// - /// - /// - float DAC::AUX_B_Resistance(size_t tri, size_t rnd, size_t dmc) - { - bool tri_r_exists[] = { false, false, false, false }; - bool rnd_r_exists[] = { false, false, false, false }; - bool dmc_r_exists[] = { false, false, false, false, false, false, false }; - static float tri_reciprocal[] = { 2.f, 4.f, 8.f, 16.f }; - static float rnd_reciprocal[] = { 1.f, 2.f, 4.f, 8.f }; - static float dmc_reciprocal[] = { 0.5f, 1.f, 2.f, 4.f, 8.f, 16.f, 32.f }; - bool any_exists = false; - - // First determine which resistances are present - - for (size_t n = 0; n < 4; n++) - { - if ((tri >> n) & 1) - { - tri_r_exists[n] = true; - any_exists = true; - } - if ((rnd >> n) & 1) - { - rnd_r_exists[n] = true; - any_exists = true; - } - } - for (size_t n = 0; n < 7; n++) - { - if ((dmc >> n) & 1) - { - dmc_r_exists[n] = true; - any_exists = true; - } - } - - // Calculate the total resistance - - float r = 0.f; - - for (size_t n = 0; n < 4; n++) - { - if (tri_r_exists[n]) - r += 1.f / (IntRes / tri_reciprocal[n]); - if (rnd_r_exists[n]) - r += 1.f / (IntRes / rnd_reciprocal[n]); - } - for (size_t n = 0; n < 7; n++) - { - if (dmc_r_exists[n]) - r += 1.f / (IntRes / dmc_reciprocal[n]); - } - - return any_exists ? (1.f / r) : IntUnloaded; - } -} diff --git a/Chips/FastAPU/dac.h b/Chips/FastAPU/dac.h deleted file mode 100644 index 60393b5c..00000000 --- a/Chips/FastAPU/dac.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -namespace FastAPU -{ - class DAC - { - FastAPU* apu = nullptr; - - bool raw_mode = false; - bool norm_mode = false; - - float auxa_mv[0x100]{}; - float auxa_norm[0x100]{}; - - float auxb_mv[32768]{}; - float auxb_norm[32768]{}; - - const float IntRes = 39000.f; // Internal single MOSFET resistance - const float IntUnloaded = 999999.f; // Non-loaded DAC internal resistance - const float ExtRes = 100.f; // On-board pull-down resistor to GND - const float Vdd = 5.0f; - - float AUX_A_Resistance(size_t sqa, size_t sqb); - float AUX_B_Resistance(size_t tri, size_t rnd, size_t dmc); - - void gen_DACTabs(); - - void sim_DACA(APUSim::AudioOutSignal& aout); - void sim_DACB(APUSim::AudioOutSignal& aout); - - public: - DAC(FastAPU* parent); - ~DAC(); - - void sim(APUSim::AudioOutSignal& AUX); - - void SetRAWOutput(bool enable); - - void SetNormalizedOutput(bool enable); - }; -} diff --git a/Chips/FastAPU/dma.cpp b/Chips/FastAPU/dma.cpp deleted file mode 100644 index 2cd2ef1f..00000000 --- a/Chips/FastAPU/dma.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// OAM DMA - -#include "pch.h" - -namespace FastAPU -{ - DMA::DMA(FastAPU* parent) - { - - } - - DMA::~DMA() - { - - } - - void DMA::sim() - { - - } - - void DMA::sim_DMA_Address() - { - - } - - void DMA::sim_DMA_Control() - { - - } - - void DMA::sim_DMA_Buffer() - { - - } - - void DMA::sim_AddressMux() - { - - } -} diff --git a/Chips/FastAPU/dma.h b/Chips/FastAPU/dma.h deleted file mode 100644 index 0e4be9b7..00000000 --- a/Chips/FastAPU/dma.h +++ /dev/null @@ -1,43 +0,0 @@ -// OAM DMA - -#pragma once - -namespace FastAPU -{ - class DMA - { - FastAPU* apu = nullptr; - - static const uint16_t PPU_Addr = 0x2004; - - uint8_t spr_lo{}; - uint8_t spr_hi{}; - - int spre_latch{}; - int nospr_latch{}; - int dospr_latch{}; - int StopDMA{}; - int StartDMA{}; - int DMADirToggle{}; - - uint8_t spr_buf{}; - - int SPRE{}; // OAM counter overflow signal. Used to determine if an OAM DMA is complete. - int SPRS{}; // A signal that enables OAM counter (low 8 bits of the address). The signal is silenced by RUNDMC. - - int NOSPR{}; // When NOSPR is 0 - the OAM DMA circuitry performs its activities to provide the OAM DMA process. - int DOSPR{}; // Latches the OAM DMA start event - int sprdma_rdy{}; // aka oamdma_rdy - - void sim_DMA_Address(); - void sim_DMA_Control(); - - public: - DMA(FastAPU* parent); - ~DMA(); - - void sim(); - void sim_DMA_Buffer(); - void sim_AddressMux(); - }; -} diff --git a/Chips/FastAPU/dpcm.cpp b/Chips/FastAPU/dpcm.cpp deleted file mode 100644 index d9f35571..00000000 --- a/Chips/FastAPU/dpcm.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// Differential Pulse-code Modulation (DPCM) Channel - -#include "pch.h" - -namespace FastAPU -{ - DpcmChan::DpcmChan(FastAPU* parent) - { - - } - - DpcmChan::~DpcmChan() - { - - } - - void DpcmChan::sim() - { - - } - - void DpcmChan::sim_ControlReg() - { - - } - - void DpcmChan::sim_IntControl() - { - - } - - void DpcmChan::sim_EnableControl() - { - - } - - void DpcmChan::sim_DMAControl() - { - - } - - void DpcmChan::sim_SampleCounterControl() - { - - } - - void DpcmChan::sim_SampleBufferControl() - { - - } - - void DpcmChan::sim_Decoder1() - { - - } - - void DpcmChan::sim_Decoder2() - { - - } - - void DpcmChan::sim_FreqLFSR() - { - - } - - void DpcmChan::sim_SampleCounterReg() - { - - } - - void DpcmChan::sim_SampleCounter() - { - - } - - void DpcmChan::sim_SampleBitCounter() - { - - } - - void DpcmChan::sim_SampleBuffer() - { - - } - - void DpcmChan::sim_AddressReg() - { - - } - - void DpcmChan::sim_AddressCounter() - { - - } - - void DpcmChan::sim_Output() - { - - } - - int DpcmChan::get_CTRL1() - { - return 0; - } - - int DpcmChan::get_CTRL2() - { - return 0; - } - - int DpcmChan::get_DMC1() - { - return 0; - } -} diff --git a/Chips/FastAPU/dpcm.h b/Chips/FastAPU/dpcm.h deleted file mode 100644 index 0c127bea..00000000 --- a/Chips/FastAPU/dpcm.h +++ /dev/null @@ -1,101 +0,0 @@ -// Differential Pulse-code Modulation (DPCM) Channel - -#pragma once - -namespace FastAPU -{ - class DpcmChan - { - FastAPU* apu = nullptr; - - int LOOPMode{}; // 1: DPCM looped playback - int n_IRQEN{}; // 0: Enable interrupt from DPCM - int DSLOAD{}; // Load value into Sample Counter and simultaneously into DPCM Address Counter - int DSSTEP{}; // Perform Sample Counter decrement and DPCM Address Counter increment simultaneously - int BLOAD{}; // Load value into Sample Buffer - int BSTEP{}; // Perform a Sample Buffer bit shift - int NSTEP{}; // Perform Sample Bit Counter increment - int DSTEP{}; // Increment/decrement the DPCM Output counter - int PCM{}; // Load new sample value into Sample Buffer. The signal is active when PHI1 = 0 and the address bus is captured (imitating CPU reading) - int DOUT{}; // DPCM Out counter has finished counting - int n_NOUT{}; // 0: Sample Bit Counter has finished counting - int SOUT{}; // Sample Counter has finished counting - int DFLOAD{}; // Frequency LFSR finished counting and reloaded itself - int n_BOUT{}; // The next bit value pushed out of the Sample Buffer shift register (inverted value) - int Fx[4]{}; - int FR[9]{}; - int Dec1_out[16]{}; - - int ED1{}; // 1: Assert interrupt - int ED2{}; // 1: DMC enable ($4015[4]) - int DMC1{}; // 1: PCM (DMA fetch) done - int DMC2{}; // 1: DMC finish - int CTRL1{}; // 0: Stop DMA - int CTRL2{}; // 0: DMC enable delay - - int ACLK2{}; - - int int_ff{}; - int sout_latch{}; - int ena_ff{}; - int run_latch1{}; - int run_latch2{}; - int start_ff{}; - int rdy_ff{}; - int en_latch1{}; - int en_latch2{}; - int en_latch3{}; - int step_ff{}; - int stop_ff{}; - int pcm_ff{}; - int dout_latch{}; - int dstep_latch{}; - int stop_latch{}; - int pcm_latch{}; - int nout_latch{}; - - uint8_t freq_reg{}; - int loop_reg{}; - int irq_reg{}; - uint16_t lfsr{}; - uint8_t scnt_reg{}; - uint16_t scnt{}; - uint8_t sbcnt{}; - uint8_t buf_reg{}; - uint8_t shift_reg{}; - uint8_t addr_reg{}; - uint8_t addr_lo{}; - uint8_t addr_hi{}; - uint8_t out_cnt{}; - int out_reg{}; - - void sim_ControlReg(); - void sim_IntControl(); - void sim_EnableControl(); - void sim_DMAControl(); - void sim_SampleCounterControl(); - void sim_SampleBufferControl(); - - void sim_Decoder1(); - void sim_Decoder2(); - void sim_FreqLFSR(); - void sim_SampleCounterReg(); - void sim_SampleCounter(); - void sim_SampleBitCounter(); - void sim_SampleBuffer(); - - void sim_AddressReg(); - void sim_AddressCounter(); - void sim_Output(); - - int get_CTRL1(); - int get_CTRL2(); - int get_DMC1(); - - public: - DpcmChan(FastAPU* parent); - ~DpcmChan(); - - void sim(); - }; -} diff --git a/Chips/FastAPU/env.cpp b/Chips/FastAPU/env.cpp deleted file mode 100644 index 2475e5f1..00000000 --- a/Chips/FastAPU/env.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// Envelope Unit -// Shared between the square channels and the noise generator. - -#include "pch.h" - -namespace FastAPU -{ - EnvelopeUnit::EnvelopeUnit(FastAPU* parent) - { - - } - - EnvelopeUnit::~EnvelopeUnit() - { - - } - - void EnvelopeUnit::sim(uint8_t V, int WR_Reg, int WR_LC) - { - - } - - int EnvelopeUnit::get_LC() - { - return 0; - } -} diff --git a/Chips/FastAPU/env.h b/Chips/FastAPU/env.h deleted file mode 100644 index d6765be3..00000000 --- a/Chips/FastAPU/env.h +++ /dev/null @@ -1,30 +0,0 @@ -// Envelope Unit -// Shared between the square channels and the noise generator. - -#pragma once - -namespace FastAPU -{ - class EnvelopeUnit - { - FastAPU* apu = nullptr; - - int envdis_reg{}; - int lc_reg{}; - uint8_t vol_reg{}; - uint8_t decay_cnt{}; - uint8_t env_cnt{}; - int EnvReload{}; - int erld_latch{}; - int reload_latch{}; - int rco_latch{}; - int eco_latch{}; - - public: - EnvelopeUnit(FastAPU* parent); - ~EnvelopeUnit(); - - void sim(uint8_t V, int WR_Reg, int WR_LC); - int get_LC(); - }; -} diff --git a/Chips/FastAPU/length.cpp b/Chips/FastAPU/length.cpp deleted file mode 100644 index 9cd99fac..00000000 --- a/Chips/FastAPU/length.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// Length Counters - -#include "pch.h" - -namespace FastAPU -{ - LengthCounter::LengthCounter(FastAPU* parent) - { - - } - - LengthCounter::~LengthCounter() - { - - } - - void LengthCounter::sim(size_t bit_ena, int WriteEn, int LC_CarryIn, int& LC_NoCount) - { - - } - - void LengthCounter::sim_Control(size_t bit_ena, int WriteEn, int& LC_NoCount) - { - - } - - void LengthCounter::sim_Decoder1() - { - - } - - void LengthCounter::sim_Decoder2() - { - - } - - void LengthCounter::sim_Counter(int LC_CarryIn, int WriteEn) - { - - } -} diff --git a/Chips/FastAPU/length.h b/Chips/FastAPU/length.h deleted file mode 100644 index 4c7f980d..00000000 --- a/Chips/FastAPU/length.h +++ /dev/null @@ -1,36 +0,0 @@ -// Length Counters - -#pragma once - -namespace FastAPU -{ - class LengthCounter - { - FastAPU* apu = nullptr; - - int reg_enable_latch{}; - int ena_latch{}; - int cout_latch{}; - int stat_ff{}; - int step_latch{}; - int STEP{}; - - uint8_t dec_latch{}; - BaseLogic::TriState Dec1_out[32]{}; - - uint8_t LC{}; - uint8_t cnt{}; - int carry_out{}; - - void sim_Control(size_t bit_ena, int WriteEn, int& LC_NoCount); - void sim_Decoder1(); - void sim_Decoder2(); - void sim_Counter(int LC_CarryIn, int WriteEn); - - public: - LengthCounter(FastAPU* parent); - ~LengthCounter(); - - void sim(size_t bit_ena, int WriteEn, int LC_CarryIn, int& LC_NoCount); - }; -} diff --git a/Chips/FastAPU/noise.cpp b/Chips/FastAPU/noise.cpp deleted file mode 100644 index 97d29a6d..00000000 --- a/Chips/FastAPU/noise.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// Noise Channel - -#include "pch.h" - -namespace FastAPU -{ - NoiseChan::NoiseChan(FastAPU* parent) - { - - } - - NoiseChan::~NoiseChan() - { - - } - - void NoiseChan::sim() - { - - } - - int NoiseChan::get_LC() - { - return 0; - } - - void NoiseChan::sim_FreqReg() - { - - } - - void NoiseChan::sim_Decoder1() - { - - } - - void NoiseChan::sim_Decoder1_Calc(BaseLogic::TriState* F, BaseLogic::TriState* nF) - { - - } - - void NoiseChan::sim_Decoder2() - { - - } - - void NoiseChan::sim_FreqLFSR() - { - - } - - void NoiseChan::sim_RandomLFSR() - { - - } -} diff --git a/Chips/FastAPU/noise.h b/Chips/FastAPU/noise.h deleted file mode 100644 index d1431656..00000000 --- a/Chips/FastAPU/noise.h +++ /dev/null @@ -1,39 +0,0 @@ -// Noise Channel - -#pragma once - -namespace FastAPU -{ - class NoiseChan - { - friend FastAPU; - - FastAPU* apu = nullptr; - - uint16_t NNF{}; - int RSTEP{}; - int RNDOUT{}; - uint8_t Vol{}; - BaseLogic::TriState Dec1_out[16]{}; - - uint8_t freq_reg{}; - uint16_t freq_lfsr{}; - int rmod_reg{}; - uint16_t rnd_lfsr{}; - EnvelopeUnit* env_unit = nullptr; - - void sim_FreqReg(); - void sim_Decoder1(); - void sim_Decoder1_Calc(BaseLogic::TriState* F, BaseLogic::TriState* nF); - void sim_Decoder2(); - void sim_FreqLFSR(); - void sim_RandomLFSR(); - - public: - NoiseChan(FastAPU* parent); - ~NoiseChan(); - - void sim(); - int get_LC(); - }; -} diff --git a/Chips/FastAPU/pads.cpp b/Chips/FastAPU/pads.cpp deleted file mode 100644 index e1fdb6ad..00000000 --- a/Chips/FastAPU/pads.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// Simulation of APU chip terminals and everything related to them. - -#include "pch.h" - -namespace FastAPU -{ - Pads::Pads(FastAPU* parent) - { - - } - - Pads::~Pads() - { - - } - - void Pads::sim_InputPads(BaseLogic::TriState inputs[]) - { - - } - - void Pads::sim_OutputPads(BaseLogic::TriState outputs[], uint16_t* addr) - { - - } - - void Pads::sim_DataBusInput(uint8_t* data) - { - - } - - void Pads::sim_DataBusOutput(uint8_t* data) - { - - } - - void Pads::sim_OutReg() - { - - } -} diff --git a/Chips/FastAPU/pads.h b/Chips/FastAPU/pads.h deleted file mode 100644 index e1e08b00..00000000 --- a/Chips/FastAPU/pads.h +++ /dev/null @@ -1,33 +0,0 @@ -// Simulation of APU chip terminals and everything related to them. - -#pragma once - -namespace FastAPU -{ - class Pads - { - FastAPU* apu = nullptr; - - int n_irq{}; - int n_nmi{}; - uint8_t data_bus{}; - uint8_t n_in{}; - uint8_t out{}; - - uint8_t OUT_Signal{}; - uint8_t out_reg{}; - uint8_t out_latch{}; - - void sim_OutReg(); - - public: - Pads(FastAPU* parent); - ~Pads(); - - void sim_InputPads(BaseLogic::TriState inputs[]); - void sim_OutputPads(BaseLogic::TriState outputs[], uint16_t* addr); - - void sim_DataBusInput(uint8_t* data); - void sim_DataBusOutput(uint8_t* data); - }; -} diff --git a/Chips/FastAPU/pch.cpp b/Chips/FastAPU/pch.cpp deleted file mode 100644 index 1d9f38c5..00000000 --- a/Chips/FastAPU/pch.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "pch.h" diff --git a/Chips/FastAPU/pch.h b/Chips/FastAPU/pch.h deleted file mode 100644 index 188d4a3d..00000000 --- a/Chips/FastAPU/pch.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "../../Common/BaseLogicLib/BaseLogic.h" -#include "../../Chips/M6502Core/core.h" - -#include "apu.h" diff --git a/Chips/FastAPU/regs.cpp b/Chips/FastAPU/regs.cpp deleted file mode 100644 index 4d08a850..00000000 --- a/Chips/FastAPU/regs.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// Register Decoder - -#include "pch.h" - -namespace FastAPU -{ - RegsDecoder::RegsDecoder(FastAPU* parent) - { - - } - - RegsDecoder::~RegsDecoder() - { - - } - - void RegsDecoder::sim() - { - - } - - void RegsDecoder::sim_DebugRegisters() - { - - } - - void RegsDecoder::sim_DebugLock() - { - - } - - void RegsDecoder::sim_Predecode() - { - - } - - void RegsDecoder::sim_Decoder() - { - - } - - void RegsDecoder::sim_RegOps() - { - - } -} diff --git a/Chips/FastAPU/regs.h b/Chips/FastAPU/regs.h deleted file mode 100644 index d3c81bab..00000000 --- a/Chips/FastAPU/regs.h +++ /dev/null @@ -1,28 +0,0 @@ -// Register Decoder - -#pragma once - -namespace FastAPU -{ - class RegsDecoder - { - FastAPU* apu = nullptr; - - int nREGWR{}; - int nREGRD{}; - - int lock_latch{}; - - void sim_DebugLock(); - void sim_Predecode(); - void sim_Decoder(); - void sim_RegOps(); - - public: - RegsDecoder(FastAPU* parent); - ~RegsDecoder(); - - void sim(); - void sim_DebugRegisters(); - }; -} diff --git a/Chips/FastAPU/square.cpp b/Chips/FastAPU/square.cpp deleted file mode 100644 index fbc36968..00000000 --- a/Chips/FastAPU/square.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// Square Channels - -#include "pch.h" - -namespace FastAPU -{ - SquareChan::SquareChan(FastAPU* parent, SquareChanCarryIn carry_routing) - { - } - - SquareChan::~SquareChan() - { - - } - - void SquareChan::sim(int WR0, int WR1, int WR2, int WR3, int NOSQ, uint8_t* SQ_Out) - { - - } - - int SquareChan::get_LC() - { - return 0; - } - - void SquareChan::sim_FreqReg(int WR2, int WR3) - { - - } - - void SquareChan::sim_ShiftReg(int WR1) - { - - } - - void SquareChan::sim_BarrelShifter() - { - - } - - void SquareChan::sim_Adder() - { - - } - - void SquareChan::sim_FreqCounter() - { - - } - - void SquareChan::sim_Sweep(int WR1, int NOSQ) - { - - } - - void SquareChan::sim_Duty(int WR0, int WR3) - { - - } - - void SquareChan::sim_Output(int NOSQ, int* SQ_Out) - { - - } -} diff --git a/Chips/FastAPU/square.h b/Chips/FastAPU/square.h deleted file mode 100644 index 40883857..00000000 --- a/Chips/FastAPU/square.h +++ /dev/null @@ -1,75 +0,0 @@ -// Square Channels - -#pragma once - -namespace FastAPU -{ - /// - /// Input #carry connection option for the adder. - /// In the real circuit there is no `AdderCarryMode` signal. For Square0 the input n_carry is connected directly to VDD and for Square1 it is connected to INC. - /// But we cheat a little bit here for convenience by making the connection using multiplexer. - /// - enum SquareChanCarryIn - { - Unknown = 0, - Vdd, - Inc, - }; - - class SquareChan - { - friend FastAPU; - - FastAPU* apu = nullptr; - SquareChanCarryIn cin_type = SquareChanCarryIn::Unknown; - - uint16_t n_sum{}; - uint16_t S{}; - uint8_t SR{}; - uint16_t BS{}; - int DEC{}; - int INC{}; - int n_COUT{}; - int SW_UVF{}; // Sweep underflow - int FCO{}; - int FLOAD{}; - int DO_SWEEP{}; - int SW_OVF{}; // Sweep overflow - int DUTY{}; - uint8_t Vol{}; - - int dir_reg{}; - uint16_t freq_reg{}; - uint8_t sr_reg{}; - uint16_t adder{}; - BaseLogic::DLatch fco_latch{}; - uint16_t freq_cnt{}; - int swdis_reg{}; - BaseLogic::DLatch reload_latch{}; - BaseLogic::DLatch sco_latch{}; - BaseLogic::FF reload_ff{}; - uint8_t sweep_reg{}; - uint8_t sweep_cnt{}; - uint8_t duty_reg{}; - uint8_t duty_cnt{}; - BaseLogic::DLatch sqo_latch{}; - - EnvelopeUnit* env_unit = nullptr; - - void sim_FreqReg(int WR2, int WR3); - void sim_ShiftReg(int WR1); - void sim_BarrelShifter(); - void sim_Adder(); - void sim_FreqCounter(); - void sim_Sweep(int WR1, int NOSQ); - void sim_Duty(int WR0, int WR3); - void sim_Output(int NOSQ, int* SQ_Out); - - public: - SquareChan(FastAPU* parent, SquareChanCarryIn carry_routing); - ~SquareChan(); - - void sim(int WR0, int WR1, int WR2, int WR3, int NOSQ, uint8_t* SQ_Out); - int get_LC(); - }; -} diff --git a/Chips/FastAPU/triangle.cpp b/Chips/FastAPU/triangle.cpp deleted file mode 100644 index 73d29cb0..00000000 --- a/Chips/FastAPU/triangle.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// Triangle Channel - -#include "pch.h" - -namespace FastAPU -{ - TriangleChan::TriangleChan(FastAPU* parent) - { - - } - - TriangleChan::~TriangleChan() - { - - } - - void TriangleChan::sim() - { - - } - - int TriangleChan::get_LC() - { - return 0; - } - - void TriangleChan::sim_Control() - { - - } - - void TriangleChan::sim_LinearReg() - { - - } - - void TriangleChan::sim_LinearCounter() - { - - } - - void TriangleChan::sim_FreqReg() - { - - } - - void TriangleChan::sim_FreqCounter() - { - - } - - void TriangleChan::sim_Output() - { - - } -} diff --git a/Chips/FastAPU/triangle.h b/Chips/FastAPU/triangle.h deleted file mode 100644 index 5ae84f3e..00000000 --- a/Chips/FastAPU/triangle.h +++ /dev/null @@ -1,44 +0,0 @@ -// Triangle Channel - -#pragma once - -namespace FastAPU -{ - class TriangleChan - { - FastAPU* apu = nullptr; - - int TCO{}; - int n_FOUT{}; - int LOAD{}; - int STEP{}; - int TSTEP{}; - - int lc_reg{}; - int Reload_FF{}; - int reload_latch1{}; - int reload_latch2{}; - int tco_latch{}; - - uint8_t lin_reg{}; - uint8_t lin_cnt{}; - uint16_t freq_reg{}; - uint16_t freq_cnt{}; - int fout_latch{}; - uint8_t out_cnt{}; - - void sim_Control(); - void sim_LinearReg(); - void sim_LinearCounter(); - void sim_FreqReg(); - void sim_FreqCounter(); - void sim_Output(); - - public: - TriangleChan(FastAPU* parent); - ~TriangleChan(); - - void sim(); - int get_LC(); - }; -} diff --git a/Chips/private/Readme.md b/Chips/private/Readme.md new file mode 100644 index 00000000..ecaa2a45 --- /dev/null +++ b/Chips/private/Readme.md @@ -0,0 +1,3 @@ +# private + +Fast versions of the chips are not published so that the source code doesn't end up in parasitic project aggregators. diff --git a/Tools/ApuPumpkin/ApuPumpkin.sln b/Tools/ApuPumpkin/ApuPumpkin.sln index 6546353f..8553c1bf 100644 --- a/Tools/ApuPumpkin/ApuPumpkin.sln +++ b/Tools/ApuPumpkin/ApuPumpkin.sln @@ -11,8 +11,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "M6502Core", "..\..\Chips\M6 EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "APUSim", "..\..\Chips\APUSim\Scripts\VS2022\APUSim.vcxproj", "{50E93D78-36DC-46C3-82EA-CAB373E18729}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FastAPU", "..\..\Chips\FastAPU\FastAPU.vcxproj", "{2C9982F5-51F1-4BDA-B331-C88690CC3BEE}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -53,14 +51,6 @@ Global {50E93D78-36DC-46C3-82EA-CAB373E18729}.Release|x64.Build.0 = Release|x64 {50E93D78-36DC-46C3-82EA-CAB373E18729}.Release|x86.ActiveCfg = Release|Win32 {50E93D78-36DC-46C3-82EA-CAB373E18729}.Release|x86.Build.0 = Release|Win32 - {2C9982F5-51F1-4BDA-B331-C88690CC3BEE}.Debug|x64.ActiveCfg = Debug|x64 - {2C9982F5-51F1-4BDA-B331-C88690CC3BEE}.Debug|x64.Build.0 = Debug|x64 - {2C9982F5-51F1-4BDA-B331-C88690CC3BEE}.Debug|x86.ActiveCfg = Debug|Win32 - {2C9982F5-51F1-4BDA-B331-C88690CC3BEE}.Debug|x86.Build.0 = Debug|Win32 - {2C9982F5-51F1-4BDA-B331-C88690CC3BEE}.Release|x64.ActiveCfg = Release|x64 - {2C9982F5-51F1-4BDA-B331-C88690CC3BEE}.Release|x64.Build.0 = Release|x64 - {2C9982F5-51F1-4BDA-B331-C88690CC3BEE}.Release|x86.ActiveCfg = Release|Win32 - {2C9982F5-51F1-4BDA-B331-C88690CC3BEE}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Tools/ApuPumpkin/ApuPumpkin.vcxproj b/Tools/ApuPumpkin/ApuPumpkin.vcxproj index 437707f9..64ff476e 100644 --- a/Tools/ApuPumpkin/ApuPumpkin.vcxproj +++ b/Tools/ApuPumpkin/ApuPumpkin.vcxproj @@ -160,9 +160,6 @@ {50e93d78-36dc-46c3-82ea-cab373e18729} - - {2c9982f5-51f1-4bda-b331-c88690cc3bee} - {11aad192-46eb-4d5d-b81f-bcee11d6af8e} diff --git a/Tools/ApuPumpkin/pch.h b/Tools/ApuPumpkin/pch.h index 929106df..1cbb62d7 100644 --- a/Tools/ApuPumpkin/pch.h +++ b/Tools/ApuPumpkin/pch.h @@ -14,7 +14,7 @@ #include "../../Chips/M6502Core/core.h" #if FAST_APU -#include "../../Chips/FastAPU/apu.h" +#include "../../private/Chips/FastAPU/apu.h" #else #include "../../Chips/APUSim/apu.h" #endif