ram, instr reel, runtime, etc

This commit is contained in:
2026-03-20 16:53:02 -06:00
parent 16fa0bf3ea
commit 5a4eb66c78
12 changed files with 390 additions and 20 deletions

View File

@@ -22,6 +22,7 @@ namespace spider {
u64 RM;
public:
/**
* These are private registers, which are only used
* whenever constant things are used.
@@ -31,9 +32,21 @@ namespace spider {
register_t ALU0, ALU1;
public:
CPU();
CPU(const CPU& other) = default;
CPU(CPU&& other) noexcept = default;
~CPU();
public:
CPU& operator=(const CPU& other) = default;
CPU& operator=(CPU&& other) noexcept = default;
public:
// <pygen-target name=cpu-instructions> //

View File

@@ -0,0 +1,29 @@
#include "InstrReel.hpp"
namespace spider {
InstrReel::InstrReel() {}
InstrReel::~InstrReel() {}
u16 InstrReel::instrAt(u64 ip) const {}
u8 InstrReel::dataAt(u64 ip) const {}
u8 InstrReel::feedNext(CPU& cpu) {}
// Static Utils //
u16 InstrReel::unpackInstr(u16 bcode) {
return (bcode >> 5) & 0x1FF;
}
u8 InstrReel::unpackAddrMode(u16 bcode) {
return (bcode >> 2) & 0x1F;
}
u8 InstrReel::unpackTypeSize(u16 bcode) {
return bcode & 0x3;
}
}

View 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);
};
}