-
Notifications
You must be signed in to change notification settings - Fork 0
/
memory.hpp
37 lines (34 loc) · 941 Bytes
/
memory.hpp
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
#include <iostream>
#include "cell.hpp"
class Memory
{
private:
cell8 memory_addresses[65536];
int NULL_VAL = 0x00;
public:
Memory()
{
initializeMemoryAddresses();
}
void initializeMemoryAddresses()
{
for(int i = 0; i < 65536; i++)
memory_addresses[i].b = NULL_VAL;
}
void printMemoryAddress(int* memoryAddress)
{
std::cout << std::hex << memory_addresses[*memoryAddress].b << std::endl;
}
void setMemoryAddress(int* memoryAddress, cell8 val)
{
memory_addresses[*memoryAddress].b = val.b;
}
void clearMemoryAddress(int* memoryAddress)
{
memory_addresses[*memoryAddress].b = 0x00;
}
cell8 returnFromMemory(int* memoryAddress)
{
return memory_addresses[*memoryAddress];
}
};