MicroCorruption/common/mem.h

25 lines
386 B
C
Raw Normal View History

2022-12-12 03:03:53 +00:00
#ifndef __uC_MEM_H__
#define __uC_MEM_H__
#include <stdlib.h>
void * mem;
2022-12-12 05:14:46 +00:00
const int mem_size = 0x10000;
2022-12-12 03:03:53 +00:00
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) {
2022-12-12 05:14:46 +00:00
return mem + (addr % mem_size);
2022-12-12 03:03:53 +00:00
}
#endif // __uC_MEM_H__