get rid of memory.cc/.hh

also fix bus' shared pointer in cpu
TODO: put cpu in bus not the other way around

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2024-06-14 05:37:10 +05:30
parent ffcdf5f3a7
commit 9397140473
16 changed files with 456 additions and 486 deletions

View File

@@ -7,8 +7,8 @@
#include <cstdio>
namespace matar {
Cpu::Cpu(const Bus& bus) noexcept
: bus(std::make_shared<Bus>(bus))
Cpu::Cpu(std::shared_ptr<Bus> bus) noexcept
: bus(bus)
, gpr({ 0 })
, cpsr(0)
, spsr(0)
@@ -19,6 +19,10 @@ Cpu::Cpu(const Bus& bus) noexcept
cpsr.set_irq_disabled(true);
cpsr.set_fiq_disabled(true);
cpsr.set_state(State::Arm);
uint32_t a = 4444;
dbg(this->bus->read_word(0x2000000));
this->bus->write_word(0x2000000, a);
dbg(this->bus->read_word(0x2000000));
glogger.info("CPU successfully initialised");
// PC always points to two instructions ahead