Browse Source

Emu:: Add broken function call

master
Frank 2 years ago
parent
commit
083cf2f732
  1. 3
      src/cpu.cpp
  2. 9
      src/emu.cpp
  3. 8
      src/emu.h

3
src/cpu.cpp

@ -6,6 +6,7 @@
*/ */
#include "cpu.h" #include "cpu.h"
#include "emu.h"
#include <iostream> #include <iostream>
CPU::CPU(unsigned int frequency) : ProcessingUnit(frequency) CPU::CPU(unsigned int frequency) : ProcessingUnit(frequency)
@ -18,4 +19,6 @@ CPU::~CPU()
void CPU::update() { void CPU::update() {
printf("This is an update from the CPU\n"); printf("This is an update from the CPU\n");
Emu::the().writeMemory("RAM", 123, 42);
printf("fff");
} }

9
src/emu.cpp

@ -24,3 +24,12 @@ void Emu::addMemorySpace(const char* name, int size) {
memory.reserve(size); memory.reserve(size);
m_memory_spaces.emplace(name, memory); 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];
}

8
src/emu.h

@ -18,13 +18,9 @@ public:
void addProcessingUnit(ProcessingUnit* processing_unit); void addProcessingUnit(ProcessingUnit* processing_unit);
void addMemorySpace(const char* name, int size); void addMemorySpace(const char* name, int size);
void writeRAM(const char* memory_space, int location); void writeMemory(const char* memory_space, unsigned int location, uint8_t value);
void writeVRAM(const char* memory_space, int location);
void writeROM(const char* memory_space, int location);
uint8_t readRAM(const char* memory_space, int location); uint8_t readMemory(const char* memory_space, unsigned int location);
uint8_t readVRAM(const char* memory_space, int location);
uint8_t readROM(const char* memory_space, int location);
private: private:
unsigned int m_frequency; unsigned int m_frequency;

Loading…
Cancel
Save