#include "memory.h" Memory* initMemory(uint32_t size) { Memory* newMemory = malloc(sizeof(Memory)); if (!newMemory) return NULL; newMemory->size = size; newMemory->data = calloc(size, sizeof(uint8_t)); if (!newMemory->data) { free(newMemory); return NULL; } return newMemory; } inline uint16_t memoryLoadWord(Memory* m, uint32_t address) { return m->data[address]; } inline void memorySaveWord(Memory* m, uint32_t address, uint16_t value) { ((uint16_t*)m->data)[address] = value; }