Correct some EightBit project analysis warnings.

Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2020-04-06 23:11:21 +01:00
parent 7296ff7cce
commit 44c6a8c3d1
11 changed files with 18 additions and 19 deletions

View File

@ -40,7 +40,7 @@ void EightBit::GameBoy::IoRegisters::Bus_ReadingByte(EightBit::EventArgs) {
auto upOrSelect = (live && !m_p12) ? 0 : Chip::Bit2;
auto downOrStart = (live && !m_p13) ? 0 : Chip::Bit3;
auto lowNibble = rightOrA | leftOrB | upOrSelect | downOrStart;
auto highNibble = Chip::promoteNibble(Chip::Mask4);
constexpr auto highNibble = Chip::promoteNibble(Chip::Mask4);
auto value = lowNibble | highNibble;
poke(port, lowNibble | highNibble);
}

View File

@ -1,13 +1,14 @@
#pragma once
#include "Bus.h"
#include "Register.h"
#include "Processor.h"
namespace EightBit {
class Bus;
class BigEndianProcessor : public Processor {
public:
~BigEndianProcessor() {};
~BigEndianProcessor() = default;
register16_t peekWord(register16_t address) final;
void pokeWord(register16_t address, register16_t value) final;

View File

@ -3,7 +3,6 @@
#include <cstdint>
#include <array>
#include "Signal.h"
#include "Memory.h"
#include "Ram.h"
@ -14,7 +13,7 @@ namespace EightBit {
InputOutput() = default;
[[nodiscard]] size_t size() const override;
[[nodiscard]] size_t size() const noexcept override;
[[nodiscard]] uint8_t peek(uint16_t address) const override;
[[nodiscard]] uint8_t& reference(uint16_t address) override;

View File

@ -3,7 +3,6 @@
#include <cstdint>
#include <array>
#include "Bus.h"
#include "LittleEndianProcessor.h"
#include "Register.h"
#include "EventArgs.h"
@ -11,6 +10,9 @@
#include "EightBitCompilerDefinitions.h"
namespace EightBit {
class Bus;
class IntelProcessor : public LittleEndianProcessor {
public:
struct opcode_decoded_t {

View File

@ -1,10 +1,11 @@
#pragma once
#include "Bus.h"
#include "Register.h"
#include "Processor.h"
namespace EightBit {
class Bus;
class LittleEndianProcessor : public Processor {
public:
~LittleEndianProcessor() = default;

View File

@ -5,8 +5,6 @@
#include "ClockedChip.h"
#include "Bus.h"
#include "Register.h"
#include "EventArgs.h"
#include "Signal.h"
#include "EightBitCompilerDefinitions.h"
@ -15,9 +13,9 @@ namespace EightBit {
public:
// b: number of bits representing the number in x
// x: sign extend this b-bit number to r
[[nodiscard]] static int8_t signExtend(int b, uint8_t x);
[[nodiscard]] static int8_t signExtend(int b, uint8_t x) noexcept;
~Processor() {};
~Processor() = default;
[[nodiscard]] auto& PC() noexcept { return m_pc; }

View File

@ -1,7 +1,5 @@
#pragma once
#include <cstdint>
#include "Rom.h"
namespace EightBit {

View File

@ -14,7 +14,7 @@ namespace EightBit {
class UnusedMemory final : public Memory {
public:
UnusedMemory(size_t size, uint8_t value);
~UnusedMemory() {};
~UnusedMemory() = default;
[[nodiscard]] size_t size() const final;
[[nodiscard]] uint8_t peek(uint16_t address) const final;

View File

@ -5,7 +5,7 @@
#include "Register.h"
size_t EightBit::InputOutput::size() const {
size_t EightBit::InputOutput::size() const noexcept {
return 0x100;
}

View File

@ -4,7 +4,7 @@
EightBit::IntelProcessor::IntelProcessor(Bus& bus)
: LittleEndianProcessor(bus) {
for (int i = 0; i < 0x100; ++i)
m_decodedOpcodes[i] = i;
m_decodedOpcodes.at(i) = i;
LoweredHALT.connect([this](EventArgs) { --PC(); });
RaisedHALT.connect([this](EventArgs) { ++PC(); });

View File

@ -60,7 +60,7 @@ int EightBit::Processor::execute(const uint8_t value) {
}
// http://graphics.stanford.edu/~seander/bithacks.html#FixedSignExtend
int8_t EightBit::Processor::signExtend(const int b, uint8_t x) {
int8_t EightBit::Processor::signExtend(const int b, uint8_t x) noexcept {
const uint8_t m = bit(b - 1); // mask can be pre-computed if b is fixed
x = x & (bit(b) - 1); // (Skip this if bits in x above position b are already zero.)
const auto result = (x ^ m) - m;