summaryrefslogtreecommitdiff
path: root/src/cpu/core.h
blob: 4b8d7f1c02cd5e1513e1c12286ca8787a4643f71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once

#include <stdint.h>

typedef uint8_t  byte;
typedef uint16_t address;

extern byte acc;
extern byte X;
extern byte Y;
extern byte P;
extern byte S;
extern address PC;
extern byte* Memory;
extern const byte ROM[];

enum Addressing
{
	eImmediate,
	eAccumulator,
	eZeroPage,
	eZeroPageIndexedX,
	eZeroPageIndexedY,
	eAbsolute,
	eAbsoluteIndexedX,
	eAbsoluteIndexedY,
	eIndexedIndirect,
	eIndirectIndexed,
	eImplied,
	eIndirectAbsolute,
	eRelative
};

typedef
int
Addressing;

struct State
{
	int cycles;
	int length;
	address address;
	byte value;
};


extern struct State state;
extern void (*Instruction)(Addressing);