From d28ad56810b43cb3ea5d11e5e32042f69ee04562 Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Fri, 8 Dec 2023 06:52:14 +1100 Subject: major refactor of cpu code --- src/cpu/core.h | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) (limited to 'src/cpu/core.h') diff --git a/src/cpu/core.h b/src/cpu/core.h index 7c0f284..f83002f 100644 --- a/src/cpu/core.h +++ b/src/cpu/core.h @@ -1,12 +1,9 @@ #pragma once -typedef -unsigned char -byte; +#include -typedef -unsigned short -address; +typedef uint8_t byte; +typedef uint16_t address; extern byte acc; extern byte X; @@ -17,7 +14,6 @@ extern address PC; extern byte* Memory; extern byte ROM[]; - enum Addressing { eImmediate, @@ -34,28 +30,19 @@ enum Addressing eIndirectAbsolute, eRelative }; + typedef int Addressing; -typedef -struct AddData +struct State { int cycles; int length; - address add; + address address; byte value; -} -AddData; - - - -// GetMemory and SetMemory are declared here, but defined in apple.c -// This is because memory access of particular memory locations is influenced by the Apple I's specific setup, not by the CPU alone. -byte GetMemory(address x); -void SetMemory(address x, byte y); +}; -extern void *current_instruction; -extern AddData idata; -extern void (*func)(Addressing); +extern struct State state; +extern void (*Instruction)(Addressing); -- cgit v1.2.3