fixed for library use

This commit is contained in:
2026-06-13 13:12:06 -06:00
parent 0c21587e15
commit 5f4c2abec8
3 changed files with 61 additions and 7 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ AR := ar
ARFLAGS := rcs ARFLAGS := rcs
# The Target Static Library # The Target Static Library
TARGET := libspider-runtimelib.a TARGET := libspider-runtime.a
#The Directories, Source, Includes, Objects, Binary and Resources #The Directories, Source, Includes, Objects, Binary and Resources
SRCDIR := src SRCDIR := src
+52 -6
View File
@@ -219,7 +219,6 @@ namespace spider {
} }
} }
// ── 0x030 — EQ: Dst == Src into Dst ──
void CPU::EQ() { void CPU::EQ() {
fetchOperSrc(); fetchOperSrc();
fetchOperDst(); fetchOperDst();
@@ -233,7 +232,6 @@ namespace spider {
_dst->_u64 = res ? 1 : 0; _dst->_u64 = res ? 1 : 0;
} }
// ── 0x031 — NE: Dst != Src into Dst ──
void CPU::NE() { void CPU::NE() {
fetchOperSrc(); fetchOperSrc();
fetchOperDst(); fetchOperDst();
@@ -247,7 +245,6 @@ namespace spider {
_dst->_u64 = res ? 1 : 0; _dst->_u64 = res ? 1 : 0;
} }
// ── 0x032 — GT: Dst > Src into Dst ──
void CPU::GT() { void CPU::GT() {
fetchOperSrc(); fetchOperSrc();
fetchOperDst(); fetchOperDst();
@@ -261,7 +258,6 @@ namespace spider {
_dst->_u64 = res ? 1 : 0; _dst->_u64 = res ? 1 : 0;
} }
// ── 0x033 — GE: Dst >= Src into Dst ──
void CPU::GE() { void CPU::GE() {
fetchOperSrc(); fetchOperSrc();
fetchOperDst(); fetchOperDst();
@@ -275,7 +271,6 @@ namespace spider {
_dst->_u64 = res ? 1 : 0; _dst->_u64 = res ? 1 : 0;
} }
// ── 0x034 — LT: Dst < Src into Dst ──
void CPU::LT() { void CPU::LT() {
fetchOperSrc(); fetchOperSrc();
fetchOperDst(); fetchOperDst();
@@ -289,7 +284,6 @@ namespace spider {
_dst->_u64 = res ? 1 : 0; _dst->_u64 = res ? 1 : 0;
} }
// ── 0x035 — LE: Dst <= Src into Dst ──
void CPU::LE() { void CPU::LE() {
fetchOperSrc(); fetchOperSrc();
fetchOperDst(); fetchOperDst();
@@ -303,6 +297,58 @@ namespace spider {
_dst->_u64 = res ? 1 : 0; _dst->_u64 = res ? 1 : 0;
} }
void CPU::GTU() {
fetchOperSrc();
fetchOperDst();
bool res = false;
switch(_size) {
case 0b00: res = (_dst->_u8 > _src->_u8); break;
case 0b01: res = (_dst->_u16 > _src->_u16); break;
case 0b10: res = (_dst->_u32 > _src->_u32); break;
case 0b11: res = (_dst->_u64 > _src->_u64); break;
}
_dst->_u64 = res ? 1 : 0;
}
void CPU::GEU() {
fetchOperSrc();
fetchOperDst();
bool res = false;
switch(_size) {
case 0b00: res = (_dst->_u8 >= _src->_u8); break;
case 0b01: res = (_dst->_u16 >= _src->_u16); break;
case 0b10: res = (_dst->_u32 >= _src->_u32); break;
case 0b11: res = (_dst->_u64 >= _src->_u64); break;
}
_dst->_u64 = res ? 1 : 0;
}
void CPU::LTU() {
fetchOperSrc();
fetchOperDst();
bool res = false;
switch(_size) {
case 0b00: res = (_dst->_u8 < _src->_u8); break;
case 0b01: res = (_dst->_u16 < _src->_u16); break;
case 0b10: res = (_dst->_u32 < _src->_u32); break;
case 0b11: res = (_dst->_u64 < _src->_u64); break;
}
_dst->_u64 = res ? 1 : 0;
}
void CPU::LEU() {
fetchOperSrc();
fetchOperDst();
bool res = false;
switch(_size) {
case 0b00: res = (_dst->_u8 <= _src->_u8); break;
case 0b01: res = (_dst->_u16 <= _src->_u16); break;
case 0b10: res = (_dst->_u32 <= _src->_u32); break;
case 0b11: res = (_dst->_u64 <= _src->_u64); break;
}
_dst->_u64 = res ? 1 : 0;
}
// ── 0x038 — JMP: Dst -> Instruction Register (PC) ── // ── 0x038 — JMP: Dst -> Instruction Register (PC) ──
// The IR adds 1 at the end, so we subtract 1 to compensate. // The IR adds 1 at the end, so we subtract 1 to compensate.
void CPU::JMP() { void CPU::JMP() {
@@ -12,6 +12,14 @@ namespace spider {
// TODO: Implement UPY // TODO: Implement UPY
} }
void CPU::INT_1_SLOT() {}
void CPU::INT_2_SLOT() {}
void CPU::INT_3_SLOT() {}
void CPU::INT_4_SLOT() {}
// ── 0x0F6 — DGANT: "I'm SpiderLang" in a spider web ──────────── // ── 0x0F6 — DGANT: "I'm SpiderLang" in a spider web ────────────
void CPU::DGANT() { void CPU::DGANT() {
const char art[] = const char art[] =