More small tidyups in the core emulator set.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2018-03-12 01:22:28 +00:00
parent bebc68539b
commit dac58b121a
4 changed files with 18 additions and 16 deletions

View File

@ -68,7 +68,7 @@ namespace EightBit {
default:
UNREACHABLE;
}
throw std::logic_error("Unhandled registry mechanism");
UNREACHABLE;
}
void R(int r, uint8_t& a, uint8_t value) {
@ -100,6 +100,7 @@ namespace EightBit {
default:
UNREACHABLE;
}
UNREACHABLE;
}
register16_t& RP(int rp) {
@ -115,6 +116,7 @@ namespace EightBit {
default:
UNREACHABLE;
}
UNREACHABLE;
}
register16_t& RP2(int rp) {
@ -130,6 +132,7 @@ namespace EightBit {
default:
UNREACHABLE;
}
UNREACHABLE;
}
static void adjustAuxiliaryCarryAdd(uint8_t& f, uint8_t before, uint8_t value, int calculation) {

View File

@ -68,7 +68,7 @@ bool EightBit::Intel8080::jumpConditionalFlag(uint8_t& f, int flag) {
default:
UNREACHABLE;
}
throw std::logic_error("Unhandled JP conditional");
UNREACHABLE;
}
bool EightBit::Intel8080::returnConditionalFlag(uint8_t& f, int flag) {
@ -92,7 +92,7 @@ bool EightBit::Intel8080::returnConditionalFlag(uint8_t& f, int flag) {
default:
UNREACHABLE;
}
throw std::logic_error("Unhandled RET conditional");
UNREACHABLE;
}
bool EightBit::Intel8080::callConditionalFlag(uint8_t& f, int flag) {
@ -116,7 +116,7 @@ bool EightBit::Intel8080::callConditionalFlag(uint8_t& f, int flag) {
default:
UNREACHABLE;
}
throw std::logic_error("Unhandled CALL conditional");
UNREACHABLE;
}
void EightBit::Intel8080::add(uint8_t& f, register16_t& operand, register16_t value) {
@ -234,7 +234,7 @@ void EightBit::Intel8080::xhtl(register16_t& operand) {
MEMPTR().low = BUS().read(SP());
BUS().write(operand.low);
operand.low = MEMPTR().low;
BUS().ADDRESS().word++;
++BUS().ADDRESS().word;
MEMPTR().high = BUS().read();
BUS().write(operand.high);
operand.high = MEMPTR().high;

View File

@ -53,7 +53,7 @@ void EightBit::MOS6502::reset() {
EightBit::register16_t EightBit::MOS6502::getWordPaged(uint8_t page, uint8_t offset) {
EightBit::register16_t returned;
returned.low = getBytePaged(page, offset);
BUS().ADDRESS().low++;
++BUS().ADDRESS().low;
returned.high = BUS().read();
return returned;
}
@ -78,7 +78,7 @@ void EightBit::MOS6502::interrupt(uint8_t vector) {
PC() = getWordPaged(0xff, vector);
}
int EightBit::MOS6502::execute(uint8_t cell) {
int EightBit::MOS6502::execute(uint8_t cell) {
switch (cell) {
@ -498,7 +498,7 @@ void EightBit::MOS6502::Branch(int8_t displacement) {
void EightBit::MOS6502::Branch(bool flag) {
const int8_t displacement = AM_Immediate();
if (flag)
if (UNLIKELY(flag))
Branch(displacement);
}
@ -516,7 +516,7 @@ void EightBit::MOS6502::PLP() {
void EightBit::MOS6502::JSR_abs() {
Address_Absolute();
PC().word--;
--PC().word;
call();
}
@ -527,7 +527,7 @@ void EightBit::MOS6502::RTI() {
void EightBit::MOS6502::RTS() {
ret();
PC().word++;
++PC().word;
}
void EightBit::MOS6502::JMP_abs() {
@ -541,7 +541,7 @@ void EightBit::MOS6502::JMP_ind() {
}
void EightBit::MOS6502::BRK() {
PC().word++;
++PC().word;
pushWord(PC());
PHP();
setFlag(P(), IF);

View File

@ -434,9 +434,8 @@ void EightBit::Z80::daa(uint8_t& a, uint8_t& f) {
}
f = (f & (CF | NF)) | (a > 0x99 ? CF : 0) | ((a ^ updated) & HC);
a = updated;
adjustSZPXY<Z80>(f, a);
adjustSZPXY<Z80>(f, a = updated);
}
void EightBit::Z80::cpl(uint8_t& a, uint8_t& f) {
@ -1123,7 +1122,7 @@ void EightBit::Z80::executeOther(uint8_t& a, uint8_t& f, const int x, const int
case 5:
case 6:
case 7:
if (jrConditionalFlag(f, y - 4))
if (UNLIKELY(jrConditionalFlag(f, y - 4)))
addCycles(5);
addCycles(5);
break;
@ -1364,7 +1363,7 @@ void EightBit::Z80::executeOther(uint8_t& a, uint8_t& f, const int x, const int
case 3:
switch (z) {
case 0: // Conditional return
if (returnConditionalFlag(f, y))
if (UNLIKELY(returnConditionalFlag(f, y)))
addCycles(6);
addCycles(5);
break;
@ -1447,7 +1446,7 @@ void EightBit::Z80::executeOther(uint8_t& a, uint8_t& f, const int x, const int
}
break;
case 4: // Conditional call: CALL cc[y], nn
if (callConditionalFlag(f, y))
if (UNLIKELY(callConditionalFlag(f, y)))
addCycles(7);
addCycles(10);
break;