mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-03-06 06:30:14 +00:00
More linux fixes.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
44ff68d6f3
commit
d2c3efac83
@ -14,8 +14,8 @@ namespace EightBit {
|
||||
Dark
|
||||
};
|
||||
|
||||
AbstractColourPalette::AbstractColourPalette()
|
||||
: m_colours(4) {
|
||||
AbstractColourPalette()
|
||||
: m_colours(4) {
|
||||
}
|
||||
|
||||
uint32_t getColour(size_t index) const {
|
||||
|
@ -3,15 +3,13 @@
|
||||
|
||||
// based on http://www.z80.info/decoding.htm
|
||||
|
||||
#pragma region Reset and initialisation
|
||||
|
||||
EightBit::GameBoy::LR35902::LR35902(Bus& memory)
|
||||
: IntelProcessor(memory),
|
||||
m_bus(memory),
|
||||
m_enabledLCD(false),
|
||||
m_ime(false),
|
||||
m_stopped(false),
|
||||
m_prefixCB(false) {
|
||||
: IntelProcessor(memory),
|
||||
m_bus(memory),
|
||||
m_enabledLCD(false),
|
||||
m_ime(false),
|
||||
m_stopped(false),
|
||||
m_prefixCB(false) {
|
||||
}
|
||||
|
||||
void EightBit::GameBoy::LR35902::reset() {
|
||||
@ -21,10 +19,6 @@ void EightBit::GameBoy::LR35902::reset() {
|
||||
m_prefixCB = false;
|
||||
}
|
||||
|
||||
#pragma endregion Reset and initialisation
|
||||
|
||||
#pragma region Interrupt routines
|
||||
|
||||
void EightBit::GameBoy::LR35902::di() {
|
||||
IME() = false;
|
||||
}
|
||||
@ -39,10 +33,6 @@ int EightBit::GameBoy::LR35902::interrupt(uint8_t value) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
#pragma endregion Interrupt routines
|
||||
|
||||
#pragma region Flag manipulation helpers
|
||||
|
||||
void EightBit::GameBoy::LR35902::increment(uint8_t& f, uint8_t& operand) {
|
||||
clearFlag(f, NF);
|
||||
adjustZero<LR35902>(f, ++operand);
|
||||
@ -55,10 +45,6 @@ void EightBit::GameBoy::LR35902::decrement(uint8_t& f, uint8_t& operand) {
|
||||
adjustZero<LR35902>(f, --operand);
|
||||
}
|
||||
|
||||
#pragma endregion Flag manipulation helpers
|
||||
|
||||
#pragma region PC manipulation: call/ret/jp/jr
|
||||
|
||||
bool EightBit::GameBoy::LR35902::jrConditionalFlag(uint8_t& f, int flag) {
|
||||
switch (flag) {
|
||||
case 0: // NZ
|
||||
@ -128,10 +114,6 @@ bool EightBit::GameBoy::LR35902::callConditionalFlag(uint8_t& f, int flag) {
|
||||
throw std::logic_error("Unhandled CALL conditional");
|
||||
}
|
||||
|
||||
#pragma endregion PC manipulation: call/ret/jp/jr
|
||||
|
||||
#pragma region 16-bit arithmetic
|
||||
|
||||
void EightBit::GameBoy::LR35902::add(uint8_t& f, register16_t& operand, register16_t value) {
|
||||
|
||||
MEMPTR() = operand;
|
||||
@ -145,10 +127,6 @@ void EightBit::GameBoy::LR35902::add(uint8_t& f, register16_t& operand, register
|
||||
adjustHalfCarryAdd(f, MEMPTR().high, value.high, operand.high);
|
||||
}
|
||||
|
||||
#pragma endregion 16-bit arithmetic
|
||||
|
||||
#pragma region ALU
|
||||
|
||||
void EightBit::GameBoy::LR35902::add(uint8_t& f, uint8_t& operand, uint8_t value, int carry) {
|
||||
|
||||
register16_t result;
|
||||
@ -205,10 +183,6 @@ void EightBit::GameBoy::LR35902::compare(uint8_t& f, uint8_t check, uint8_t valu
|
||||
subtract(f, check, value);
|
||||
}
|
||||
|
||||
#pragma endregion ALU
|
||||
|
||||
#pragma region Shift and rotate
|
||||
|
||||
uint8_t EightBit::GameBoy::LR35902::rlc(uint8_t& f, uint8_t operand) {
|
||||
clearFlag(f, NF | HC | ZF);
|
||||
setFlag(f, CF, operand & Bit7);
|
||||
@ -258,10 +232,6 @@ uint8_t EightBit::GameBoy::LR35902::srl(uint8_t& f, uint8_t operand) {
|
||||
return (operand >> 1) & ~Bit7;
|
||||
}
|
||||
|
||||
#pragma endregion Shift and rotate
|
||||
|
||||
#pragma region BIT/SET/RES
|
||||
|
||||
uint8_t EightBit::GameBoy::LR35902::bit(uint8_t& f, int n, uint8_t operand) {
|
||||
auto carry = f & CF;
|
||||
uint8_t discarded = operand;
|
||||
@ -278,10 +248,6 @@ uint8_t EightBit::GameBoy::LR35902::set(int n, uint8_t operand) {
|
||||
return operand | (1 << n);
|
||||
}
|
||||
|
||||
#pragma endregion BIT/SET/RES
|
||||
|
||||
#pragma region Miscellaneous instructions
|
||||
|
||||
void EightBit::GameBoy::LR35902::daa(uint8_t& a, uint8_t& f) {
|
||||
|
||||
int updated = a;
|
||||
@ -320,10 +286,6 @@ void EightBit::GameBoy::LR35902::ccf(uint8_t& a, uint8_t& f) {
|
||||
clearFlag(f, CF, f & CF);
|
||||
}
|
||||
|
||||
#pragma endregion Miscellaneous instructions
|
||||
|
||||
#pragma region Controlled instruction execution
|
||||
|
||||
int EightBit::GameBoy::LR35902::runRasterLines() {
|
||||
m_enabledLCD = !!(m_bus.peekRegister(Bus::LCDC) & Bus::LcdEnable);
|
||||
m_bus.resetLY();
|
||||
@ -478,10 +440,6 @@ int EightBit::GameBoy::LR35902::step() {
|
||||
return ran;
|
||||
}
|
||||
|
||||
#pragma endregion Controlled instruction execution
|
||||
|
||||
#pragma region Instruction decode and execution
|
||||
|
||||
int EightBit::GameBoy::LR35902::execute(uint8_t opcode) {
|
||||
|
||||
const auto& decoded = getDecodedOpcode(opcode);
|
||||
@ -975,5 +933,3 @@ void EightBit::GameBoy::LR35902::executeOther(int x, int y, int z, int p, int q)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma endregion Instruction decode and execution
|
||||
|
@ -29,3 +29,9 @@
|
||||
#include <Processor.h>
|
||||
#include <IntelProcessor.h>
|
||||
#include <Signal.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#else
|
||||
#include <x86intrin.h>
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user