mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-23 15:29:24 +00:00
Try to avoid so many virtual calls in the Z80 by hanging onto AF a little longer.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
0a2873c40d
commit
3bd01e211e
@ -302,9 +302,9 @@ namespace EightBit {
|
||||
|
||||
static void subtract(uint8_t& f, uint8_t& operand, uint8_t value, int carry = 0);
|
||||
|
||||
void executeCB(int x, int y, int z);
|
||||
void executeED(int x, int y, int z, int p, int q);
|
||||
void executeOther(int x, int y, int z, int p, int q);
|
||||
void executeCB(uint8_t& a, uint8_t& f, int x, int y, int z);
|
||||
void executeED(uint8_t& a, uint8_t& f, int x, int y, int z, int p, int q);
|
||||
void executeOther(uint8_t& a, uint8_t& f, int x, int y, int z, int p, int q);
|
||||
|
||||
static void increment(uint8_t& f, uint8_t& operand);
|
||||
static void decrement(uint8_t& f, uint8_t& operand);
|
||||
|
@ -710,14 +710,18 @@ int EightBit::Z80::execute(const uint8_t opcode) {
|
||||
const auto p = decoded.p;
|
||||
const auto q = decoded.q;
|
||||
|
||||
auto& af = AF();
|
||||
auto& a = af.high;
|
||||
auto& f = af.low;
|
||||
|
||||
auto prefixed = m_prefixCB || m_prefixED;
|
||||
if (LIKELY(!prefixed)) {
|
||||
executeOther(x, y, z, p, q);
|
||||
executeOther(a, f, x, y, z, p, q);
|
||||
} else {
|
||||
if (m_prefixCB)
|
||||
executeCB(x, y, z);
|
||||
executeCB(a, f, x, y, z);
|
||||
else if (m_prefixED)
|
||||
executeED(x, y, z, p, q);
|
||||
executeED(a, f, x, y, z, p, q);
|
||||
else
|
||||
UNREACHABLE;
|
||||
}
|
||||
@ -728,9 +732,7 @@ int EightBit::Z80::execute(const uint8_t opcode) {
|
||||
return cycles();
|
||||
}
|
||||
|
||||
void EightBit::Z80::executeCB(const int x, const int y, const int z) {
|
||||
auto& a = A();
|
||||
auto& f = F();
|
||||
void EightBit::Z80::executeCB(uint8_t& a, uint8_t& f, const int x, const int y, const int z) {
|
||||
switch (x) {
|
||||
case 0: { // rot[y] r[z]
|
||||
auto operand = LIKELY(!m_displaced) ? R(z, a) : getByte(displacedAddress());
|
||||
@ -824,9 +826,7 @@ void EightBit::Z80::executeCB(const int x, const int y, const int z) {
|
||||
}
|
||||
}
|
||||
|
||||
void EightBit::Z80::executeED(const int x, const int y, const int z, const int p, const int q) {
|
||||
auto& a = A();
|
||||
auto& f = F();
|
||||
void EightBit::Z80::executeED(uint8_t& a, uint8_t& f, const int x, const int y, const int z, const int p, const int q) {
|
||||
switch (x) {
|
||||
case 0:
|
||||
case 3: // Invalid instruction, equivalent to NONI followed by NOP
|
||||
@ -1060,9 +1060,7 @@ void EightBit::Z80::executeED(const int x, const int y, const int z, const int p
|
||||
}
|
||||
}
|
||||
|
||||
void EightBit::Z80::executeOther(const int x, const int y, const int z, const int p, const int q) {
|
||||
auto& a = A();
|
||||
auto& f = F();
|
||||
void EightBit::Z80::executeOther(uint8_t& a, uint8_t& f, const int x, const int y, const int z, const int p, const int q) {
|
||||
switch (x) {
|
||||
case 0:
|
||||
switch (z) {
|
||||
|
Loading…
Reference in New Issue
Block a user