mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-03-14 10:16:21 +00:00
Start adding comparison operations to EightBit classes
This commit is contained in:
@@ -14,3 +14,9 @@ void EightBit::ClockedChip::tick() {
|
||||
void EightBit::ClockedChip::resetCycles() noexcept {
|
||||
m_cycles = 0;
|
||||
}
|
||||
|
||||
bool EightBit::ClockedChip::operator==(const EightBit::ClockedChip& rhs) const {
|
||||
return
|
||||
Device::operator==(rhs)
|
||||
&& cycles() == rhs.cycles();
|
||||
}
|
||||
|
||||
@@ -2,3 +2,7 @@
|
||||
#include "../inc/Device.h"
|
||||
|
||||
DEFINE_PIN_LEVEL_CHANGERS(POWER, Device);
|
||||
|
||||
bool EightBit::Device::operator==(const EightBit::Device& rhs) const {
|
||||
return POWER() == rhs.POWER();
|
||||
}
|
||||
|
||||
@@ -13,11 +13,16 @@ EightBit::IntelProcessor::IntelProcessor(Bus& bus)
|
||||
RaisedHALT.connect([this](EventArgs) noexcept { ++PC(); });
|
||||
|
||||
RaisedPOWER.connect([this](EventArgs) {
|
||||
PC() = SP() = AF() = BC() = DE() = HL() = Mask16;
|
||||
PC() = SP() = Mask16;
|
||||
resetWorkingRegisters();
|
||||
raiseHALT();
|
||||
});
|
||||
}
|
||||
|
||||
void EightBit::IntelProcessor::resetWorkingRegisters() {
|
||||
AF() = BC() = DE() = HL() = Mask16;
|
||||
}
|
||||
|
||||
DEFINE_PIN_LEVEL_CHANGERS(HALT, IntelProcessor);
|
||||
|
||||
void EightBit::IntelProcessor::handleRESET() {
|
||||
@@ -85,3 +90,15 @@ void EightBit::IntelProcessor::ret() {
|
||||
Processor::ret();
|
||||
MEMPTR() = PC();
|
||||
}
|
||||
|
||||
bool EightBit::IntelProcessor::operator==(const EightBit::IntelProcessor& rhs) const {
|
||||
return
|
||||
Processor::operator==(rhs)
|
||||
&& HALT() == rhs.HALT()
|
||||
&& MEMPTR() == rhs.MEMPTR()
|
||||
&& SP() == rhs.SP()
|
||||
&& AF() == rhs.AF()
|
||||
&& BC() == rhs.BC()
|
||||
&& DE() == rhs.DE()
|
||||
&& HL() == rhs.HL();
|
||||
}
|
||||
|
||||
@@ -98,3 +98,11 @@ void EightBit::Processor::call(const register16_t destination) {
|
||||
void EightBit::Processor::ret() {
|
||||
jump(popWord());
|
||||
}
|
||||
|
||||
bool EightBit::Processor::operator==(const EightBit::Processor& rhs) const {
|
||||
return
|
||||
ClockedChip::operator==(rhs)
|
||||
&& RESET() == rhs.RESET()
|
||||
&& INT() == rhs.INT()
|
||||
&& PC() == rhs.PC();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
bool EightBit::Rom::operator==(const Rom& rhs) const {
|
||||
return BYTES() == rhs.BYTES();
|
||||
}
|
||||
|
||||
int EightBit::Rom::load(std::ifstream& file, std::vector<uint8_t>& output, const int writeOffset, const int readOffset, int limit, const int maximumSize) {
|
||||
|
||||
file.seekg(0, std::ios::end);
|
||||
|
||||
Reference in New Issue
Block a user