Files
spider-runtime/src/spider/runtime/Runtime.cpp
2026-03-25 10:00:21 -06:00

54 lines
944 B
C++

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