ready for addrm & instr

This commit is contained in:
2026-03-25 10:00:21 -06:00
parent 1c971a4e22
commit e24e8dfe2d
8 changed files with 245 additions and 20 deletions

View File

@@ -4,17 +4,33 @@ namespace spider {
// Constructors & Destructors //
Runtime::Runtime() : ram(0) {}
Runtime::Runtime() : Runtime(0) {}
Runtime::Runtime(u64 ramSize) : ram(ramSize) {}
Runtime::Runtime(u64 ramSize) : ram(ramSize), reel(nullptr) {
cpu.hookRAM(&ram);
}
Runtime::~Runtime() {}
Runtime::~Runtime() {
delete reel;
}
// Stepping/Running the Machine //
void Runtime::step() {}
void Runtime::step() {
cpu.fetchInstr();
// TODO: Call instruction
}
void Runtime::step(u64 n) {}
void Runtime::step(u64 n) {
while(n >= 4) {
step();
step();
step();
step();
n -= 4;
}
while (n--) step();
}
void Runtime::run() {}
@@ -26,4 +42,12 @@ namespace spider {
ram.resize(length);
}
/**
* Non-owning reel setup.
*/
void Runtime::hookReel(InstrReel* reel, bool own) {
cpu.hookInstrReel(reel);
if(own) this->reel = reel;
}
}