29 lines
441 B
C
29 lines
441 B
C
#include "ram.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
r16_int* ram = NULL;
|
|
|
|
void InitRam()
|
|
{
|
|
ram = (r16_int*)malloc(sizeof(r16_int) * UINT16_MAX);
|
|
}
|
|
|
|
r16_int GetValue(r16_int address)
|
|
{
|
|
#ifdef RAM_DO_NULL_CHECK
|
|
if (ram == NULL) { InitRam(); }
|
|
#endif
|
|
|
|
return ram[address.u];
|
|
}
|
|
|
|
void SetValue(r16_int address, r16_int value)
|
|
{
|
|
#ifdef RAM_DO_NULL_CHECK
|
|
if (ram == NULL) { InitRam(); }
|
|
#endif
|
|
|
|
ram[address.u] = value;
|
|
}
|