#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* newReel, bool own) { delete this->reel; cpu.hookInstrReel(newReel); if(own) this->reel = newReel; } }