From bf59ce8dcdf4a1d9f0bbab200d8f1a595891cdef Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Sat, 19 Oct 2024 16:48:00 +0200 Subject: [PATCH] fix --- include/cpu.h | 5 +++++ src/cpu.c | 16 +++------------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/include/cpu.h b/include/cpu.h index d1b09e6..6f56735 100644 --- a/include/cpu.h +++ b/include/cpu.h @@ -5,8 +5,13 @@ #include struct CPU_s { + // [32] of 32bit (uint32_t) registers uint32_t registers[32]; + + // Points to the byte of current instruction. Also known as pc uint32_t programCounter; + + // The address space AddressSpace *addressSpace; }; diff --git a/src/cpu.c b/src/cpu.c index a6fb4e9..206fd13 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -1,25 +1,15 @@ #include #include + +#include "cpu.h" // for structs #include "address_space.h" #include "instruction_executor.h" -struct CPU_s { - // [32] of 32bit (uint32_t) registers - uint32_t registers[32]; - - // Points to the byte of current instruction. Also known as pc - uint32_t programCounter; - - // The address space - AddressSpace *addressSpace; -} cpu_default = { +const CPU cpu_default = { .registers = {0}, .programCounter = 0 }; -typedef struct CPU_s CPU; - - CPU create_cpu(AddressSpace *addressSpace) { CPU cpu = cpu_default; cpu.addressSpace = addressSpace;