diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 268bc14..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "libraries/GSL"]
- path = libraries/GSL
- url = https://github.com/Microsoft/GSL.git
diff --git a/Intel8080/src/Intel8080.vcxproj b/Intel8080/src/Intel8080.vcxproj
index f292fb1..983105f 100644
--- a/Intel8080/src/Intel8080.vcxproj
+++ b/Intel8080/src/Intel8080.vcxproj
@@ -71,16 +71,16 @@
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
diff --git a/Intel8080/test/test_Intel8080.vcxproj b/Intel8080/test/test_Intel8080.vcxproj
index f2d443d..e680ec5 100644
--- a/Intel8080/test/test_Intel8080.vcxproj
+++ b/Intel8080/test/test_Intel8080.vcxproj
@@ -71,19 +71,19 @@
true
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
true
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
false
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
false
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
diff --git a/LR35902/fusetest_LR35902/fusetest_LR35902.vcxproj b/LR35902/fusetest_LR35902/fusetest_LR35902.vcxproj
index ffc6bc4..4209175 100644
--- a/LR35902/fusetest_LR35902/fusetest_LR35902.vcxproj
+++ b/LR35902/fusetest_LR35902/fusetest_LR35902.vcxproj
@@ -71,19 +71,19 @@
false
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
true
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
true
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
false
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
diff --git a/LR35902/inc/CharacterDefinition.h b/LR35902/inc/CharacterDefinition.h
index 773aa3e..1580c74 100644
--- a/LR35902/inc/CharacterDefinition.h
+++ b/LR35902/inc/CharacterDefinition.h
@@ -3,8 +3,6 @@
#include
#include
-#include
-
namespace EightBit {
class Ram;
@@ -13,7 +11,7 @@ namespace EightBit {
class CharacterDefinition {
public:
CharacterDefinition() = default;
- CharacterDefinition(gsl::not_null ram, uint16_t address);
+ CharacterDefinition(Ram* ram, uint16_t address);
std::array get(int row) const;
diff --git a/LR35902/inc/Display.h b/LR35902/inc/Display.h
index a18ff8a..03966bc 100644
--- a/LR35902/inc/Display.h
+++ b/LR35902/inc/Display.h
@@ -4,8 +4,6 @@
#include
#include
-#include
-
#include "ObjectAttribute.h"
namespace EightBit {
@@ -29,7 +27,7 @@ namespace EightBit {
RasterHeight = 144,
};
- Display(const gsl::not_null colours, Bus& bus, Ram& oam, Ram& vram);
+ Display(const AbstractColourPalette* colours, Bus& bus, Ram& oam, Ram& vram);
const std::vector& pixels() const;
diff --git a/LR35902/src/CharacterDefinition.cpp b/LR35902/src/CharacterDefinition.cpp
index 6cce9c8..cf885a5 100644
--- a/LR35902/src/CharacterDefinition.cpp
+++ b/LR35902/src/CharacterDefinition.cpp
@@ -3,7 +3,7 @@
#include
-EightBit::GameBoy::CharacterDefinition::CharacterDefinition(gsl::not_null ram, uint16_t address)
+EightBit::GameBoy::CharacterDefinition::CharacterDefinition(Ram* ram, uint16_t address)
: m_ram(ram),
m_address(address) {
}
diff --git a/LR35902/src/Display.cpp b/LR35902/src/Display.cpp
index 0a1e883..7489a65 100644
--- a/LR35902/src/Display.cpp
+++ b/LR35902/src/Display.cpp
@@ -8,7 +8,7 @@
#include
#include
-EightBit::GameBoy::Display::Display(const gsl::not_null colours, Bus& bus, Ram& oam, Ram& vram)
+EightBit::GameBoy::Display::Display(const AbstractColourPalette* colours, Bus& bus, Ram& oam, Ram& vram)
: m_bus(bus),
m_oam(oam),
m_vram(vram),
diff --git a/LR35902/src/LR35902.vcxproj b/LR35902/src/LR35902.vcxproj
index ed2cc18..9858969 100644
--- a/LR35902/src/LR35902.vcxproj
+++ b/LR35902/src/LR35902.vcxproj
@@ -69,16 +69,16 @@
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
diff --git a/LR35902/src/stdafx.h b/LR35902/src/stdafx.h
index 84f6838..3aa34e4 100644
--- a/LR35902/src/stdafx.h
+++ b/LR35902/src/stdafx.h
@@ -25,8 +25,6 @@
#include
-#include
-
#include
#include
#include
diff --git a/M6502/src/M6502.vcxproj b/M6502/src/M6502.vcxproj
index 7551194..83357f0 100644
--- a/M6502/src/M6502.vcxproj
+++ b/M6502/src/M6502.vcxproj
@@ -70,16 +70,16 @@
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
diff --git a/M6502/test_M6502/test_M6502.vcxproj b/M6502/test_M6502/test_M6502.vcxproj
index b6ae222..54e9394 100644
--- a/M6502/test_M6502/test_M6502.vcxproj
+++ b/M6502/test_M6502/test_M6502.vcxproj
@@ -70,23 +70,23 @@
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
C:\Libraries\boost_1_65_1\lib64-msvc-14.1;$(LibraryPath)
false
true
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
C:\Libraries\boost_1_65_1\lib32-msvc-14.1;$(LibraryPath)
true
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
C:\Libraries\boost_1_65_1\lib64-msvc-14.1;$(LibraryPath)
false
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
C:\Libraries\boost_1_65_1\lib32-msvc-14.1;$(LibraryPath)
diff --git a/Z80/inc/Z80.h b/Z80/inc/Z80.h
index a41aa3e..241bdc2 100644
--- a/Z80/inc/Z80.h
+++ b/Z80/inc/Z80.h
@@ -4,13 +4,12 @@
#include
#include
-#include
-
#include
#include
#include
#include
#include
+#include
namespace EightBit {
class Z80 : public IntelProcessor {
@@ -149,7 +148,7 @@ namespace EightBit {
case 5:
return HL2().low;
case 6:
- return getByte(GSL_LIKELY(!m_displaced) ? HL().word : displacedAddress());
+ return getByte(LIKELY(!m_displaced) ? HL().word : displacedAddress());
case 7:
return a;
default:
@@ -179,7 +178,7 @@ namespace EightBit {
HL2().low = value;
break;
case 6:
- setByte(GSL_LIKELY(!m_displaced) ? HL().word : displacedAddress(), value);
+ setByte(LIKELY(!m_displaced) ? HL().word : displacedAddress(), value);
break;
case 7:
a = value;
diff --git a/Z80/src/Z80.cpp b/Z80/src/Z80.cpp
index c66d8fb..a85149f 100644
--- a/Z80/src/Z80.cpp
+++ b/Z80/src/Z80.cpp
@@ -521,7 +521,7 @@ bool EightBit::Z80::cpir(const uint8_t a, uint8_t& f) {
cpi(a, f);
MEMPTR() = PC();
const auto again = (f & PF) && !(f & ZF); // See CPI
- if (GSL_LIKELY(again))
+ if (LIKELY(again))
MEMPTR().word--;
return again;
}
@@ -530,7 +530,7 @@ bool EightBit::Z80::cpdr(const uint8_t a, uint8_t& f) {
cpd(a, f);
MEMPTR().word = PC().word - 1;
const auto again = (f & PF) && !(f & ZF); // See CPD
- if (GSL_UNLIKELY(!again))
+ if (UNLIKELY(!again))
MEMPTR().word--;
return again;
}
@@ -560,7 +560,7 @@ void EightBit::Z80::ldi(const uint8_t a, uint8_t& f) {
bool EightBit::Z80::ldir(const uint8_t a, uint8_t& f) {
ldi(a, f);
const auto again = (f & PF) != 0;
- if (GSL_LIKELY(again)) // See LDI
+ if (LIKELY(again)) // See LDI
MEMPTR().word = PC().word - 1;
return again;
}
@@ -568,7 +568,7 @@ bool EightBit::Z80::ldir(const uint8_t a, uint8_t& f) {
bool EightBit::Z80::lddr(const uint8_t a, uint8_t& f) {
ldd(a, f);
const auto again = (f & PF) != 0;
- if (GSL_LIKELY(again)) // See LDR
+ if (LIKELY(again)) // See LDR
MEMPTR().word = PC().word - 1;
return again;
}
@@ -690,7 +690,7 @@ int EightBit::Z80::step() {
int EightBit::Z80::execute(const uint8_t opcode) {
- if (GSL_UNLIKELY(!M1()))
+ if (UNLIKELY(!M1()))
throw std::logic_error("M1 cannot be high");
if (!(m_prefixCB && m_displaced)) {
@@ -708,7 +708,7 @@ int EightBit::Z80::execute(const uint8_t opcode) {
const auto q = decoded.q;
auto prefixed = m_prefixCB || m_prefixED;
- if (GSL_LIKELY(!prefixed)) {
+ if (LIKELY(!prefixed)) {
executeOther(x, y, z, p, q);
} else {
if (m_prefixCB)
@@ -719,7 +719,7 @@ int EightBit::Z80::execute(const uint8_t opcode) {
UNREACHABLE;
}
- if (GSL_UNLIKELY(cycles() == 0))
+ if (UNLIKELY(cycles() == 0))
throw std::logic_error("Unhandled opcode");
return cycles();
@@ -730,7 +730,7 @@ void EightBit::Z80::executeCB(const int x, const int y, const int z) {
auto& f = F();
switch (x) {
case 0: { // rot[y] r[z]
- auto operand = GSL_LIKELY(!m_displaced) ? R(z, a) : getByte(displacedAddress());
+ auto operand = LIKELY(!m_displaced) ? R(z, a) : getByte(displacedAddress());
switch (y) {
case 0:
operand = rlc(f, operand);
@@ -760,7 +760,7 @@ void EightBit::Z80::executeCB(const int x, const int y, const int z) {
UNREACHABLE;
}
adjustSZP(f, operand);
- if (GSL_LIKELY(!m_displaced)) {
+ if (LIKELY(!m_displaced)) {
R(z, a, operand);
if (z == 6)
addCycles(7);
@@ -774,7 +774,7 @@ void EightBit::Z80::executeCB(const int x, const int y, const int z) {
break;
} case 1: // BIT y, r[z]
addCycles(8);
- if (GSL_LIKELY(!m_displaced)) {
+ if (LIKELY(!m_displaced)) {
const auto operand = bit(f, y, R(z, a));
if (z == 6) {
adjustXY(f, MEMPTR().high);
@@ -790,7 +790,7 @@ void EightBit::Z80::executeCB(const int x, const int y, const int z) {
break;
case 2: // RES y, r[z]
addCycles(8);
- if (GSL_LIKELY(!m_displaced)) {
+ if (LIKELY(!m_displaced)) {
R(z, a, res(y, R(z, a)));
if (z == 6)
addCycles(7);
@@ -804,7 +804,7 @@ void EightBit::Z80::executeCB(const int x, const int y, const int z) {
break;
case 3: // SET y, r[z]
addCycles(8);
- if (GSL_LIKELY(!m_displaced)) {
+ if (LIKELY(!m_displaced)) {
R(z, a, set(y, R(z, a)));
if (z == 6)
addCycles(7);
@@ -972,13 +972,13 @@ void EightBit::Z80::executeED(const int x, const int y, const int z, const int p
ldd(a, f);
break;
case 6: // LDIR
- if (GSL_LIKELY(ldir(a, f))) {
+ if (LIKELY(ldir(a, f))) {
PC().word -= 2;
addCycles(5);
}
break;
case 7: // LDDR
- if (GSL_LIKELY(lddr(a, f))) {
+ if (LIKELY(lddr(a, f))) {
PC().word -= 2;
addCycles(5);
}
@@ -994,13 +994,13 @@ void EightBit::Z80::executeED(const int x, const int y, const int z, const int p
cpd(a, f);
break;
case 6: // CPIR
- if (GSL_LIKELY(cpir(a, f))) {
+ if (LIKELY(cpir(a, f))) {
PC().word -= 2;
addCycles(5);
}
break;
case 7: // CPDR
- if (GSL_LIKELY(cpdr(a, f))) {
+ if (LIKELY(cpdr(a, f))) {
PC().word -= 2;
addCycles(5);
}
@@ -1016,13 +1016,13 @@ void EightBit::Z80::executeED(const int x, const int y, const int z, const int p
ind(f);
break;
case 6: // INIR
- if (GSL_LIKELY(inir(f))) {
+ if (LIKELY(inir(f))) {
PC().word -= 2;
addCycles(5);
}
break;
case 7: // INDR
- if (GSL_LIKELY(indr(f))) {
+ if (LIKELY(indr(f))) {
PC().word -= 2;
addCycles(5);
}
@@ -1038,13 +1038,13 @@ void EightBit::Z80::executeED(const int x, const int y, const int z, const int p
outd(f);
break;
case 6: // OTIR
- if (GSL_LIKELY(otir(f))) {
+ if (LIKELY(otir(f))) {
PC().word -= 2;
addCycles(5);
}
break;
case 7: // OTDR
- if (GSL_LIKELY(otdr(f))) {
+ if (LIKELY(otdr(f))) {
PC().word -= 2;
addCycles(5);
}
@@ -1185,7 +1185,7 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in
addCycles(6);
break;
case 4: { // 8-bit INC
- if (GSL_UNLIKELY(m_displaced && (y == 6)))
+ if (UNLIKELY(m_displaced && (y == 6)))
fetchDisplacement();
auto operand = R(y, a);
increment(f, operand);
@@ -1193,7 +1193,7 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in
addCycles(4);
break;
} case 5: { // 8-bit DEC
- if (GSL_UNLIKELY(m_displaced && (y == 6)))
+ if (UNLIKELY(m_displaced && (y == 6)))
fetchDisplacement();
auto operand = R(y, a);
decrement(f, operand);
@@ -1203,7 +1203,7 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in
addCycles(7);
break;
} case 6: // 8-bit load immediate
- if (GSL_UNLIKELY(m_displaced && (y == 6)))
+ if (LIKELY(m_displaced && (y == 6)))
fetchDisplacement();
R(y, a, fetchByte()); // LD r,n
addCycles(7);
@@ -1246,11 +1246,11 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in
}
break;
case 1: // 8-bit loading
- if (GSL_UNLIKELY(z == 6 && y == 6)) { // Exception (replaces LD (HL), (HL))
+ if (LIKELY(z == 6 && y == 6)) { // Exception (replaces LD (HL), (HL))
halt();
} else {
bool normal = true;
- if (GSL_UNLIKELY(m_displaced)) {
+ if (LIKELY(m_displaced)) {
if (z == 6) {
fetchDisplacement();
switch (y) {
@@ -1286,7 +1286,7 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in
addCycles(4);
break;
case 2: // Operate on accumulator and register/memory location
- if (GSL_UNLIKELY(m_displaced && (z == 6)))
+ if (LIKELY(m_displaced && (z == 6)))
fetchDisplacement();
switch (y) {
case 0: // ADD A,r
@@ -1372,7 +1372,7 @@ void EightBit::Z80::executeOther(const int x, const int y, const int z, const in
break;
case 1: // CB prefix
m_prefixCB = true;
- if (GSL_UNLIKELY(m_displaced))
+ if (LIKELY(m_displaced))
fetchDisplacement();
fetchExecute();
break;
diff --git a/Z80/src/Z80.vcxproj b/Z80/src/Z80.vcxproj
index 620de38..56ed5df 100644
--- a/Z80/src/Z80.vcxproj
+++ b/Z80/src/Z80.vcxproj
@@ -70,16 +70,16 @@
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
diff --git a/Z80/test/test_Z80.vcxproj b/Z80/test/test_Z80.vcxproj
index 971b44b..a7ed645 100644
--- a/Z80/test/test_Z80.vcxproj
+++ b/Z80/test/test_Z80.vcxproj
@@ -70,16 +70,16 @@
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
- ..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)
+ ..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)
false
diff --git a/inc/EightBitCompilerDefinitions.h b/inc/EightBitCompilerDefinitions.h
new file mode 100644
index 0000000..82b7de0
--- /dev/null
+++ b/inc/EightBitCompilerDefinitions.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#ifdef _MSC_VER
+
+# include
+
+# define LIKELY(x) (x)
+# define UNLIKELY(x) (x)
+
+# define EIGHTBIT_PARITY(x) (__popcnt(value) % 2)
+
+# define UNREACHABLE __assume(0)
+
+#elif definef(__GNUG__)
+
+# include
+
+# define LIKELY(x) __builtin_expect(!!(x), 1)
+# define UNLIKELY(x) __builtin_expect(!!(x), 0)
+
+# define EIGHTBIT_PARITY(x) __builtin_parity(value)
+
+# define UNREACHABLE __builtin_unreachable();
+
+#else
+# error Unknown compiler
+#endif
diff --git a/inc/IntelProcessor.h b/inc/IntelProcessor.h
index fc09a78..8f60ae9 100644
--- a/inc/IntelProcessor.h
+++ b/inc/IntelProcessor.h
@@ -7,15 +7,7 @@
#include "Processor.h"
#include "Register.h"
-#ifdef _MSC_VER
-#include
-#define EIGHT_BIT_INTELPROCESSOR_PARITY(x) (__popcnt(value) % 2)
-#elif definef(__GNUG__)
-#include
-#define EIGHT_BIT_INTELPROCESSOR_PARITY(x) __builtin_parity(value)
-#else
-#error No parity macro defined
-#endif
+#include "EightBitCompilerDefinitions.h"
namespace EightBit {
class IntelProcessor : public Processor
@@ -79,7 +71,7 @@ namespace EightBit {
}
template static void adjustParity(uint8_t& f, uint8_t value) {
- clearFlag(f, T::PF, EIGHT_BIT_INTELPROCESSOR_PARITY(value));
+ clearFlag(f, T::PF, EIGHTBIT_PARITY(value));
}
template static void adjustSZ(uint8_t& f, uint8_t value) {
diff --git a/inc/Processor.h b/inc/Processor.h
index ba33c20..7d1ad35 100644
--- a/inc/Processor.h
+++ b/inc/Processor.h
@@ -2,12 +2,10 @@
#include
-#include
-
#include "Bus.h"
#include "Register.h"
-#define UNREACHABLE GSL_ASSUME(0)
+#include "EightBitCompilerDefinitions.h"
namespace EightBit {
class Processor {
diff --git a/libraries/GSL b/libraries/GSL
deleted file mode 160000
index 1c95f94..0000000
--- a/libraries/GSL
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 1c95f9436eae69c9b9315911ef6aa210df7d1e31
diff --git a/src/Bus.cpp b/src/Bus.cpp
index 2b6d758..2080d58 100644
--- a/src/Bus.cpp
+++ b/src/Bus.cpp
@@ -1,6 +1,8 @@
#include "stdafx.h"
#include "Bus.h"
+#include "EightBitCompilerDefinitions.h"
+
EightBit::register16_t& EightBit::Bus::ADDRESS() {
return m_address;
}
@@ -70,5 +72,5 @@ void EightBit::Bus::write(register16_t address, uint8_t value) {
uint8_t& EightBit::Bus::reference() {
bool rom;
auto& value = reference(ADDRESS().word, rom);
- return GSL_LIKELY(!rom) ? referenceDATA(value) : placeDATA(value);
+ return LIKELY(!rom) ? referenceDATA(value) : placeDATA(value);
}
\ No newline at end of file
diff --git a/src/EightBit.vcxproj b/src/EightBit.vcxproj
index 19b1909..40dd2ba 100644
--- a/src/EightBit.vcxproj
+++ b/src/EightBit.vcxproj
@@ -70,16 +70,16 @@
- ..\inc;..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)
+ ..\inc;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)
- ..\inc;..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)
+ ..\inc;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)
- ..\inc;..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)
+ ..\inc;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)
- ..\inc;..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)
+ ..\inc;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)
@@ -151,6 +151,7 @@
+
diff --git a/src/EightBit.vcxproj.filters b/src/EightBit.vcxproj.filters
index 3bf4ad6..a39bbf3 100644
--- a/src/EightBit.vcxproj.filters
+++ b/src/EightBit.vcxproj.filters
@@ -47,6 +47,9 @@
Header Files
+
+ Header Files
+
diff --git a/src/Processor.cpp b/src/Processor.cpp
index e723887..be1c117 100644
--- a/src/Processor.cpp
+++ b/src/Processor.cpp
@@ -15,7 +15,7 @@ void EightBit::Processor::initialise() {
int EightBit::Processor::run(int limit) {
int current = 0;
- while (GSL_LIKELY(powered()) && current < limit) {
+ while (LIKELY(powered()) && current < limit) {
current += singleStep();
}
return current;
@@ -35,7 +35,7 @@ void EightBit::Processor::fetchWord(register16_t& output) {
}
int EightBit::Processor::fetchExecute() {
- if (GSL_LIKELY(powered()))
+ if (LIKELY(powered()))
return execute(fetchByte());
return 0;
}
diff --git a/src/stdafx.h b/src/stdafx.h
index 473fc16..31d6609 100644
--- a/src/stdafx.h
+++ b/src/stdafx.h
@@ -19,5 +19,3 @@
#else
#include
#endif
-
-#include
\ No newline at end of file