mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-04-26 06:17:47 +00:00
Try and sort out problematic "noexcept" specifications (mainly due to events)
This commit is contained in:
@@ -16,15 +16,15 @@ namespace EightBit {
|
||||
protected:
|
||||
BigEndianProcessor(Bus& memory) noexcept;
|
||||
|
||||
[[nodiscard]] register16_t getWord() noexcept override;
|
||||
void setWord(register16_t value) noexcept override;
|
||||
[[nodiscard]] register16_t getWord() override;
|
||||
void setWord(register16_t value) override;
|
||||
|
||||
[[nodiscard]] register16_t getWordPaged(uint8_t page, uint8_t offset) noexcept override;
|
||||
void setWordPaged(uint8_t page, uint8_t offset, register16_t value) noexcept override;
|
||||
[[nodiscard]] register16_t getWordPaged(uint8_t page, uint8_t offset) override;
|
||||
void setWordPaged(uint8_t page, uint8_t offset, register16_t value) override;
|
||||
|
||||
[[nodiscard]] register16_t fetchWord() noexcept final;
|
||||
[[nodiscard]] register16_t fetchWord() final;
|
||||
|
||||
void pushWord(register16_t value) noexcept final;
|
||||
[[nodiscard]] register16_t popWord() noexcept final;
|
||||
void pushWord(register16_t value) final;
|
||||
[[nodiscard]] register16_t popWord() final;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace EightBit {
|
||||
class Bus : public Mapper {
|
||||
public:
|
||||
virtual ~Bus() noexcept {};
|
||||
virtual ~Bus() noexcept = default;
|
||||
|
||||
Signal<EventArgs> WritingByte;
|
||||
Signal<EventArgs> WrittenByte;
|
||||
@@ -33,15 +33,15 @@ namespace EightBit {
|
||||
virtual void poke(const uint16_t address, const uint8_t value) noexcept { reference(address) = value; }
|
||||
void poke(const register16_t address, const uint8_t value) noexcept { poke(address.word, value); }
|
||||
|
||||
[[nodiscard]] uint8_t read() noexcept;
|
||||
[[nodiscard]] uint8_t read();
|
||||
template<class T> [[nodiscard]] auto read(const T address) {
|
||||
ADDRESS() = address;
|
||||
return read();
|
||||
}
|
||||
|
||||
void write() noexcept;
|
||||
void write(uint8_t value) noexcept;
|
||||
template<class T> void write(const T offset, const uint8_t value) noexcept {
|
||||
void write();
|
||||
void write(uint8_t value);
|
||||
template<class T> void write(const T offset, const uint8_t value) {
|
||||
ADDRESS() = offset;
|
||||
write(value);
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace EightBit {
|
||||
[[nodiscard]] auto& reference(const register16_t address) noexcept { return reference(address.word); }
|
||||
[[nodiscard]] uint8_t& reference() noexcept { return reference(ADDRESS()); }
|
||||
|
||||
void loadHexFile(std::string path);
|
||||
void loadHexFile(const std::string& path);
|
||||
|
||||
private:
|
||||
uint8_t m_data = Chip::Mask8;
|
||||
|
||||
+5
-5
@@ -10,17 +10,17 @@
|
||||
Signal<EventArgs> Lowered ## name;
|
||||
|
||||
#define DECLARE_PIN_LEVEL_RAISE(name) \
|
||||
virtual void raise ## name() noexcept;
|
||||
virtual void raise ## name();
|
||||
|
||||
#define DECLARE_PIN_LEVEL_LOWER(name) \
|
||||
virtual void lower ## name() noexcept;
|
||||
virtual void lower ## name();
|
||||
|
||||
#define DECLARE_PIN_LEVEL_CHANGERS(name) \
|
||||
DECLARE_PIN_LEVEL_RAISE(name) \
|
||||
DECLARE_PIN_LEVEL_LOWER(name)
|
||||
|
||||
#define DEFINE_PIN_LEVEL_RAISE(name, within) \
|
||||
void EightBit:: within ::raise ## name() noexcept { \
|
||||
void EightBit:: within ::raise ## name() { \
|
||||
if (lowered( name ())) { \
|
||||
Raising ## name.fire(); \
|
||||
raise( name ()); \
|
||||
@@ -29,7 +29,7 @@
|
||||
}
|
||||
|
||||
#define DEFINE_PIN_LEVEL_LOWER(name, within) \
|
||||
void EightBit:: within ::lower ## name() noexcept { \
|
||||
void EightBit:: within ::lower ## name() { \
|
||||
if (raised( name ())) { \
|
||||
Lowering ## name.fire(); \
|
||||
lower( name ()); \
|
||||
@@ -106,7 +106,7 @@ namespace EightBit {
|
||||
|
||||
static constexpr void flip(PinLevel& out) noexcept { match(out, out == PinLevel::Low ? PinLevel::High : PinLevel::Low); }
|
||||
|
||||
virtual ~Device() noexcept {};
|
||||
virtual ~Device() noexcept = default;
|
||||
|
||||
Device(const Device& rhs) noexcept;
|
||||
bool operator==(const Device& rhs) const noexcept;
|
||||
|
||||
+14
-14
@@ -44,8 +44,8 @@ namespace EightBit {
|
||||
}
|
||||
};
|
||||
|
||||
IntelProcessor(const IntelProcessor& rhs);
|
||||
bool operator==(const IntelProcessor& rhs) const;
|
||||
IntelProcessor(const IntelProcessor& rhs) noexcept;
|
||||
bool operator==(const IntelProcessor& rhs) const noexcept;
|
||||
|
||||
[[nodiscard]] constexpr const auto& getDecodedOpcode(const size_t i) const noexcept {
|
||||
return m_decodedOpcodes[i];
|
||||
@@ -138,27 +138,27 @@ namespace EightBit {
|
||||
return calculateHalfCarry(m_halfCarryTableSub, before, value, calculation);
|
||||
}
|
||||
|
||||
void handleRESET() noexcept override;
|
||||
void handleRESET() override;
|
||||
|
||||
void push(uint8_t value) noexcept final;
|
||||
[[nodiscard]] uint8_t pop() noexcept final;
|
||||
void push(uint8_t value) final;
|
||||
[[nodiscard]] uint8_t pop() final;
|
||||
|
||||
//
|
||||
|
||||
[[nodiscard]] register16_t getWord() noexcept final;
|
||||
void setWord(register16_t value) noexcept final;
|
||||
[[nodiscard]] register16_t getWord() final;
|
||||
void setWord(register16_t value) final;
|
||||
|
||||
//
|
||||
|
||||
virtual void restart(uint8_t address) noexcept;
|
||||
virtual int callConditional(int condition) noexcept;
|
||||
virtual int jumpConditional(int condition) noexcept;
|
||||
virtual int returnConditional(int condition) noexcept;
|
||||
virtual void restart(uint8_t address);
|
||||
virtual int callConditional(int condition);
|
||||
virtual int jumpConditional(int condition);
|
||||
virtual int returnConditional(int condition);
|
||||
virtual void jr(int8_t offset) noexcept;
|
||||
virtual int jrConditional(int condition) noexcept;
|
||||
void ret() noexcept override;
|
||||
virtual int jrConditional(int condition);
|
||||
void ret() override;
|
||||
|
||||
void resetWorkingRegisters();
|
||||
void resetWorkingRegisters() noexcept;
|
||||
|
||||
private:
|
||||
static std::array<int, 8> m_halfCarryTableAdd;
|
||||
|
||||
@@ -8,23 +8,23 @@ namespace EightBit {
|
||||
|
||||
class LittleEndianProcessor : public Processor {
|
||||
public:
|
||||
LittleEndianProcessor(const LittleEndianProcessor& rhs);
|
||||
LittleEndianProcessor(const LittleEndianProcessor& rhs) noexcept;
|
||||
|
||||
[[nodiscard]] register16_t peekWord(register16_t address) noexcept final;
|
||||
void pokeWord(register16_t address, register16_t value) noexcept final;
|
||||
|
||||
protected:
|
||||
LittleEndianProcessor(Bus& memory);
|
||||
LittleEndianProcessor(Bus& memory) noexcept;
|
||||
|
||||
[[nodiscard]] register16_t getWord() noexcept override;
|
||||
void setWord(register16_t value) noexcept override;
|
||||
[[nodiscard]] register16_t getWord() override;
|
||||
void setWord(register16_t value) override;
|
||||
|
||||
[[nodiscard]] register16_t getWordPaged(uint8_t page, uint8_t offset) noexcept override;
|
||||
void setWordPaged(uint8_t page, uint8_t offset, register16_t value) noexcept override;
|
||||
[[nodiscard]] register16_t getWordPaged(uint8_t page, uint8_t offset) override;
|
||||
void setWordPaged(uint8_t page, uint8_t offset, register16_t value) override;
|
||||
|
||||
[[nodiscard]] register16_t fetchWord() noexcept final;
|
||||
[[nodiscard]] register16_t fetchWord() final;
|
||||
|
||||
void pushWord(register16_t value) noexcept override;
|
||||
[[nodiscard]] register16_t popWord() noexcept override;
|
||||
void pushWord(register16_t value) override;
|
||||
[[nodiscard]] register16_t popWord() override;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace EightBit {
|
||||
// *) Possibly 'reference'able (Very likely if you've exposed 'poke')
|
||||
class Memory {
|
||||
public:
|
||||
virtual ~Memory() = default;
|
||||
|
||||
[[nodiscard]] virtual uint16_t size() const noexcept = 0;
|
||||
[[nodiscard]] virtual uint8_t peek(uint16_t address) const noexcept = 0;
|
||||
|
||||
|
||||
+28
-28
@@ -21,8 +21,8 @@ namespace EightBit {
|
||||
return result;
|
||||
}
|
||||
|
||||
Processor(const Processor& rhs);
|
||||
bool operator==(const Processor& rhs) const;
|
||||
Processor(const Processor& rhs) noexcept;
|
||||
bool operator==(const Processor& rhs) const noexcept;
|
||||
|
||||
[[nodiscard]] constexpr auto& PC() noexcept { return m_pc; }
|
||||
[[nodiscard]] constexpr const auto& PC() const noexcept { return m_pc; }
|
||||
@@ -44,44 +44,44 @@ namespace EightBit {
|
||||
[[nodiscard]] constexpr auto& opcode() noexcept { return m_opcode; }
|
||||
[[nodiscard]] constexpr auto& BUS() noexcept { return m_bus; }
|
||||
|
||||
virtual void handleRESET() noexcept;
|
||||
virtual void handleINT() noexcept;
|
||||
virtual void handleRESET();
|
||||
virtual void handleINT();
|
||||
|
||||
void memoryWrite(register16_t address, uint8_t data) noexcept;
|
||||
void memoryWrite(register16_t address) noexcept;
|
||||
void memoryWrite(uint8_t data) noexcept;
|
||||
virtual void memoryWrite() noexcept;
|
||||
virtual void busWrite() noexcept;
|
||||
void memoryWrite(register16_t address, uint8_t data);
|
||||
void memoryWrite(register16_t address);
|
||||
void memoryWrite(uint8_t data);
|
||||
virtual void memoryWrite();
|
||||
virtual void busWrite();
|
||||
|
||||
uint8_t memoryRead(register16_t address) noexcept;
|
||||
virtual uint8_t memoryRead() noexcept;
|
||||
virtual uint8_t busRead() noexcept;
|
||||
uint8_t memoryRead(register16_t address);
|
||||
virtual uint8_t memoryRead();
|
||||
virtual uint8_t busRead();
|
||||
|
||||
uint8_t getBytePaged(uint8_t page, uint8_t offset) noexcept;
|
||||
void setBytePaged(uint8_t page, uint8_t offset, uint8_t value) noexcept;
|
||||
uint8_t getBytePaged(uint8_t page, uint8_t offset);
|
||||
void setBytePaged(uint8_t page, uint8_t offset, uint8_t value);
|
||||
|
||||
uint8_t fetchByte() noexcept;
|
||||
uint8_t fetchByte();
|
||||
|
||||
[[nodiscard]] virtual register16_t getWord() noexcept = 0;
|
||||
virtual void setWord(register16_t value) noexcept = 0;
|
||||
[[nodiscard]] virtual register16_t getWord() = 0;
|
||||
virtual void setWord(register16_t value) = 0;
|
||||
|
||||
[[nodiscard]] virtual register16_t getWordPaged(uint8_t page, uint8_t offset) noexcept = 0;
|
||||
virtual void setWordPaged(uint8_t page, uint8_t offset, register16_t value) noexcept = 0;
|
||||
[[nodiscard]] virtual register16_t getWordPaged(uint8_t page, uint8_t offset) = 0;
|
||||
virtual void setWordPaged(uint8_t page, uint8_t offset, register16_t value) = 0;
|
||||
|
||||
[[nodiscard]] virtual register16_t fetchWord() noexcept = 0;
|
||||
[[nodiscard]] virtual register16_t fetchWord() = 0;
|
||||
|
||||
virtual void push(uint8_t value) noexcept = 0;
|
||||
[[nodiscard]] virtual uint8_t pop() noexcept = 0;
|
||||
virtual void push(uint8_t value) = 0;
|
||||
[[nodiscard]] virtual uint8_t pop() = 0;
|
||||
|
||||
virtual void pushWord(register16_t value) noexcept = 0;
|
||||
[[nodiscard]] virtual register16_t popWord() noexcept = 0;
|
||||
virtual void pushWord(register16_t value) = 0;
|
||||
[[nodiscard]] virtual register16_t popWord() = 0;
|
||||
|
||||
[[nodiscard]] register16_t getWord(register16_t address) noexcept;
|
||||
void setWord(register16_t address, register16_t value) noexcept;
|
||||
[[nodiscard]] register16_t getWord(register16_t address);
|
||||
void setWord(register16_t address, register16_t value);
|
||||
|
||||
void jump(const register16_t destination) noexcept;
|
||||
virtual void call(register16_t destination) noexcept;
|
||||
virtual void ret() noexcept;
|
||||
virtual void call(register16_t destination);
|
||||
virtual void ret();
|
||||
|
||||
private:
|
||||
Bus& m_bus;
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace EightBit {
|
||||
class Ram : public Rom {
|
||||
public:
|
||||
Ram(size_t size = 0) noexcept;
|
||||
virtual ~Ram() = default;
|
||||
|
||||
[[nodiscard]] uint8_t& reference(uint16_t address) noexcept final;
|
||||
void poke(uint16_t address, uint8_t value) noexcept final;
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace EightBit {
|
||||
|
||||
Rom(size_t size = 0) noexcept;
|
||||
Rom(const Rom& rhs);
|
||||
virtual ~Rom() = default;
|
||||
Rom& operator=(const Rom& rhs);
|
||||
bool operator==(const Rom& rhs) const;
|
||||
|
||||
@@ -41,7 +42,7 @@ namespace EightBit {
|
||||
|
||||
const auto size = end - start;
|
||||
if (limit < 0)
|
||||
limit = static_cast<int>(size - readOffset);
|
||||
limit = static_cast<int>(size) - readOffset;
|
||||
|
||||
const size_t extent = static_cast<size_t>(limit) + writeOffset;
|
||||
if (m_bytes.size() < extent)
|
||||
|
||||
Reference in New Issue
Block a user