diff --git a/src/cpu.cpp b/src/cpu.cpp index a8764d5..029b0d0 100644 --- a/src/cpu.cpp +++ b/src/cpu.cpp @@ -6,6 +6,7 @@ */ #include "cpu.h" +#include "emu.h" #include CPU::CPU(unsigned int frequency) : ProcessingUnit(frequency) @@ -18,4 +19,6 @@ CPU::~CPU() void CPU::update() { printf("This is an update from the CPU\n"); + Emu::the().writeMemory("RAM", 123, 42); + printf("fff"); } \ No newline at end of file diff --git a/src/emu.cpp b/src/emu.cpp index a15e155..2f8fe85 100644 --- a/src/emu.cpp +++ b/src/emu.cpp @@ -23,4 +23,13 @@ void Emu::addMemorySpace(const char* name, int size) { std::vector memory; memory.reserve(size); m_memory_spaces.emplace(name, memory); +} + +void Emu::writeMemory(const char* memory_space, unsigned int location, uint8_t value) { + // printf("%s %d %d", memory_space, location, value); + // m_memory_spaces[memory_space][location] = value; +} + +uint8_t Emu::readMemory(const char* memory_space, unsigned int location){ + // return m_memory_spaces[memory_space][location]; } \ No newline at end of file diff --git a/src/emu.h b/src/emu.h index 551f381..29b51d4 100644 --- a/src/emu.h +++ b/src/emu.h @@ -18,13 +18,9 @@ public: void addProcessingUnit(ProcessingUnit* processing_unit); void addMemorySpace(const char* name, int size); - void writeRAM(const char* memory_space, int location); - void writeVRAM(const char* memory_space, int location); - void writeROM(const char* memory_space, int location); + void writeMemory(const char* memory_space, unsigned int location, uint8_t value); - uint8_t readRAM(const char* memory_space, int location); - uint8_t readVRAM(const char* memory_space, int location); - uint8_t readROM(const char* memory_space, int location); + uint8_t readMemory(const char* memory_space, unsigned int location); private: unsigned int m_frequency;