summaryrefslogtreecommitdiff
path: root/src/apple.c
blob: 3e3b928f87e19d593954391a82a949199acbeecd (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
#include"apple.h"

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

void AppleOn(){
	Memory = calloc(MEMORY_SIZE, sizeof(byte));
	initInstructionTable();
}

void AppleReset(){
	acc = 0; X = 0; Y = 0; P = 0; S = 0;
	idata.cycles = 0; idata.length = 0; idata.add = 0; idata.value = 0;
	free(Memory);
	Memory = calloc(MEMORY_SIZE, sizeof(byte));
}

byte getMemory(address x){
	return Memory[x];
}

void setMemory(address x, byte y){
	Memory[x] = y;
}