summaryrefslogtreecommitdiff
path: root/cpu.h
diff options
context:
space:
mode:
authorvin <git@vineetk.net>2024-07-07 13:04:10 -0400
committervin <git@vineetk.net>2024-07-07 13:04:16 -0400
commitca5a09cd94a5fc92e727cd69fb89f58760f34176 (patch)
tree75d4c030de9f07115dfd1b3ddaf46f284a16d6f4 /cpu.h
parent3e0563ce059172001d06688809096972696f83a4 (diff)
fix warnings and move cpu registers+flags to header
Diffstat (limited to 'cpu.h')
-rw-r--r--cpu.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/cpu.h b/cpu.h
index ed17432..05c30fa 100644
--- a/cpu.h
+++ b/cpu.h
@@ -1,5 +1,29 @@
1#ifndef CPU_H
2#define CPU_H
3
1#include <stdint.h> 4#include <stdint.h>
2 5
6struct cpu_flags {
7 uint8_t carry : 1;
8 uint8_t zero : 1;
9 uint8_t interrupt_disable : 1;
10 uint8_t decimal_mode : 1;
11 uint8_t brk : 1;
12 uint8_t unused : 1;
13 uint8_t overflow : 1;
14 uint8_t negative : 1;
15};
16
17struct registers {
18 uint8_t a, x, y, sp;
19 struct cpu_flags status;
20 uint16_t pc;
21};
22struct registers regs = {0};
23
24/* 64K address space, 16bit words */
25uint8_t memory[0x16000];
26
3/* OFFICIAL OPCODES */ 27/* OFFICIAL OPCODES */
4void ADC(uint16_t arg); 28void ADC(uint16_t arg);
5void AND(uint16_t arg); 29void AND(uint16_t arg);
@@ -87,3 +111,5 @@ void SYA(uint16_t arg);
87void TOP(uint16_t arg); 111void TOP(uint16_t arg);
88void XAA(uint16_t arg); 112void XAA(uint16_t arg);
89void XAS(uint16_t arg); 113void XAS(uint16_t arg);
114
115#endif /* CPU_H */