mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-12 19:30:10 +00:00
GSL was too problematic when used with GCC. Removed.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
67c27d4a3e
commit
c513f0cab1
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
||||
[submodule "libraries/GSL"]
|
||||
path = libraries/GSL
|
||||
url = https://github.com/Microsoft/GSL.git
|
@ -71,16 +71,16 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
@ -71,19 +71,19 @@
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
@ -71,19 +71,19 @@
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
|
@ -3,8 +3,6 @@
|
||||
#include <cstdint>
|
||||
#include <array>
|
||||
|
||||
#include <gsl/gsl>
|
||||
|
||||
namespace EightBit {
|
||||
|
||||
class Ram;
|
||||
@ -13,7 +11,7 @@ namespace EightBit {
|
||||
class CharacterDefinition {
|
||||
public:
|
||||
CharacterDefinition() = default;
|
||||
CharacterDefinition(gsl::not_null<Ram*> ram, uint16_t address);
|
||||
CharacterDefinition(Ram* ram, uint16_t address);
|
||||
|
||||
std::array<int, 8> get(int row) const;
|
||||
|
||||
|
@ -4,8 +4,6 @@
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
#include <gsl/gsl>
|
||||
|
||||
#include "ObjectAttribute.h"
|
||||
|
||||
namespace EightBit {
|
||||
@ -29,7 +27,7 @@ namespace EightBit {
|
||||
RasterHeight = 144,
|
||||
};
|
||||
|
||||
Display(const gsl::not_null<AbstractColourPalette*> colours, Bus& bus, Ram& oam, Ram& vram);
|
||||
Display(const AbstractColourPalette* colours, Bus& bus, Ram& oam, Ram& vram);
|
||||
|
||||
const std::vector<uint32_t>& pixels() const;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <Ram.h>
|
||||
|
||||
EightBit::GameBoy::CharacterDefinition::CharacterDefinition(gsl::not_null<Ram*> ram, uint16_t address)
|
||||
EightBit::GameBoy::CharacterDefinition::CharacterDefinition(Ram* ram, uint16_t address)
|
||||
: m_ram(ram),
|
||||
m_address(address) {
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <Processor.h>
|
||||
#include <vector>
|
||||
|
||||
EightBit::GameBoy::Display::Display(const gsl::not_null<AbstractColourPalette*> 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),
|
||||
|
@ -69,16 +69,16 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
@ -25,8 +25,6 @@
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include <gsl/gsl>
|
||||
|
||||
#include <Memory.h>
|
||||
#include <Processor.h>
|
||||
#include <IntelProcessor.h>
|
||||
|
@ -70,16 +70,16 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
|
@ -70,23 +70,23 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Libraries\boost_1_65_1\lib64-msvc-14.1;$(LibraryPath)</LibraryPath>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Libraries\boost_1_65_1\lib32-msvc-14.1;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Libraries\boost_1_65_1\lib64-msvc-14.1;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Libraries\boost_1_65_1\lib32-msvc-14.1;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -4,13 +4,12 @@
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <gsl/gsl>
|
||||
|
||||
#include <Bus.h>
|
||||
#include <InputOutput.h>
|
||||
#include <IntelProcessor.h>
|
||||
#include <Signal.h>
|
||||
#include <Register.h>
|
||||
#include <EightBitCompilerDefinitions.h>
|
||||
|
||||
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;
|
||||
|
@ -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<Z80>(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<Z80>(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;
|
||||
|
@ -70,16 +70,16 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
|
@ -70,16 +70,16 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>..\inc;..\..\inc;..\..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;C:\Libraries\boost_1_65_1;$(IncludePath)</IncludePath>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
27
inc/EightBitCompilerDefinitions.h
Normal file
27
inc/EightBitCompilerDefinitions.h
Normal file
@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
# include <intrin.h>
|
||||
|
||||
# define LIKELY(x) (x)
|
||||
# define UNLIKELY(x) (x)
|
||||
|
||||
# define EIGHTBIT_PARITY(x) (__popcnt(value) % 2)
|
||||
|
||||
# define UNREACHABLE __assume(0)
|
||||
|
||||
#elif definef(__GNUG__)
|
||||
|
||||
# include <x86intrin.h>
|
||||
|
||||
# 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
|
@ -7,15 +7,7 @@
|
||||
#include "Processor.h"
|
||||
#include "Register.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#define EIGHT_BIT_INTELPROCESSOR_PARITY(x) (__popcnt(value) % 2)
|
||||
#elif definef(__GNUG__)
|
||||
#include <x86intrin.h>
|
||||
#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<class T> 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<class T> static void adjustSZ(uint8_t& f, uint8_t value) {
|
||||
|
@ -2,12 +2,10 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <gsl/gsl>
|
||||
|
||||
#include "Bus.h"
|
||||
#include "Register.h"
|
||||
|
||||
#define UNREACHABLE GSL_ASSUME(0)
|
||||
#include "EightBitCompilerDefinitions.h"
|
||||
|
||||
namespace EightBit {
|
||||
class Processor {
|
||||
|
@ -1 +0,0 @@
|
||||
Subproject commit 1c95f9436eae69c9b9315911ef6aa210df7d1e31
|
@ -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);
|
||||
}
|
@ -70,16 +70,16 @@
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>..\inc;..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>..\inc;..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>..\inc;..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>..\inc;..\libraries\GSL\include;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;C:\Libraries\boost_1_65_1;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
@ -151,6 +151,7 @@
|
||||
<ClInclude Include="..\inc\Rom.h" />
|
||||
<ClInclude Include="..\inc\Signal.h" />
|
||||
<ClInclude Include="..\inc\TestHarness.h" />
|
||||
<ClInclude Include="EightBitCompilerDefinitions.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -47,6 +47,9 @@
|
||||
<ClInclude Include="..\inc\Register.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EightBitCompilerDefinitions.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="stdafx.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;
|
||||
}
|
||||
|
@ -19,5 +19,3 @@
|
||||
#else
|
||||
#include <x86intrin.h>
|
||||
#endif
|
||||
|
||||
#include <gsl/gsl>
|
Loading…
Reference in New Issue
Block a user