summaryrefslogtreecommitdiff
path: root/src/cpu/core.h
blob: 4545cd5349948d78a4c988dc217f1b82aa0e2f4a (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
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once

typedef
unsigned char
byte;

typedef
unsigned short
address;

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


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

typedef
struct AddData
{
	int cycles;
	int length;
	address add;
	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, address);