ram, instr reel, runtime, etc
This commit is contained in:
59
src/spider/runtime/cpu/InstrReel.hpp
Normal file
59
src/spider/runtime/cpu/InstrReel.hpp
Normal file
@@ -0,0 +1,59 @@
|
||||
#pragma once
|
||||
|
||||
#include <spider/SpiderRuntime.hpp>
|
||||
|
||||
namespace spider {
|
||||
|
||||
/**
|
||||
* Implements an instruction reel.
|
||||
*/
|
||||
class InstrReel {
|
||||
private:
|
||||
|
||||
public:
|
||||
|
||||
InstrReel();
|
||||
|
||||
~InstrReel();
|
||||
|
||||
public:
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns the two-byte instruction at the
|
||||
* specific byte location.
|
||||
*/
|
||||
u16 instrAt(u64 ip) const;
|
||||
|
||||
/**
|
||||
* Obtains a byte of data at
|
||||
* the specific location.
|
||||
*/
|
||||
u8 dataAt(u64 ip) const;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Fetches the data, and then
|
||||
* feeds the instruction into the
|
||||
* CPU.
|
||||
*
|
||||
* Returns how many steps it should
|
||||
* move after.
|
||||
*/
|
||||
u8 feedNext(CPU& cpu);
|
||||
|
||||
public: // Static Utils //
|
||||
|
||||
static u16 unpackInstr(u16 bcode);
|
||||
|
||||
static u8 unpackAddrMode(u16 bcode);
|
||||
|
||||
static u8 unpackTypeSize(u16 bcode);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user