-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsave.cpp
More file actions
43 lines (36 loc) · 774 Bytes
/
save.cpp
File metadata and controls
43 lines (36 loc) · 774 Bytes
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
#include "globals.h"
#include "save.h"
#include "vm.h"
void saveProgram()
{
short dataIndex;
unsigned char data;
for(dataIndex = 0; dataIndex < PROGRAM_CODE_LENGTH; dataIndex++)
{
data = EEPROM.read(PROGRAM_EEPROM_START + dataIndex);
if(data != initCode[dataIndex])
{
EEPROM.write(PROGRAM_EEPROM_START + dataIndex, initCode[dataIndex]);
}
}
}
void loadProgram()
{
short dataIndex;
for(dataIndex = 0; dataIndex < PROGRAM_CODE_LENGTH; dataIndex++)
{
initCode[dataIndex] = EEPROM.read(PROGRAM_EEPROM_START + dataIndex);
}
}
void defaultProgram()
{
}
void emptyProgram()
{
unsigned short dataIndex = 0;
for(dataIndex = 0; dataIndex < PROGRAM_CODE_LENGTH - 1; dataIndex += 2)
{
initCode[dataIndex] = 0xf0;
initCode[dataIndex+1] = 0x00;
}
}