mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-02-06 20:30:01 +00:00
Lots of various changes suggested by the code analysis tools.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
555423d10a
commit
a673a64c3f
@ -54,14 +54,14 @@ namespace EightBit {
|
|||||||
auto& NMI() { return m_nmiLine; } // In
|
auto& NMI() { return m_nmiLine; } // In
|
||||||
auto& M1() { return m_m1Line; } // Out
|
auto& M1() { return m_m1Line; } // Out
|
||||||
|
|
||||||
virtual int execute(uint8_t opcode) final;
|
int execute(uint8_t opcode) final;
|
||||||
virtual int step() final;
|
int step() final;
|
||||||
virtual void powerOn() final;
|
void powerOn() final;
|
||||||
|
|
||||||
virtual register16_t& AF() final;
|
register16_t& AF() final;
|
||||||
virtual register16_t& BC() final;
|
register16_t& BC() final;
|
||||||
virtual register16_t& DE() final;
|
register16_t& DE() final;
|
||||||
virtual register16_t& HL() final;
|
register16_t& HL() final;
|
||||||
|
|
||||||
auto& IX() { return m_ix; }
|
auto& IX() { return m_ix; }
|
||||||
auto& IXH() { return IX().high; }
|
auto& IXH() { return IX().high; }
|
||||||
@ -86,8 +86,8 @@ namespace EightBit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void handleRESET() final;
|
void handleRESET() final;
|
||||||
virtual void handleINT() final;
|
void handleINT() final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PinLevel m_nmiLine = Low;
|
PinLevel m_nmiLine = Low;
|
||||||
@ -304,7 +304,7 @@ namespace EightBit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void adjustOverflowAdd(uint8_t& f, const int beforeNegative, const int valueNegative, const int afterNegative) {
|
static void adjustOverflowAdd(uint8_t& f, const int beforeNegative, const int valueNegative, const int afterNegative) {
|
||||||
auto overflow = (beforeNegative == valueNegative) && (beforeNegative != afterNegative);
|
const auto overflow = (beforeNegative == valueNegative) && (beforeNegative != afterNegative);
|
||||||
setFlag(f, VF, overflow);
|
setFlag(f, VF, overflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ namespace EightBit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void adjustOverflowSub(uint8_t& f, const int beforeNegative, const int valueNegative, const int afterNegative) {
|
static void adjustOverflowSub(uint8_t& f, const int beforeNegative, const int valueNegative, const int afterNegative) {
|
||||||
auto overflow = (beforeNegative != valueNegative) && (beforeNegative != afterNegative);
|
const auto overflow = (beforeNegative != valueNegative) && (beforeNegative != afterNegative);
|
||||||
setFlag(f, VF, overflow);
|
setFlag(f, VF, overflow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,22 +7,23 @@
|
|||||||
namespace EightBit {
|
namespace EightBit {
|
||||||
class BigEndianProcessor : public Processor {
|
class BigEndianProcessor : public Processor {
|
||||||
public:
|
public:
|
||||||
virtual register16_t peekWord(register16_t address) final;
|
~BigEndianProcessor() {};
|
||||||
virtual void pokeWord(register16_t address, register16_t value) final;
|
|
||||||
|
register16_t peekWord(register16_t address) final;
|
||||||
|
void pokeWord(register16_t address, register16_t value) final;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BigEndianProcessor(Bus& memory);
|
BigEndianProcessor(Bus& memory);
|
||||||
virtual ~BigEndianProcessor() = default;
|
|
||||||
|
|
||||||
virtual register16_t getWord() override;
|
register16_t getWord() override;
|
||||||
virtual void setWord(register16_t value) override;
|
void setWord(register16_t value) override;
|
||||||
|
|
||||||
virtual register16_t getWordPaged(uint8_t page, uint8_t offset) override;
|
register16_t getWordPaged(uint8_t page, uint8_t offset) override;
|
||||||
virtual void setWordPaged(uint8_t page, uint8_t offset, register16_t value) override;
|
void setWordPaged(uint8_t page, uint8_t offset, register16_t value) override;
|
||||||
|
|
||||||
virtual register16_t fetchWord() final;
|
register16_t fetchWord() final;
|
||||||
|
|
||||||
virtual void pushWord(register16_t value) final;
|
void pushWord(register16_t value) final;
|
||||||
virtual register16_t popWord() final;
|
register16_t popWord() final;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
19
inc/Chip.h
19
inc/Chip.h
@ -59,21 +59,23 @@ namespace EightBit {
|
|||||||
static void clearFlag(uint8_t& f, const int flag, const uint32_t condition) { clearFlag(f, flag, !!condition); }
|
static void clearFlag(uint8_t& f, const int flag, const uint32_t condition) { clearFlag(f, flag, !!condition); }
|
||||||
static void clearFlag(uint8_t& f, const int flag, const bool condition) { setFlag(f, flag, !condition); }
|
static void clearFlag(uint8_t& f, const int flag, const bool condition) { setFlag(f, flag, !condition); }
|
||||||
|
|
||||||
static auto raised(const PinLevel line) { return line == High; }
|
static constexpr auto raised(const PinLevel line) { return line == High; }
|
||||||
static void raise(PinLevel& line) { line = High; }
|
static void raise(PinLevel& line) { line = High; }
|
||||||
static auto lowered(const PinLevel line) { return line == Low; }
|
static constexpr auto lowered(const PinLevel line) { return line == Low; }
|
||||||
static void lower(PinLevel& line) { line = Low; }
|
static void lower(PinLevel& line) { line = Low; }
|
||||||
|
|
||||||
static void match(PinLevel& line, int value);
|
static void match(PinLevel& line, int value);
|
||||||
|
|
||||||
static auto highNibble(const int value) { return value >> 4; }
|
static constexpr auto highNibble(const int value) { return value >> 4; }
|
||||||
static auto lowNibble(const int value) { return value & Mask4; }
|
static constexpr auto lowNibble(const int value) { return value & Mask4; }
|
||||||
|
|
||||||
static auto higherNibble(const int value) { return value & 0xf0; }
|
static constexpr auto higherNibble(const int value) { return value & 0xf0; }
|
||||||
static auto lowerNibble(const int value) { return lowNibble(value); }
|
static constexpr auto lowerNibble(const int value) { return lowNibble(value); }
|
||||||
|
|
||||||
static auto promoteNibble(const int value) { return value << 4; }
|
static constexpr auto promoteNibble(const int value) { return value << 4; }
|
||||||
static auto demoteNibble(const int value) { return highNibble(value); }
|
static constexpr auto demoteNibble(const int value) { return highNibble(value); }
|
||||||
|
|
||||||
|
virtual ~Chip() {};
|
||||||
|
|
||||||
auto& POWER() { return m_powerLine; }
|
auto& POWER() { return m_powerLine; }
|
||||||
|
|
||||||
@ -83,7 +85,6 @@ namespace EightBit {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
Chip() = default;
|
Chip() = default;
|
||||||
virtual ~Chip() = default;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PinLevel m_powerLine = Low;
|
PinLevel m_powerLine = Low;
|
||||||
|
@ -12,7 +12,7 @@ namespace EightBit {
|
|||||||
int countBits(uint8_t value);
|
int countBits(uint8_t value);
|
||||||
bool oddParity(uint8_t value);
|
bool oddParity(uint8_t value);
|
||||||
int findFirstSet(int value);
|
int findFirstSet(int value);
|
||||||
void assume(int expression);
|
constexpr void assume(int expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int EightBit::countBits(const uint8_t value) {
|
inline int EightBit::countBits(const uint8_t value) {
|
||||||
@ -52,7 +52,7 @@ inline int EightBit::findFirstSet(const int value) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void EightBit::assume(const int expression) {
|
inline constexpr void EightBit::assume(const int expression) {
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
__assume(expression);
|
__assume(expression);
|
||||||
#elif defined(__GNUG__)
|
#elif defined(__GNUG__)
|
||||||
@ -72,7 +72,7 @@ inline void EightBit::assume(const int expression) {
|
|||||||
|
|
||||||
# define PARITY(x) EightBit::oddParity(x)
|
# define PARITY(x) EightBit::oddParity(x)
|
||||||
|
|
||||||
# define UNREACHABLE { ASSUME(0); throw new std::exception("unreachable"); }
|
# define UNREACHABLE { ASSUME(0); throw std::exception("unreachable"); }
|
||||||
|
|
||||||
#elif defined(__GNUG__)
|
#elif defined(__GNUG__)
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@ namespace EightBit {
|
|||||||
void write(const uint8_t port, const uint8_t value) { return writeOutputPort(port, value); }
|
void write(const uint8_t port, const uint8_t value) { return writeOutputPort(port, value); }
|
||||||
|
|
||||||
uint8_t readInputPort(uint8_t port);
|
uint8_t readInputPort(uint8_t port);
|
||||||
void writeInputPort(const uint8_t port, const uint8_t value) { m_input[port] = value; }
|
void writeInputPort(const uint8_t port, const uint8_t value) noexcept { m_input[port] = value; }
|
||||||
|
|
||||||
auto readOutputPort(const uint8_t port) { return m_output[port]; }
|
auto readOutputPort(const uint8_t port) noexcept { return m_output[port]; }
|
||||||
void writeOutputPort(uint8_t port, uint8_t value);
|
void writeOutputPort(uint8_t port, uint8_t value);
|
||||||
|
|
||||||
Signal<uint8_t> ReadingPort;
|
Signal<uint8_t> ReadingPort;
|
||||||
|
@ -10,8 +10,7 @@
|
|||||||
#include "EightBitCompilerDefinitions.h"
|
#include "EightBitCompilerDefinitions.h"
|
||||||
|
|
||||||
namespace EightBit {
|
namespace EightBit {
|
||||||
class IntelProcessor : public LittleEndianProcessor
|
class IntelProcessor : public LittleEndianProcessor {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
struct opcode_decoded_t {
|
struct opcode_decoded_t {
|
||||||
|
|
||||||
@ -21,7 +20,7 @@ namespace EightBit {
|
|||||||
int p = 0;
|
int p = 0;
|
||||||
int q = 0;
|
int q = 0;
|
||||||
|
|
||||||
opcode_decoded_t() noexcept {}
|
opcode_decoded_t() {}
|
||||||
|
|
||||||
opcode_decoded_t(const uint8_t opcode) {
|
opcode_decoded_t(const uint8_t opcode) {
|
||||||
x = (opcode & 0b11000000) >> 6; // 0 - 3
|
x = (opcode & 0b11000000) >> 6; // 0 - 3
|
||||||
@ -32,6 +31,8 @@ namespace EightBit {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
~IntelProcessor() = default;
|
||||||
|
|
||||||
const auto& getDecodedOpcode(const size_t i) const {
|
const auto& getDecodedOpcode(const size_t i) const {
|
||||||
return m_decodedOpcodes[i];
|
return m_decodedOpcodes[i];
|
||||||
}
|
}
|
||||||
@ -56,11 +57,10 @@ namespace EightBit {
|
|||||||
auto& H() { return HL().high; }
|
auto& H() { return HL().high; }
|
||||||
auto& L() { return HL().low; }
|
auto& L() { return HL().low; }
|
||||||
|
|
||||||
virtual void powerOn() override;
|
void powerOn() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
IntelProcessor(Bus& bus);
|
IntelProcessor(Bus& bus);
|
||||||
virtual ~IntelProcessor() = default;
|
|
||||||
|
|
||||||
template<class T> static void adjustSign(uint8_t& f, const uint8_t value) {
|
template<class T> static void adjustSign(uint8_t& f, const uint8_t value) {
|
||||||
setFlag(f, T::SF, value & T::SF);
|
setFlag(f, T::SF, value & T::SF);
|
||||||
@ -101,7 +101,7 @@ namespace EightBit {
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
static auto buildHalfCarryIndex(const uint8_t before, const uint8_t value, const int calculation) {
|
static constexpr auto buildHalfCarryIndex(const uint8_t before, const uint8_t value, const int calculation) {
|
||||||
return ((before & 0x88) >> 1) | ((value & 0x88) >> 2) | ((calculation & 0x88) >> 3);
|
return ((before & 0x88) >> 1) | ((value & 0x88) >> 2) | ((calculation & 0x88) >> 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,13 +117,13 @@ namespace EightBit {
|
|||||||
return m_halfCarryTableSub[index & Mask3];
|
return m_halfCarryTableSub[index & Mask3];
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void push(uint8_t value) final;
|
void push(uint8_t value) final;
|
||||||
virtual uint8_t pop() final;
|
uint8_t pop() final;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
virtual register16_t getWord() final;
|
register16_t getWord() final;
|
||||||
virtual void setWord(register16_t value) final;
|
void setWord(register16_t value) final;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ namespace EightBit {
|
|||||||
return !!condition;
|
return !!condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void ret() final;
|
void ret() final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::array<opcode_decoded_t, 0x100> m_decodedOpcodes;
|
std::array<opcode_decoded_t, 0x100> m_decodedOpcodes;
|
||||||
|
@ -7,22 +7,23 @@
|
|||||||
namespace EightBit {
|
namespace EightBit {
|
||||||
class LittleEndianProcessor : public Processor {
|
class LittleEndianProcessor : public Processor {
|
||||||
public:
|
public:
|
||||||
virtual register16_t peekWord(register16_t address) final;
|
~LittleEndianProcessor() = default;
|
||||||
virtual void pokeWord(register16_t address, register16_t value) final;
|
|
||||||
|
register16_t peekWord(register16_t address) final;
|
||||||
|
void pokeWord(register16_t address, register16_t value) final;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LittleEndianProcessor(Bus& memory);
|
LittleEndianProcessor(Bus& memory);
|
||||||
virtual ~LittleEndianProcessor() = default;
|
|
||||||
|
|
||||||
virtual register16_t getWord() override;
|
register16_t getWord() override;
|
||||||
virtual void setWord(register16_t value) override;
|
void setWord(register16_t value) override;
|
||||||
|
|
||||||
virtual register16_t getWordPaged(uint8_t page, uint8_t offset) override;
|
register16_t getWordPaged(uint8_t page, uint8_t offset) override;
|
||||||
virtual void setWordPaged(uint8_t page, uint8_t offset, register16_t value) override;
|
void setWordPaged(uint8_t page, uint8_t offset, register16_t value) override;
|
||||||
|
|
||||||
virtual register16_t fetchWord() final;
|
register16_t fetchWord() final;
|
||||||
|
|
||||||
virtual void pushWord(register16_t value) final;
|
void pushWord(register16_t value) final;
|
||||||
virtual register16_t popWord() final;
|
register16_t popWord() final;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ namespace EightBit {
|
|||||||
// x: sign extend this b-bit number to r
|
// x: sign extend this b-bit number to r
|
||||||
static int8_t signExtend(int b, uint8_t x);
|
static int8_t signExtend(int b, uint8_t x);
|
||||||
|
|
||||||
|
~Processor() {};
|
||||||
|
|
||||||
auto& PC() { return m_pc; }
|
auto& PC() { return m_pc; }
|
||||||
|
|
||||||
auto& RESET() { return m_resetLine; }
|
auto& RESET() { return m_resetLine; }
|
||||||
@ -22,7 +24,7 @@ namespace EightBit {
|
|||||||
auto& INT() { return m_intLine; }
|
auto& INT() { return m_intLine; }
|
||||||
auto& IRQ() { return INT(); } // Synonym
|
auto& IRQ() { return INT(); } // Synonym
|
||||||
|
|
||||||
virtual void powerOn() override;
|
void powerOn() override;
|
||||||
void reset() { lower(RESET()); }
|
void reset() { lower(RESET()); }
|
||||||
|
|
||||||
int run(int limit);
|
int run(int limit);
|
||||||
@ -36,7 +38,6 @@ namespace EightBit {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
Processor(Bus& memory);
|
Processor(Bus& memory);
|
||||||
virtual ~Processor() = default;
|
|
||||||
|
|
||||||
auto& BUS() { return m_bus; }
|
auto& BUS() { return m_bus; }
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ namespace EightBit {
|
|||||||
public:
|
public:
|
||||||
Ram(size_t size = 0) noexcept;
|
Ram(size_t size = 0) noexcept;
|
||||||
|
|
||||||
virtual uint8_t& reference(uint16_t address) final;
|
uint8_t& reference(uint16_t address) final;
|
||||||
virtual void poke(uint16_t address, uint8_t value) final;
|
void poke(uint16_t address, uint8_t value) final;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
14
inc/Rom.h
14
inc/Rom.h
@ -19,20 +19,20 @@ namespace EightBit {
|
|||||||
const auto& BYTES() const { return m_bytes; }
|
const auto& BYTES() const { return m_bytes; }
|
||||||
auto& BYTES() { return m_bytes; }
|
auto& BYTES() { return m_bytes; }
|
||||||
|
|
||||||
virtual void poke(uint16_t address, uint8_t value) override;
|
void poke(uint16_t address, uint8_t value) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int load(std::ifstream& file, std::vector<uint8_t>& output, int writeOffset = 0, int readOffset = 0, int limit = -1, int maximumSize = -1);
|
static int load(std::ifstream& file, std::vector<uint8_t>& output, int writeOffset = 0, int readOffset = 0, int limit = -1, int maximumSize = -1);
|
||||||
static int load(const std::string& path, std::vector<uint8_t>& output, int writeOffset = 0, int readOffset = 0, int limit = -1, int maximumSize = -1);
|
static int load(const std::string& path, std::vector<uint8_t>& output, int writeOffset = 0, int readOffset = 0, int limit = -1, int maximumSize = -1);
|
||||||
|
|
||||||
Rom(size_t size = 0) noexcept;
|
Rom(size_t size = 0);
|
||||||
|
|
||||||
virtual size_t size() const final;
|
size_t size() const final;
|
||||||
|
|
||||||
virtual int load(std::ifstream& file, int writeOffset = 0, int readOffset = 0, int limit = -1) final;
|
int load(std::ifstream& file, int writeOffset = 0, int readOffset = 0, int limit = -1) final;
|
||||||
virtual int load(const std::string& path, int writeOffset = 0, int readOffset = 0, int limit = -1) final;
|
int load(const std::string& path, int writeOffset = 0, int readOffset = 0, int limit = -1) final;
|
||||||
virtual int load(const std::vector<uint8_t>& bytes, int writeOffset = 0, int readOffset = 0, int limit = -1) final;
|
int load(const std::vector<uint8_t>& bytes, int writeOffset = 0, int readOffset = 0, int limit = -1) final;
|
||||||
|
|
||||||
virtual uint8_t peek(uint16_t address) const final;
|
uint8_t peek(uint16_t address) const final;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -14,17 +14,17 @@ namespace EightBit {
|
|||||||
class UnusedMemory final : public Memory {
|
class UnusedMemory final : public Memory {
|
||||||
public:
|
public:
|
||||||
UnusedMemory(size_t size, uint8_t value);
|
UnusedMemory(size_t size, uint8_t value);
|
||||||
virtual ~UnusedMemory() = default;
|
~UnusedMemory() {};
|
||||||
|
|
||||||
virtual size_t size() const final;
|
size_t size() const final;
|
||||||
virtual uint8_t peek(uint16_t address) const final;
|
uint8_t peek(uint16_t address) const final;
|
||||||
|
|
||||||
virtual int load(std::ifstream& file, int writeOffset = 0, int readOffset = 0, int limit = -1) final;
|
int load(std::ifstream& file, int writeOffset = 0, int readOffset = 0, int limit = -1) final;
|
||||||
virtual int load(const std::string& path, int writeOffset = 0, int readOffset = 0, int limit = -1) final;
|
int load(const std::string& path, int writeOffset = 0, int readOffset = 0, int limit = -1) final;
|
||||||
virtual int load(const std::vector<uint8_t>& bytes, int writeOffset = 0, int readOffset = 0, int limit = -1) final;
|
int load(const std::vector<uint8_t>& bytes, int writeOffset = 0, int readOffset = 0, int limit = -1) final;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void poke(uint16_t address, uint8_t value) final;
|
void poke(uint16_t address, uint8_t value) final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t m_size;
|
size_t m_size;
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
uint8_t& EightBit::Memory::reference(uint16_t) {
|
uint8_t& EightBit::Memory::reference(uint16_t) {
|
||||||
throw new std::logic_error("Reference operation not allowed.");
|
throw std::logic_error("Reference operation not allowed.");
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ void EightBit::Rom::poke(const uint16_t address, const uint8_t value) {
|
|||||||
BYTES()[address] = value;
|
BYTES()[address] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
EightBit::Rom::Rom(const size_t size) noexcept
|
EightBit::Rom::Rom(const size_t size)
|
||||||
: m_bytes(size) {}
|
: m_bytes(size) {}
|
||||||
|
|
||||||
size_t EightBit::Rom::size() const {
|
size_t EightBit::Rom::size() const {
|
||||||
@ -49,18 +49,18 @@ size_t EightBit::Rom::size() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int EightBit::Rom::load(std::ifstream& file, const int writeOffset, const int readOffset, const int limit) {
|
int EightBit::Rom::load(std::ifstream& file, const int writeOffset, const int readOffset, const int limit) {
|
||||||
const auto maximumSize = (int)size() - writeOffset;
|
const auto maximumSize = size() - writeOffset;
|
||||||
return load(file, m_bytes, writeOffset, readOffset, limit, maximumSize);
|
return load(file, m_bytes, writeOffset, readOffset, limit, maximumSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EightBit::Rom::load(const std::string& path, const int writeOffset, const int readOffset, const int limit) {
|
int EightBit::Rom::load(const std::string& path, const int writeOffset, const int readOffset, const int limit) {
|
||||||
const auto maximumSize = (int)size() - writeOffset;
|
const auto maximumSize = size() - writeOffset;
|
||||||
return load(path, m_bytes, writeOffset, readOffset, limit, maximumSize);
|
return load(path, m_bytes, writeOffset, readOffset, limit, maximumSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EightBit::Rom::load(const std::vector<uint8_t>& bytes, const int writeOffset, const int readOffset, int limit) {
|
int EightBit::Rom::load(const std::vector<uint8_t>& bytes, const int writeOffset, const int readOffset, int limit) {
|
||||||
if (limit < 0)
|
if (limit < 0)
|
||||||
limit = (int)bytes.size() - readOffset;
|
limit = bytes.size() - readOffset;
|
||||||
std::copy(bytes.cbegin() + readOffset, bytes.cbegin() + limit, m_bytes.begin() + writeOffset);
|
std::copy(bytes.cbegin() + readOffset, bytes.cbegin() + limit, m_bytes.begin() + writeOffset);
|
||||||
return limit;
|
return limit;
|
||||||
}
|
}
|
||||||
|
@ -13,17 +13,17 @@ uint8_t EightBit::UnusedMemory::peek(uint16_t) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int EightBit::UnusedMemory::load(std::ifstream&, int, int, int) {
|
int EightBit::UnusedMemory::load(std::ifstream&, int, int, int) {
|
||||||
throw new std::logic_error("load operation not allowed.");
|
throw std::logic_error("load operation not allowed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int EightBit::UnusedMemory::load(const std::string&, int, int, int) {
|
int EightBit::UnusedMemory::load(const std::string&, int, int, int) {
|
||||||
throw new std::logic_error("load operation not allowed.");
|
throw std::logic_error("load operation not allowed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int EightBit::UnusedMemory::load(const std::vector<uint8_t>&, int, int, int) {
|
int EightBit::UnusedMemory::load(const std::vector<uint8_t>&, int, int, int) {
|
||||||
throw new std::logic_error("load operation not allowed.");
|
throw std::logic_error("load operation not allowed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EightBit::UnusedMemory::poke(uint16_t, uint8_t) {
|
void EightBit::UnusedMemory::poke(uint16_t, uint8_t) {
|
||||||
throw new std::logic_error("Poke operation not allowed.");
|
throw std::logic_error("Poke operation not allowed.");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user