MicroCorruption/common/mem.h
2022-12-11 21:03:53 -06:00

25 lines
380 B
C

#ifndef __uC_MEM_H__
#define __uC_MEM_H__
#include <stdlib.h>
void * mem;
const int mem_size = 65536;
void mem_create() __attribute__ ((constructor));
void mem_destroy() __attribute__ ((destructor));
void mem_create() {
mem = malloc(mem_size);
}
void mem_destroy() {
free(mem);
}
void * mem_get(short addr) {
return mem+(addr%mem_size);
}
#endif // __uC_MEM_H__