Linux compatibility changes

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2017-12-30 15:22:27 +00:00
parent 2683999e2c
commit 82fe35891d
3 changed files with 16 additions and 38 deletions

View File

@ -55,10 +55,6 @@ namespace EightBit {
return AM_10_x_dump(bbb) + "\t" + instruction + " " + AM_10_x(bbb);
}
#pragma region 6502 addressing modes
#pragma region References
std::string AM_Immediate_dump() const {
return dump_Byte(m_address + 1);
}
@ -131,10 +127,6 @@ namespace EightBit {
return "($" + dump_Byte(m_address + 1) + "),Y";
}
#pragma endregion References
#pragma region 6502 addressing mode switching
std::string AM_00_dump(int bbb) const {
switch (bbb) {
case 0b000:
@ -311,10 +303,6 @@ namespace EightBit {
}
}
#pragma endregion 6502 addressing mode switching
#pragma endregion 6502 addressing modes
static void dump(std::ostream& out, int value, int width);
uint8_t getByte(uint16_t address) const;

View File

@ -80,9 +80,7 @@ namespace EightBit {
virtual void push(uint8_t value) final;
virtual uint8_t pop() final;
#pragma region 6502 addressing modes
#pragma region Addresses
// Address resolution
void Address_Absolute() {
fetchWord();
@ -139,9 +137,7 @@ namespace EightBit {
return MEMPTR().high != page;
}
#pragma endregion Addresses
#pragma region Addressing modes, read
// Addressing modes, read
uint8_t AM_A() {
return A();
@ -194,9 +190,7 @@ namespace EightBit {
return getByte(MEMPTR());
}
#pragma endregion Addressing modes, read
#pragma region Addressing modes, write
// Addressing modes, write
void AM_A(uint8_t value) {
A() = value;
@ -242,9 +236,7 @@ namespace EightBit {
setByte(MEMPTR(), value);
}
#pragma endregion Addressing modes, write
#pragma region 6502 addressing mode switching
// 6502 addressing mode switching
uint8_t AM_00(int bbb) {
switch (bbb) {
@ -263,7 +255,7 @@ namespace EightBit {
case 0b110:
throw std::domain_error("Illegal addressing mode");
default:
__assume(0);
UNREACHABLE;
}
}
@ -289,7 +281,7 @@ namespace EightBit {
case 0b110:
throw std::domain_error("Illegal addressing mode");
default:
__assume(0);
UNREACHABLE;
}
}
@ -312,7 +304,7 @@ namespace EightBit {
case 0b111:
return AM_AbsoluteX();
default:
__assume(0);
UNREACHABLE;
}
}
@ -343,7 +335,7 @@ namespace EightBit {
AM_AbsoluteX(value);
break;
default:
__assume(0);
UNREACHABLE;
}
}
@ -365,7 +357,7 @@ namespace EightBit {
case 0b110:
throw std::domain_error("Illegal addressing mode");
default:
__assume(0);
UNREACHABLE;
}
return 0xff;
}
@ -386,7 +378,7 @@ namespace EightBit {
case 0b110:
throw std::domain_error("Illegal addressing mode");
default:
__assume(0);
UNREACHABLE;
}
}
@ -408,7 +400,7 @@ namespace EightBit {
case 0b110:
throw std::domain_error("Illegal addressing mode");
default:
__assume(0);
UNREACHABLE;
}
}
@ -436,13 +428,11 @@ namespace EightBit {
case 0b110:
throw std::domain_error("Illegal addressing mode");
default:
__assume(0);
UNREACHABLE;
}
}
#pragma endregion 6502 addressing mode switching
#pragma endregion 6502 addressing modes
// Operations
void ASL(int bbb) {
auto operand = AM_10(bbb);

View File

@ -267,7 +267,7 @@ int EightBit::MOS6502::execute(uint8_t cell) {
SBC(AM_01(decoded.bbb));
break;
default:
__assume(0);
UNREACHABLE;
}
break;
case 0b10:
@ -327,13 +327,13 @@ int EightBit::MOS6502::execute(uint8_t cell) {
}
break;
default:
__assume(0);
UNREACHABLE;
}
break;
case 0b11:
throw std::domain_error("Illegal instruction group");
default:
__assume(0);
UNREACHABLE;
}
if (UNLIKELY(cycles() == 0))