From d0230f435c57af4680540dc8f6ba3b27d6d55ad4 Mon Sep 17 00:00:00 2001 From: jborza Date: Sat, 13 Apr 2019 10:02:18 +0200 Subject: [PATCH] cpu state definition --- flags.h | 13 +++++++++++++ state.h | 13 +++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 flags.h create mode 100644 state.h diff --git a/flags.h b/flags.h new file mode 100644 index 0000000..fe66ccf --- /dev/null +++ b/flags.h @@ -0,0 +1,13 @@ +#pragma once +#include + +typedef struct Flags { + uint8_t c : 1; + uint8_t z : 1; + uint8_t i : 1; + uint8_t d : 1; + uint8_t b : 1; + uint8_t pad : 1; + uint8_t v : 1; + uint8_t n : 1; +} Flags; \ No newline at end of file diff --git a/state.h b/state.h new file mode 100644 index 0000000..105777c --- /dev/null +++ b/state.h @@ -0,0 +1,13 @@ +#pragma once +#include +#include "flags.h" + +typedef struct State6502 { + uint8_t A; //accumulator + uint8_t X; //x index + uint8_t Y; //y index + uint8_t SP; //stack pointer, 256 byte stack between $0100 and $01FF + uint16_t PC; //program counter, points to the next instruction to be executed + uint8_t* Memory; + Flags Flags; //CPU flags +} State6502; \ No newline at end of file