mirror of
https://git.soft.fish/val/MicroCorruption.git
synced 2024-11-23 16:35:59 +00:00
25 lines
386 B
C
25 lines
386 B
C
#ifndef __uC_MEM_H__
|
|
#define __uC_MEM_H__
|
|
|
|
#include <stdlib.h>
|
|
|
|
void * mem;
|
|
const int mem_size = 0x10000;
|
|
|
|
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__
|