summaryrefslogtreecommitdiff
path: root/src/cpu/6502.h
blob: bad36fb916bff46825f30f61d4c23fb3199ec0da (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
62
63
64
//	6502.h
//	Main elements of the 6502 CPU

#pragma once

#include"stdio.h"
#include"core.h"

//	FLAGS
#define flag_N 0x80 // Negative
#define flag_V 0x40	// Overflow
#define flag_B 0x10	// BRK command
#define flag_D 0x08	// Decimal mode
#define flag_I 0x04	// IRQ disable
#define flag_Z 0x02	// Zero
#define flag_C 0x01	// Carry

byte getFlag(byte flag);
// Get the value of a flag.

void SetFlag(byte flag, int x);
// Set a flag with some value.

void flagSet(byte flag);
// Sets some flag.

void flagClear(byte flag);
// Clears some flag.

//	Functions which perform reusable routines for finding if a specific flag should be set.

void SetFlagN(byte x);

//Perform prior to any changes
void SetFlagV(byte x, byte y);

//void SetFlagB();
//May not need since its dependent on the BRK insturction

//void SetFlagD();
//Might not be necessary.

//void SetFlagI();
//Need to work on.

void SetFlagZ(int x);

//void SetFlagC();
//Only 6 instructions, 2 not including stack instructions, use the carry flag.

// The following two may be better defined within apple.c

//byte GetMemory(address x);
// Retrieve value from the computers address space.
// It is important not to directly access the memory array because some value hold special meaning.

//void SetMemory(address x, byte y);
// Set a piece of memory to some value.

byte GetStack();
// Get top value of the stack.

void SetStack(byte z);
// Set top value of the stack.