mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-10-22 07:02:37 +00:00
Correct a few class usage problems
This commit is contained in:
1 parent
74fdefba05
commit
decb60bbaa
26 files changed
+96
-38
No files matched your search
@@ -83,6 +83,7 @@
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -98,6 +99,7 @@
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -110,6 +112,7 @@
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
@@ -125,6 +128,7 @@
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@@ -154,8 +158,18 @@
|
||||
<ClCompile Include="opcode_test_suite_t.cpp" />
|
||||
<ClCompile Include="parser_t.cpp" />
|
||||
<ClCompile Include="processor_test_suite_t.cpp" />
|
||||
<ClCompile Include="simdjson\simdjson.cpp" />
|
||||
<ClCompile Include="stdafx.cpp" />
|
||||
<ClCompile Include="simdjson\simdjson.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TestRunner.cpp" />
|
||||
<ClCompile Include="tests.cpp" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
|
||||
#include "simdjson/simdjson.h"
|
||||
|
||||
class array_t {
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <sstream>
|
||||
|
||||
#include <Disassembler.h>
|
||||
|
||||
|
||||
@@ -2,17 +2,12 @@
|
||||
|
||||
#define SIMDJSON_DISABLE_DEPRECATED_API
|
||||
|
||||
#include <cassert>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <exception>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <optional>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <array>
|
||||
#include <functional>
|
||||
|
||||
+4
-1
@@ -4,18 +4,21 @@
|
||||
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
#include <stdexcept>
|
||||
#include <cassert>
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <functional>
|
||||
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include <Bus.h>
|
||||
#include <IntelProcessor.h>
|
||||
#include <InputOutput.h>
|
||||
#include <EventArgs.h>
|
||||
#include <Signal.h>
|
||||
#include <Register.h>
|
||||
@@ -7,6 +7,9 @@ namespace EightBit {
|
||||
class Bus;
|
||||
|
||||
class BigEndianProcessor : public Processor {
|
||||
|
||||
using base = Processor;
|
||||
|
||||
public:
|
||||
virtual ~BigEndianProcessor() noexcept = default;
|
||||
BigEndianProcessor(const BigEndianProcessor& rhs) noexcept;
|
||||
@@ -25,7 +28,7 @@ namespace EightBit {
|
||||
|
||||
void fetchInto(register16_t& into) noexcept final;
|
||||
|
||||
void pushShort(register16_t value) noexcept final;
|
||||
void pushShort(register16_t value) noexcept override;
|
||||
void popInto(register16_t& into) noexcept final;
|
||||
};
|
||||
}
|
||||
@@ -11,6 +11,9 @@
|
||||
|
||||
namespace EightBit {
|
||||
class Bus : public Mapper {
|
||||
|
||||
using base = Mapper;
|
||||
|
||||
public:
|
||||
virtual ~Bus() noexcept = default;
|
||||
|
||||
|
||||
+4
-1
@@ -18,6 +18,9 @@
|
||||
|
||||
namespace EightBit {
|
||||
class Chip : public Device {
|
||||
|
||||
using base = Device;
|
||||
|
||||
public:
|
||||
enum Bits {
|
||||
Bit0 = 1,
|
||||
@@ -143,7 +146,7 @@ namespace EightBit {
|
||||
}
|
||||
|
||||
Chip(const Chip& rhs) noexcept
|
||||
: Device(rhs) {}
|
||||
: base(rhs) {}
|
||||
|
||||
protected:
|
||||
Chip() noexcept = default;
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
|
||||
namespace EightBit {
|
||||
class ClockedChip : public Chip {
|
||||
|
||||
using base = Chip;
|
||||
|
||||
public:
|
||||
ClockedChip(const ClockedChip& rhs) noexcept;
|
||||
bool operator==(const ClockedChip& rhs) const noexcept;
|
||||
|
||||
@@ -14,6 +14,9 @@ namespace EightBit {
|
||||
class Bus;
|
||||
|
||||
class IntelProcessor : public LittleEndianProcessor {
|
||||
|
||||
using base = LittleEndianProcessor;
|
||||
|
||||
public:
|
||||
struct opcode_decoded_t {
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ namespace EightBit {
|
||||
class Bus;
|
||||
|
||||
class LittleEndianProcessor : public Processor {
|
||||
|
||||
using base = Processor;
|
||||
|
||||
public:
|
||||
virtual ~LittleEndianProcessor() noexcept = default;
|
||||
LittleEndianProcessor(const LittleEndianProcessor& rhs) noexcept;
|
||||
@@ -25,7 +28,7 @@ namespace EightBit {
|
||||
|
||||
void fetchInto(register16_t& into) noexcept final;
|
||||
|
||||
void pushShort(register16_t value) noexcept final;
|
||||
void pushShort(register16_t value) noexcept override;
|
||||
void popInto(register16_t& into) noexcept final;
|
||||
};
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <array>
|
||||
#include <limits>
|
||||
#include <cassert>
|
||||
|
||||
#include "Chip.h"
|
||||
|
||||
namespace EightBit {
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
|
||||
namespace EightBit {
|
||||
class PortEventArgs final : public EventArgs {
|
||||
|
||||
using base = EventArgs;
|
||||
|
||||
private:
|
||||
register16_t _port;
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
|
||||
namespace EightBit {
|
||||
class Processor : public ClockedChip {
|
||||
|
||||
using base = ClockedChip;
|
||||
|
||||
public:
|
||||
Signal<EventArgs> ExecutingInstruction;
|
||||
Signal<EventArgs> ExecutedInstruction;
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace EightBit {
|
||||
// The RAM class is everything the ROM class is, plus
|
||||
// it's externally 'reference'able and 'poke'able.
|
||||
class Ram : public Rom {
|
||||
|
||||
using base = Rom;
|
||||
|
||||
public:
|
||||
Ram(size_t size = 0) noexcept;
|
||||
virtual ~Ram() noexcept = default;
|
||||
|
||||
@@ -12,6 +12,9 @@ namespace EightBit {
|
||||
// Nothing over and above the interface is exposed to users
|
||||
// of the ROM class.
|
||||
class Rom : public Memory {
|
||||
|
||||
using base = Memory;
|
||||
|
||||
private:
|
||||
std::vector<uint8_t> m_bytes;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
#include "EventArgs.h"
|
||||
|
||||
namespace EightBit {
|
||||
|
||||
@@ -12,6 +12,9 @@ namespace EightBit {
|
||||
// *always* returns the same value, from whichever location
|
||||
// is being read.
|
||||
class UnusedMemory final : public Memory {
|
||||
|
||||
using base = Memory;
|
||||
|
||||
public:
|
||||
UnusedMemory(uint16_t size, uint8_t value) noexcept;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
#include "../inc/BigEndianProcessor.h"
|
||||
|
||||
EightBit::BigEndianProcessor::BigEndianProcessor(Bus& memory) noexcept
|
||||
: Processor(memory) {}
|
||||
: base(memory) {}
|
||||
|
||||
EightBit::BigEndianProcessor::BigEndianProcessor(const BigEndianProcessor& rhs) noexcept
|
||||
: Processor(rhs) {}
|
||||
: base(rhs) {}
|
||||
|
||||
EightBit::register16_t EightBit::BigEndianProcessor::peekShort(uint16_t address) noexcept {
|
||||
const auto high = BUS().peek(address);
|
||||
|
||||
+2
-2
@@ -2,12 +2,12 @@
|
||||
#include "../inc/ClockedChip.h"
|
||||
|
||||
EightBit::ClockedChip::ClockedChip(const ClockedChip& rhs) noexcept
|
||||
: Chip(rhs) {
|
||||
: base(rhs) {
|
||||
m_cycles = rhs.m_cycles;
|
||||
}
|
||||
|
||||
bool EightBit::ClockedChip::operator==(const EightBit::ClockedChip& rhs) const noexcept {
|
||||
return
|
||||
Chip::operator==(rhs)
|
||||
base::operator==(rhs)
|
||||
&& cycles() == rhs.cycles();
|
||||
}
|
||||
+11
-11
@@ -5,7 +5,7 @@ std::array<int, 8> EightBit::IntelProcessor::m_halfCarryTableAdd = { { 0, 0, 1,
|
||||
std::array<int, 8> EightBit::IntelProcessor::m_halfCarryTableSub = { { 0, 1, 1, 1, 0, 0, 0, 1 } };
|
||||
|
||||
EightBit::IntelProcessor::IntelProcessor(Bus& bus) noexcept
|
||||
: LittleEndianProcessor(bus) {
|
||||
: base(bus) {
|
||||
for (int i = 0; i < 0x100; ++i)
|
||||
m_decodedOpcodes.at(i) = i;
|
||||
|
||||
@@ -17,7 +17,7 @@ EightBit::IntelProcessor::IntelProcessor(Bus& bus) noexcept
|
||||
}
|
||||
|
||||
EightBit::IntelProcessor::IntelProcessor(const IntelProcessor& rhs) noexcept
|
||||
: LittleEndianProcessor(rhs),
|
||||
: base(rhs),
|
||||
m_sp(rhs.m_sp),
|
||||
m_memptr(rhs.m_memptr) {
|
||||
HALT() = rhs.HALT();
|
||||
@@ -30,13 +30,13 @@ void EightBit::IntelProcessor::resetRegisterSet() noexcept {
|
||||
DEFINE_PIN_LEVEL_CHANGERS(HALT, IntelProcessor);
|
||||
|
||||
void EightBit::IntelProcessor::handleRESET() noexcept {
|
||||
Processor::handleRESET();
|
||||
base::handleRESET();
|
||||
disableInterrupts();
|
||||
Processor::jump(0);
|
||||
base::jump(0);
|
||||
}
|
||||
|
||||
void EightBit::IntelProcessor::handleINT() noexcept {
|
||||
Processor::handleINT();
|
||||
base::handleINT();
|
||||
raiseHALT();
|
||||
disableInterrupts();
|
||||
}
|
||||
@@ -51,7 +51,7 @@ void EightBit::IntelProcessor::pop() noexcept {
|
||||
|
||||
EightBit::register16_t& EightBit::IntelProcessor::incrementPC() noexcept {
|
||||
if (proceeding())
|
||||
Processor::incrementPC();
|
||||
base::incrementPC();
|
||||
return PC();
|
||||
}
|
||||
|
||||
@@ -61,12 +61,12 @@ uint8_t EightBit::IntelProcessor::fetchInstruction() noexcept {
|
||||
}
|
||||
|
||||
void EightBit::IntelProcessor::getShort() noexcept {
|
||||
LittleEndianProcessor::getShort();
|
||||
base::getShort();
|
||||
MEMPTR() = BUS().ADDRESS();
|
||||
}
|
||||
|
||||
void EightBit::IntelProcessor::setShort(const register16_t value) noexcept {
|
||||
LittleEndianProcessor::setShort(value);
|
||||
base::setShort(value);
|
||||
MEMPTR() = BUS().ADDRESS();
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ void EightBit::IntelProcessor::jumpRelative(const int8_t offset) noexcept {
|
||||
}
|
||||
|
||||
void EightBit::IntelProcessor::ret() noexcept {
|
||||
LittleEndianProcessor::ret();
|
||||
base::ret();
|
||||
MEMPTR() = PC();
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ void EightBit::IntelProcessor::jumpIndirect() noexcept {
|
||||
}
|
||||
|
||||
void EightBit::IntelProcessor::jump() noexcept {
|
||||
Processor::jump(MEMPTR());
|
||||
base::jump(MEMPTR());
|
||||
}
|
||||
|
||||
void EightBit::IntelProcessor::callIndirect() noexcept {
|
||||
@@ -150,7 +150,7 @@ bool EightBit::IntelProcessor::operator==(const EightBit::IntelProcessor& rhs) c
|
||||
auto& left = const_cast<IntelProcessor&>(*this);
|
||||
auto& right = const_cast<IntelProcessor&>(rhs);
|
||||
return
|
||||
LittleEndianProcessor::operator==(rhs)
|
||||
base::operator==(rhs)
|
||||
&& left.HALT() == right.HALT()
|
||||
&& left.MEMPTR() == right.MEMPTR()
|
||||
&& left.SP() == right.SP()
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
#include "../inc/LittleEndianProcessor.h"
|
||||
|
||||
EightBit::LittleEndianProcessor::LittleEndianProcessor(Bus& memory) noexcept
|
||||
: Processor(memory) {}
|
||||
: base(memory) {}
|
||||
|
||||
EightBit::LittleEndianProcessor::LittleEndianProcessor(const LittleEndianProcessor& rhs) noexcept
|
||||
: Processor(rhs) {}
|
||||
: base(rhs) {}
|
||||
|
||||
EightBit::register16_t EightBit::LittleEndianProcessor::peekShort(uint16_t address) noexcept {
|
||||
const auto low = BUS().peek(address);
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ EightBit::Processor::Processor(Bus& bus) noexcept
|
||||
}
|
||||
|
||||
EightBit::Processor::Processor(const Processor& rhs) noexcept
|
||||
: ClockedChip(rhs),
|
||||
: base(rhs),
|
||||
m_bus(rhs.m_bus),
|
||||
m_opcode(rhs.m_opcode),
|
||||
m_pc(rhs.m_pc),
|
||||
@@ -157,7 +157,7 @@ void EightBit::Processor::ret() noexcept {
|
||||
|
||||
bool EightBit::Processor::operator==(const EightBit::Processor& rhs) const noexcept {
|
||||
return
|
||||
ClockedChip::operator==(rhs)
|
||||
base::operator==(rhs)
|
||||
&& RESET() == rhs.RESET()
|
||||
&& INT() == rhs.INT()
|
||||
&& PC() == rhs.PC();
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
#include "../inc/Ram.h"
|
||||
|
||||
EightBit::Ram::Ram(const size_t size) noexcept
|
||||
: Rom(size) {}
|
||||
: base(size) {}
|
||||
|
||||
void EightBit::Ram::poke(const uint16_t address, const uint8_t value) noexcept {
|
||||
Rom::poke(address, value);
|
||||
base::poke(address, value);
|
||||
}
|
||||
+8
-5
@@ -5,28 +5,31 @@
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <ios>
|
||||
#include <chrono>
|
||||
#include <algorithm>
|
||||
#include <coroutine>
|
||||
#include <limits>
|
||||
|
||||
#include <string>
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <bitset>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
# include <intrin.h>
|
||||
#endif
|
||||
|
||||
#ifdef __GNUG__
|
||||
# include <x86intrin.h>
|
||||
#endif
|
||||
|
||||
#if !(defined(_MSC_VER) || defined(__GNUG__))
|
||||
# include <bitset>
|
||||
#endif
|
||||
Reference in new issue
Block a user