diff --git a/src/emu.cpp b/src/emu.cpp index 494873c..a5cdcb2 100644 --- a/src/emu.cpp +++ b/src/emu.cpp @@ -1,8 +1,10 @@ -#include "emu.h" +#include // uint8_t, uint32_t + #include "cpu.h" +#include "emu.h" #include "ruc/format/print.h" -void Emu::init(unsigned int frequency) +void Emu::init(uint32_t frequency) { m_frequency = frequency; } @@ -28,13 +30,13 @@ void Emu::addMemorySpace(const char* name, int size) m_memory_spaces.emplace(name, memory); } -void Emu::writeMemory(const char* memory_space, unsigned int location, uint8_t value) +void Emu::writeMemory(const char* memory_space, uint32_t location, uint8_t value) { print("{} {} {}\n", memory_space, location, value); m_memory_spaces[memory_space][location] = value; } -uint8_t Emu::readMemory(const char* memory_space, unsigned int location) +uint8_t Emu::readMemory(const char* memory_space, uint32_t location) { - // return m_memory_spaces[memory_space][location]; + return m_memory_spaces[memory_space][location]; } diff --git a/src/emu.h b/src/emu.h index 1d8dc60..8a48da0 100644 --- a/src/emu.h +++ b/src/emu.h @@ -1,6 +1,6 @@ #pragma once -#include +#include // uint8_t, uint32_t #include #include @@ -11,20 +11,20 @@ class Emu final : public ruc::Singleton { public: Emu(s) {} - void init(unsigned int frequency); + void init(uint32_t frequency); void update(); void addProcessingUnit(ProcessingUnit* processing_unit); void addMemorySpace(const char* name, int size); - void writeMemory(const char* memory_space, unsigned int location, uint8_t value); + void writeMemory(const char* memory_space, uint32_t location, uint8_t value); - uint8_t readMemory(const char* memory_space, unsigned int location); + uint8_t readMemory(const char* memory_space, uint32_t location); private: - unsigned int m_frequency; - unsigned int m_cycle = 0; + uint32_t m_frequency; + uint32_t m_cycle = 0; std::vector m_processing_units; std::unordered_map> m_memory_spaces; diff --git a/src/processing-unit.cpp b/src/processing-unit.cpp index 322d368..935e6c4 100644 --- a/src/processing-unit.cpp +++ b/src/processing-unit.cpp @@ -5,11 +5,11 @@ * SPDX-License-Identifier: MIT */ -#include +#include // uint32_t #include "processing-unit.h" -ProcessingUnit::ProcessingUnit(unsigned int frequency) +ProcessingUnit::ProcessingUnit(uint32_t frequency) : m_frequency(frequency) { } @@ -18,7 +18,7 @@ ProcessingUnit::~ProcessingUnit() { } -unsigned int ProcessingUnit::frequency() +uint32_t ProcessingUnit::frequency() { return m_frequency; } diff --git a/src/processing-unit.h b/src/processing-unit.h index 2d1ecea..09509e8 100644 --- a/src/processing-unit.h +++ b/src/processing-unit.h @@ -7,15 +7,17 @@ #pragma once +#include // uint32_t + class ProcessingUnit { public: - ProcessingUnit(unsigned int frequency); + ProcessingUnit(uint32_t frequency); virtual ~ProcessingUnit(); virtual void update() = 0; - unsigned int frequency(); + uint32_t frequency(); private: - unsigned int m_frequency { 0 }; + uint32_t m_frequency { 0 }; };