#ifndef MEMORY_H #define MEMORY_H #include "device.h" #include #include typedef enum memory_type_t { MEMORY_ROM = 1, MEMORY_RAM = 2 } memory_type_t; typedef struct memory_t { device_t base; memory_type_t type; uint16_t addr; int size; uint8_t *cell; } memory_t; void memory_init( memory_t *memory, memory_type_t type, uint16_t addr, uint16_t size, bool initialize ); void memory_copy( memory_t *to, memory_t *from ); void memory_load( memory_t *memory, const char *filename ); void memory_set( memory_t *memory, uint16_t addr, uint8_t *buf, int bufsize ); void memory_reset( memory_t *memory ); uint8_t memory_read( void *obj, uint16_t addr ); void memory_write( void *obj, uint16_t addr, uint8_t data ); void memory_deinit( void *obj ); #endif