mirror of
https://git.soft.fish/val/MicroCorruption.git
synced 2024-11-22 18:35:59 +00:00
25 lines
380 B
C
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__
|