blob: 093fc3c44a064b913f21dd4d85bd12fe2073a3a0 (
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
65
66
67
68
69
70
71
72
|
// 6502.h
// Main elements of the 6502 CPU
#ifndef CPU_H
#define CPU_H
#include"stdio.h"
#include"core.h"
byte acc, X, Y, P, S = 0x00;
address PC = 0x0000;
byte* Memory;
byte* ROM;
// 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.
#endif
|