Tidy up instruction timing for the PUL/PSH instructions on the 6809

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2018-08-22 08:45:38 +01:00
parent 117f03cbd1
commit 6f6e88f003

View File

@ -719,77 +719,141 @@ uint8_t EightBit::mc6809::orr(uint8_t operand, uint8_t data) {
} }
void EightBit::mc6809::pshs(uint8_t data) { void EightBit::mc6809::pshs(uint8_t data) {
if (data & Bit7) if (data & Bit7) {
addCycles(2);
pushWordS(PC()); pushWordS(PC());
if (data & Bit6) }
if (data & Bit6) {
addCycles(2);
pushWordS(U()); pushWordS(U());
if (data & Bit5) }
if (data & Bit5) {
addCycles(2);
pushWordS(Y()); pushWordS(Y());
if (data & Bit4) }
if (data & Bit4) {
addCycles(2);
pushWordS(X()); pushWordS(X());
if (data & Bit3) }
if (data & Bit3) {
addCycle();
pushS(DP()); pushS(DP());
if (data & Bit2) }
if (data & Bit2) {
addCycle();
pushS(B()); pushS(B());
if (data & Bit1) }
if (data & Bit1) {
addCycle();
pushS(A()); pushS(A());
if (data & Bit0) }
if (data & Bit0) {
addCycle();
pushS(CC()); pushS(CC());
}
} }
void EightBit::mc6809::pshu(uint8_t data) { void EightBit::mc6809::pshu(uint8_t data) {
if (data & Bit7) if (data & Bit7) {
addCycles(2);
pushWordU(PC()); pushWordU(PC());
if (data & Bit6) }
if (data & Bit6) {
addCycles(2);
pushWordU(S()); pushWordU(S());
if (data & Bit5) }
if (data & Bit5) {
addCycles(2);
pushWordU(Y()); pushWordU(Y());
if (data & Bit4) }
if (data & Bit4) {
addCycles(2);
pushWordU(X()); pushWordU(X());
if (data & Bit3) }
if (data & Bit3) {
addCycle();
pushU(DP()); pushU(DP());
if (data & Bit2) }
if (data & Bit2) {
addCycle();
pushU(B()); pushU(B());
if (data & Bit1) }
if (data & Bit1) {
addCycle();
pushU(A()); pushU(A());
if (data & Bit0) }
if (data & Bit0) {
addCycle();
pushU(CC()); pushU(CC());
}
} }
void EightBit::mc6809::puls(uint8_t data) { void EightBit::mc6809::puls(uint8_t data) {
if (data & Bit0) if (data & Bit0) {
addCycle();
CC() = popS(); CC() = popS();
if (data & Bit1) }
if (data & Bit1) {
addCycle();
A() = popS(); A() = popS();
if (data & Bit2) }
if (data & Bit2) {
addCycle();
B() = popS(); B() = popS();
if (data & Bit3) }
if (data & Bit3) {
addCycle();
DP() = popS(); DP() = popS();
if (data & Bit4) }
if (data & Bit4) {
addCycles(2);
X() = popWordS(); X() = popWordS();
if (data & Bit5) }
if (data & Bit5) {
addCycles(2);
Y() = popWordS(); Y() = popWordS();
if (data & Bit6) }
if (data & Bit6) {
addCycles(2);
U() = popWordS(); U() = popWordS();
if (data & Bit7) }
if (data & Bit7) {
addCycles(2);
PC() = popWordS(); PC() = popWordS();
}
} }
void EightBit::mc6809::pulu(uint8_t data) { void EightBit::mc6809::pulu(uint8_t data) {
if (data & Bit0) if (data & Bit0) {
addCycle();
CC() = popU(); CC() = popU();
if (data & Bit1) }
if (data & Bit1) {
addCycle();
A() = popU(); A() = popU();
if (data & Bit2) }
if (data & Bit2) {
addCycle();
B() = popU(); B() = popU();
if (data & Bit3) }
if (data & Bit3) {
addCycle();
DP() = popU(); DP() = popU();
if (data & Bit4) }
if (data & Bit4) {
addCycles(2);
X() = popWordU(); X() = popWordU();
if (data & Bit5) }
if (data & Bit5) {
addCycles(2);
Y() = popWordU(); Y() = popWordU();
if (data & Bit6) }
if (data & Bit6) {
addCycles(2);
S() = popWordU(); S() = popWordU();
if (data & Bit7) }
if (data & Bit7) {
addCycles(2);
PC() = popWordU(); PC() = popWordU();
}
} }