Implement instructions 0x03C-0x053, add flag constants and fix execute pipeline #5

Merged
Kittycannon merged 4 commits from diego/instruc-03c-053 into main 2026-04-09 01:14:03 +00:00
Member

Implemented relative jump instructions (JMR, JER, JNR, JIR), user flag operations (SFB, LFB, JUF, JUR), stack operations (PUSH, POP), function call/return (CALL, RET minimal version), system flag instructions (EDI, SHSS), and float arithmetic (FLI, FNEG, FADD, FSUB, FMUL, FDIV, FEPS, FEEP). ALLOC/HFREE are stubs pending heap implementation. FMOD, FDMOD and float comparisons (FEQ-FLE) left as TODO.

Added flag register constants to CPU.hpp for bits 7, 10, 12, 16 and 20-23 based on the VM spec pages 11-14. Please verify the bit positions are correct.

Fixed two issues in the execute pipeline: CPU::execute() was indexing addrModes[] with the opcode (only 8 entries) instead of instrMap[] (512 entries). Runtime::step() was only decoding the instruction but never dispatching it — added the cpu.execute() call to complete the fetch-decode-execute cycle.

Implemented relative jump instructions (JMR, JER, JNR, JIR), user flag operations (SFB, LFB, JUF, JUR), stack operations (PUSH, POP), function call/return (CALL, RET minimal version), system flag instructions (EDI, SHSS), and float arithmetic (FLI, FNEG, FADD, FSUB, FMUL, FDIV, FEPS, FEEP). ALLOC/HFREE are stubs pending heap implementation. FMOD, FDMOD and float comparisons (FEQ-FLE) left as TODO. Added flag register constants to CPU.hpp for bits 7, 10, 12, 16 and 20-23 based on the VM spec pages 11-14. Please verify the bit positions are correct. Fixed two issues in the execute pipeline: CPU::execute() was indexing addrModes[] with the opcode (only 8 entries) instead of instrMap[] (512 entries). Runtime::step() was only decoding the instruction but never dispatching it — added the cpu.execute() call to complete the fetch-decode-execute cycle.
DiegoDeGante added 2 commits 2026-04-06 19:36:21 +00:00
DiegoDeGante added 1 commit 2026-04-06 19:42:29 +00:00
DiegoDeGante added 1 commit 2026-04-09 00:39:05 +00:00
Kittycannon merged commit dd1cd03026 into main 2026-04-09 01:14:03 +00:00
Kittycannon deleted branch diego/instruc-03c-053 2026-04-09 01:14:03 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SpiderLang/spider-runtime#5