Closer to c# code

This commit is contained in:
Adrian Conlon committed 2026-05-27 20:27:04 +01:00
1 parent f28cfd9faf
commit 34e834f753
6 files changed
+21 -33

No files matched your search

+1 -1
View File
@@ -120,7 +120,7 @@ namespace EightBit {
void memoryUpdate(int ticks = 1) noexcept;
void memoryWrite() noexcept final;
uint8_t memoryRead() noexcept final;
void memoryRead() noexcept final;
void refreshMemory() noexcept;
void jumpRelative(int8_t offset) noexcept final;
+8 -19
View File
@@ -23,6 +23,9 @@ EightBit::Z80::Z80(Bus& bus, InputOutput& ports) noexcept
IX() = IY() = Mask16;
// One of the register sets has been initialised
// (by the IntelProcessor base class)
// so now lets initialise the other register set.
exx();
exxAF();
@@ -169,7 +172,7 @@ void EightBit::Z80::refreshMemory() noexcept {
raiseRFSH();
}
uint8_t EightBit::Z80::memoryRead() noexcept {
void EightBit::Z80::memoryRead() noexcept {
ReadingMemory.fire();
tick();
lowerMREQ();
@@ -182,7 +185,6 @@ uint8_t EightBit::Z80::memoryRead() noexcept {
refreshMemory();
tick();
ReadMemory.fire();
return BUS().DATA();
}
void EightBit::Z80::handleRESET() noexcept {
@@ -423,9 +425,8 @@ void EightBit::Z80::add(const register16_t value, int carry) noexcept {
}
void EightBit::Z80::xhtl(register16_t& exchange) noexcept {
MEMPTR().low = IntelProcessor::memoryRead(SP());
++BUS().ADDRESS();
MEMPTR().high = memoryRead();
BUS().ADDRESS() = SP();
getInto(MEMPTR());
BUS().DATA() = exchange.high;
exchange.high = MEMPTR().high;
memoryUpdate(2);
@@ -905,19 +906,6 @@ uint8_t EightBit::Z80::fetchInstruction() noexcept {
return data;
}
//void EightBit::Z80::loadAccumulatorIndirect(addresser_t addresser) noexcept {
// MEMPTR() = BUS().ADDRESS() = addresser();
// ++MEMPTR();
// A() = memoryRead();
//}
//
//void EightBit::Z80::storeAccumulatorIndirect(addresser_t addresser) noexcept {
// MEMPTR() = BUS().ADDRESS() = addresser();
// ++MEMPTR();
// MEMPTR().high = BUS().DATA() = A();
// memoryWrite();
//}
void EightBit::Z80::readInternalRegister(reader_t reader) noexcept {
adjustSZXY(A() = reader());
clearBit(NF | HC);
@@ -1092,7 +1080,8 @@ void EightBit::Z80::executeCB(const int x, const int y, const int z) noexcept {
if (displaced()) {
tick(2);
displaceAddress();
operand = memoryRead();
memoryRead();
operand = BUS().DATA();
} else {
operand = R(z);
}
+1 -1
View File
@@ -33,7 +33,7 @@ namespace EightBit {
void poke(const uint16_t address, const uint8_t value) noexcept { reference(address) = value; }
void poke(const register16_t address, const uint8_t value) noexcept { poke(address.joined, value); }
[[nodiscard]] uint8_t read() noexcept;
void read() noexcept;
void write() noexcept;
virtual void raisePOWER() noexcept;
+3 -3
View File
@@ -66,9 +66,9 @@ namespace EightBit {
virtual void memoryWrite() noexcept;
void busWrite() noexcept;
uint8_t memoryRead(register16_t address) noexcept;
virtual uint8_t memoryRead() noexcept;
uint8_t busRead() noexcept;
void memoryRead(register16_t address) noexcept;
virtual void memoryRead() noexcept;
void busRead() noexcept;
virtual register16_t& incrementPC() noexcept;
+2 -3
View File
@@ -8,11 +8,10 @@ void EightBit::Bus::raisePOWER() noexcept {}
void EightBit::Bus::lowerPOWER() noexcept {}
uint8_t EightBit::Bus::read() noexcept {
void EightBit::Bus::read() noexcept {
ReadingByte.fire();
const auto returned = DATA() = reference();
DATA() = reference();
ReadByte.fire();
return returned;
}
void EightBit::Bus::write() noexcept {
+6 -6
View File
@@ -49,17 +49,17 @@ void EightBit::Processor::busWrite() noexcept {
BUS().write();
}
uint8_t EightBit::Processor::memoryRead(const register16_t address) noexcept {
void EightBit::Processor::memoryRead(const register16_t address) noexcept {
BUS().ADDRESS() = address;
return memoryRead();
memoryRead();
}
uint8_t EightBit::Processor::memoryRead() noexcept {
return busRead();
void EightBit::Processor::memoryRead() noexcept {
busRead();
}
uint8_t EightBit::Processor::busRead() noexcept {
return BUS().read();
void EightBit::Processor::busRead() noexcept {
BUS().read();
}
void EightBit::Processor::getShortPaged(register16_t address) noexcept {