ok ok it compiles. commented a lot too so check that out

This commit is contained in:
2026-03-30 07:43:09 -06:00
parent 15bf03097f
commit 0015387d60
9 changed files with 39 additions and 25 deletions

View File

@@ -34,7 +34,7 @@ namespace spider {
void Runtime::run() {}
void Runtime::run(u64 n) {}
//void Runtime::run(u64 n) {}
// Misc //
@@ -45,9 +45,10 @@ namespace spider {
/**
* Non-owning reel setup.
*/
void Runtime::hookReel(InstrReel* reel, bool own) {
cpu.hookInstrReel(reel);
if(own) this->reel = reel;
void Runtime::hookReel(InstrReel* newReel, bool own) {
delete this->reel;
cpu.hookInstrReel(newReel);
if(own) this->reel = newReel;
}
}

View File

@@ -75,7 +75,7 @@ namespace spider {
/**
* Non-owning reel setup.
*/
void hookReel(InstrReel* reel, bool own = false);
void hookReel(InstrReel* newReel, bool own = false);
};

View File

@@ -68,17 +68,20 @@ namespace spider {
}
void CPU::COM() {
// TODO: Implement COM
fetchOperDst();
switch(_size){
case 0b00: //byte
_dst->_u8 = ~_dst->_u8;
break;
case 0b01: //short
_dst->_u16 = ~_dst->_u16;
break;
case 0b10: //int
_dst->_u32 = ~_dst->_u32;
break;
case 0b11: //long
_dst->_u64 = ~_dst->_u64;
break;
}
(this->*_post)();
}
@@ -89,28 +92,36 @@ namespace spider {
switch(_size){
case 0b00: //byte
_dst->_u8 = 1 + ~_dst->_u8;
break;
case 0b01: //short
_dst->_u16 = 1+ ~_dst->_u16;
break;
case 0b10: //int
_dst->_u32 = 1 + ~_dst->_u32;
break;
case 0b11: //long
_dst->_u64 = 1 + ~_dst->_u64;
break;
}
(this->*_post)();
}
void CPU::EXS() {
void CPU::EXS() { // THIS IS INCORRECT!!!
// TODO: Implement EXS
fetchOperDst();
switch(_size){
case 0b00: //byte
_dst->_u32 = _dst->_u8 & 1;
break;
case 0b01: //short
_dst->_u32 = _dst->_u16 & 1;
break;
case 0b10: //int
_dst->_u32 = _dst->_u32 & 1;
break;
case 0b11: //long
_dst->_u32 = _dst->_u64 & 1;
break;
}
_dst->_u32 = _dst->_u8;
(this->*_post)();

View File

@@ -5,6 +5,7 @@
#include <algorithm>
#include <cstring>
/*
namespace spider {
template<typename T>
@@ -101,3 +102,4 @@ namespace spider {
}
}
*/

View File

@@ -2,6 +2,7 @@
#include <spider/runtime/common.hpp>
/*
namespace spider {
template<typename T>
@@ -27,3 +28,4 @@ namespace spider {
f64 matrix_det(Matrix<f64> mat);
}
*/

View File

@@ -1,6 +1,6 @@
#include <iostream>
/*
template<typename T, int Rows, int Cols>
struct Matrix {
T data[Rows][Cols];
@@ -106,3 +106,4 @@ Matrix<T, M, P> mat_multiply(Matrix<T, M, N> A, Matrix<T, N, P> B) {
return result;
}
*/

View File

@@ -30,17 +30,17 @@ namespace spider {
return quat_mul_gnrl<f32>(q1, q2);
}
void quat_mat(Quat<f32> quat, f32* mat) {
// TODO
}
//void quat_mat(Quat<f32> quat, f32* mat) {
// // TODO
//}
Quat<f64> quat_mul(Quat<f64> q1, Quat<f64> q2) {
return quat_mul_gnrl<f64>(q1, q2);
}
void quat_mat(Quat<f64> q1, f64* mat) {
// TODO
}
//void quat_mat(Quat<f64> q1, f64* mat) {
// // TODO
//}
/*
int quatMain() {

View File

@@ -9,7 +9,7 @@ namespace spider {
growTo((length >> 8) + ((length & 255) != 0));
}
InstrReelDyn::InstrReelDyn(const u8* data, u64 length) {}
//InstrReelDyn::InstrReelDyn(const u8* data, u64 length) {}
InstrReelDyn::InstrReelDyn(const InstrReelDyn& copy)
: _blocks(copy._blocks), _size(copy._size) {
@@ -89,7 +89,7 @@ namespace spider {
dat = 0;
for (isize i = 0; i < sizeof(dat); i++) {
auto& b = _blocks[(b_index + s_index) >> 8];
dat |= u16(b.data[s_index++ & 0xFF]) << (i * 8);
dat |= u16(b.data[s_index++ & 0xFF] << (i * 8));
}
return dat;
}
@@ -196,17 +196,14 @@ namespace spider {
// TODO!
void InstrReelDyn::writeU8(u64 ip, u8 dat) {}
void InstrReelDyn::writeU16(u64 ip, u16 dat) {}
void InstrReelDyn::writeU32(u64 ip, u32 dat) {}
void InstrReelDyn::writeU64(u64 ip, u64 dat) {}
//void InstrReelDyn::writeU8(u64 ip, u8 dat) {}
//void InstrReelDyn::writeU16(u64 ip, u16 dat) {}
//void InstrReelDyn::writeU32(u64 ip, u32 dat) {}
//void InstrReelDyn::writeU64(u64 ip, u64 dat) {}
/**
* Appends instruction at the end.
*/
void InstrReelDyn::append(u16 bc) {}
//void InstrReelDyn::append(u16 bc) {}
}

View File

@@ -148,7 +148,7 @@ namespace spider {
// 4. Overlay the title if provided
if (!title.empty()) {
move(startRow, startCol + (width - title.size() - 2) / 2);
move(startRow, startCol + (width - i32(title.size()) - 2) / 2);
std::cout << " " << title << " ";
}