MicroCorruption/common/mem.h

25 lines
380 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;
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__