Something is almost working

This commit is contained in:
2025-02-08 23:23:21 +01:00
parent aaf3dfb40c
commit 45653b6372
15 changed files with 969 additions and 326 deletions

View File

@@ -10,7 +10,7 @@
#define MEM_SIZE 65535
// Register count (register names R0 to R7)
#define REG_COUNT 32
#define REG_COUNT 64
#define STACK_SIZE 255
#define CPU_FLAG_ZERO (1 << 0)
@@ -33,6 +33,7 @@ typedef struct {
uint32_t stack_ptr; // Stack pointer
uint8_t flags; // Status flags
uint8_t mode;
uint32_t cycle;
} CPU;
void step(CPU *cpu);
@@ -49,6 +50,8 @@ typedef enum {
BRK, // BRK - Pause CPU (halts execution until resumed)
HLT,
MOV_RN_IMM, // MOV Rn, Imm - Move immediate to register (Rn = Imm)
MOV_RN_RM, // MOV Rn, Rm - Move value from one register to another (Rn = Rm)
MOV_RN_ADDR, // MOV Rn, [Addr] - Load value from memory address into register (Rn = [Addr])