mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-10 10:29:43 +00:00
Tidy up the 10 addressing mode write set to make it clearer when memory writes occur.
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
aa720c4c12
commit
99c2e2a719
@ -175,7 +175,7 @@ namespace EightBit {
|
||||
m_memory.ADDRESS() = MEMPTR();
|
||||
if (m_memory.ADDRESS().low == Mask8)
|
||||
++cycles;
|
||||
return m_memory.read();
|
||||
return getByte();
|
||||
}
|
||||
|
||||
uint8_t AM_AbsoluteY() {
|
||||
@ -183,7 +183,7 @@ namespace EightBit {
|
||||
m_memory.ADDRESS() = MEMPTR();
|
||||
if (m_memory.ADDRESS().low == Mask8)
|
||||
++cycles;
|
||||
return m_memory.read();
|
||||
return getByte();
|
||||
}
|
||||
|
||||
uint8_t AM_ZeroPageX() {
|
||||
@ -206,7 +206,7 @@ namespace EightBit {
|
||||
m_memory.ADDRESS() = MEMPTR();
|
||||
if (m_memory.ADDRESS().low == Mask8)
|
||||
++cycles;
|
||||
return m_memory.read();
|
||||
return getByte();
|
||||
}
|
||||
|
||||
#pragma endregion Addressing modes, read
|
||||
@ -385,26 +385,18 @@ namespace EightBit {
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
void AM_10(int bbb, uint8_t value, bool fetched = false) {
|
||||
void AM_10(int bbb, uint8_t value) {
|
||||
switch (bbb) {
|
||||
case 0b000:
|
||||
assert(false);
|
||||
break;
|
||||
case 0b001:
|
||||
fetched ? m_memory.write(MEMPTR(), value) : AM_ZeroPage(value);
|
||||
break;
|
||||
case 0b010:
|
||||
AM_A(value);
|
||||
break;
|
||||
case 0b001:
|
||||
case 0b011:
|
||||
fetched ? m_memory.write(MEMPTR(), value) : AM_Absolute(value);
|
||||
break;
|
||||
case 0b101:
|
||||
fetched ? m_memory.write(MEMPTR(), value) : AM_ZeroPageX(value);
|
||||
break;
|
||||
case 0b111:
|
||||
fetched ? m_memory.write(MEMPTR(), value) : AM_AbsoluteX(value);
|
||||
m_memory.write(MEMPTR(), value);
|
||||
break;
|
||||
case 0b000:
|
||||
case 0b100:
|
||||
case 0b110:
|
||||
throw std::domain_error("Illegal addressing mode");
|
||||
@ -470,37 +462,37 @@ namespace EightBit {
|
||||
void ASL(int bbb) {
|
||||
auto operand = AM_10(bbb);
|
||||
ASL(operand);
|
||||
AM_10(bbb, operand, true);
|
||||
AM_10(bbb, operand);
|
||||
}
|
||||
|
||||
void ROL(int bbb) {
|
||||
auto operand = AM_10(bbb);
|
||||
ROL(operand);
|
||||
AM_10(bbb, operand, true);
|
||||
AM_10(bbb, operand);
|
||||
}
|
||||
|
||||
void LSR(int bbb) {
|
||||
auto operand = AM_10(bbb);
|
||||
LSR(operand);
|
||||
AM_10(bbb, operand, true);
|
||||
AM_10(bbb, operand);
|
||||
}
|
||||
|
||||
void ROR(int bbb) {
|
||||
auto operand = AM_10(bbb);
|
||||
ROR(operand);
|
||||
AM_10(bbb, operand, true);
|
||||
AM_10(bbb, operand);
|
||||
}
|
||||
|
||||
void DEC(int bbb) {
|
||||
auto operand = AM_10(bbb);
|
||||
adjustNZ(--operand);
|
||||
AM_10(bbb, operand, true);
|
||||
AM_10(bbb, operand);
|
||||
}
|
||||
|
||||
void INC(int bbb) {
|
||||
auto operand = AM_10(bbb);
|
||||
adjustNZ(++operand);
|
||||
AM_10(bbb, operand, true);
|
||||
AM_10(bbb, operand);
|
||||
}
|
||||
|
||||
void ROR(uint8_t& output);
|
||||
|
Loading…
x
Reference in New Issue
Block a user