summaryrefslogtreecommitdiff
path: root/src/cpu/addressing.h
blob: d0320b8e08760f75d6d1c12e229346aba53a8071 (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
//	addressing.h
//	Contains definitions relevant to addressing, as well as fAddress() which returns time, length, value, and address for an instruction function call.

#ifndef ADDRESSING_H
#define ADDRESSING_H

#include"core.h"

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;

#include"instructions.h"

//Holds address of current instruction.
void* current_instruction;

#define getInstructionLength(c) fAddressGetLength(*getInstructionTableAddressing(c))

int fAddressGetLength(Addressing addr);

AddData fAddress(Addressing addr, short x);

#endif