blob: 41ecb7a0bdd39f11c8f2673b13c8a4ea0091005c (
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
|
// 6502.h
// Main elements of the 6502 CPU
#pragma once
#include"stdio.h"
#include"core.h"
// CPU 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
// Return a truth value of 1 or 0.
byte GetFlag(byte flag);
// x can be a conditional, and any non-zero value will set the flag.
void SetFlag(byte flag, int x);
// Reusable routines for setting specific flags
void SetFlag_N(byte x);
void SetFlag_V(byte x, byte y);
void SetFlag_Z(int x);
// Memory access declarations; to be defined somewhere computer-specific, not CPU-specific
byte GetMemory(address x);
void SetMemory(address x, byte y);
// Stack access and manipulation
byte GetStack();
void SetStack(byte z);
|