mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-27 13:34:27 +00:00
Slightly nicer refactoring of the MEMPTR post increment saga
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
b3faae34ae
commit
fc7b6e49ca
@ -600,8 +600,7 @@ bool EightBit::Z80::otdr() {
|
||||
}
|
||||
|
||||
void EightBit::Z80::rrd() {
|
||||
MEMPTR() = BUS().ADDRESS() = HL();
|
||||
++MEMPTR();
|
||||
(MEMPTR() = BUS().ADDRESS() = HL())++;
|
||||
const auto memory = BUS().read();
|
||||
BUS().write(promoteNibble(A()) | highNibble(memory));
|
||||
A() = higherNibble(A()) | lowerNibble(memory);
|
||||
@ -610,8 +609,7 @@ void EightBit::Z80::rrd() {
|
||||
}
|
||||
|
||||
void EightBit::Z80::rld() {
|
||||
MEMPTR() = BUS().ADDRESS() = HL();
|
||||
++MEMPTR();
|
||||
(MEMPTR() = BUS().ADDRESS() = HL())++;
|
||||
const auto memory = BUS().read();
|
||||
BUS().write(promoteNibble(memory) | lowNibble(A()));
|
||||
A() = higherNibble(A()) | highNibble(memory);
|
||||
@ -815,8 +813,7 @@ void EightBit::Z80::executeED(const int x, const int y, const int z, const int p
|
||||
case 1:
|
||||
switch (z) {
|
||||
case 0: // Input from port with 16-bit address
|
||||
MEMPTR() = BUS().ADDRESS() = BC();
|
||||
++MEMPTR();
|
||||
(MEMPTR() = BUS().ADDRESS() = BC())++;
|
||||
readPort();
|
||||
if (LIKELY(y != 6)) // IN r[y],(C)
|
||||
R(y, BUS().DATA());
|
||||
@ -825,8 +822,7 @@ void EightBit::Z80::executeED(const int x, const int y, const int z, const int p
|
||||
addCycles(12);
|
||||
break;
|
||||
case 1: // Output to port with 16-bit address
|
||||
MEMPTR() = BUS().ADDRESS() = BC();
|
||||
++MEMPTR();
|
||||
(MEMPTR() = BUS().ADDRESS() = BC())++;
|
||||
if (UNLIKELY(y == 6)) // OUT (C),0
|
||||
BUS().DATA() = 0;
|
||||
else // OUT (C),r[y]
|
||||
@ -1106,15 +1102,13 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in
|
||||
case 0:
|
||||
switch (p) {
|
||||
case 0: // LD (BC),A
|
||||
MEMPTR() = BUS().ADDRESS() = BC();
|
||||
++MEMPTR();
|
||||
(MEMPTR() = BUS().ADDRESS() = BC())++;
|
||||
MEMPTR().high = BUS().DATA() = A();
|
||||
BUS().write();
|
||||
addCycles(7);
|
||||
break;
|
||||
case 1: // LD (DE),A
|
||||
MEMPTR() = BUS().ADDRESS() = DE();
|
||||
++MEMPTR();
|
||||
(MEMPTR() = BUS().ADDRESS() = DE())++;
|
||||
MEMPTR().high = BUS().DATA() = A();
|
||||
BUS().write();
|
||||
addCycles(7);
|
||||
@ -1125,8 +1119,7 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in
|
||||
addCycles(16);
|
||||
break;
|
||||
case 3: // LD (nn),A
|
||||
MEMPTR() = BUS().ADDRESS() = fetchWord();
|
||||
++MEMPTR();
|
||||
(MEMPTR() = BUS().ADDRESS() = fetchWord())++;
|
||||
MEMPTR().high = BUS().DATA() = A();
|
||||
BUS().write();
|
||||
addCycles(13);
|
||||
@ -1138,14 +1131,12 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in
|
||||
case 1:
|
||||
switch (p) {
|
||||
case 0: // LD A,(BC)
|
||||
MEMPTR() = BUS().ADDRESS() = BC();
|
||||
++MEMPTR();
|
||||
(MEMPTR() = BUS().ADDRESS() = BC())++;
|
||||
A() = BUS().read();
|
||||
addCycles(7);
|
||||
break;
|
||||
case 1: // LD A,(DE)
|
||||
MEMPTR() = BUS().ADDRESS() = DE();
|
||||
++MEMPTR();
|
||||
(MEMPTR() = BUS().ADDRESS() = DE())++;
|
||||
A() = BUS().read();
|
||||
addCycles(7);
|
||||
break;
|
||||
@ -1155,8 +1146,7 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in
|
||||
addCycles(16);
|
||||
break;
|
||||
case 3: // LD A,(nn)
|
||||
MEMPTR() = BUS().ADDRESS() = fetchWord();
|
||||
++MEMPTR();
|
||||
(MEMPTR() = BUS().ADDRESS() = fetchWord())++;
|
||||
A() = BUS().read();
|
||||
addCycles(13);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user