diff options
Diffstat (limited to 'emu/memory.h')
-rw-r--r-- | emu/memory.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/emu/memory.h b/emu/memory.h index b2abfee..a0d45b9 100644 --- a/emu/memory.h +++ b/emu/memory.h @@ -1,27 +1,30 @@ #ifndef MEMORY_H #define MEMORY_H -#include "7seg.h" +#include "device.h" #include <stdint.h> -enum { - MEMORY_SIZE = 65535 -}; +typedef enum memory_type_t { + MEMORY_ROM = 1, + MEMORY_RAM = 2 +} memory_type_t; typedef struct memory_t { - uint8_t cell[MEMORY_SIZE]; + device_t base; - seg7_t *seg; - - uint8_t (*read)( struct memory_t *memory, uint16_t addr ); - void (*write)( struct memory_t *memory, uint16_t addr, uint8_t data ); + memory_type_t type; + uint16_t addr; + int size; + uint8_t *cell; } memory_t; -void memory_init( memory_t *memory, seg7_t *seg ); -uint8_t memory_read( memory_t *memory, uint16_t addr ); -void memory_write( memory_t *memory, uint16_t addr, uint8_t data ); -void memory_load( memory_t *memory, uint16_t addr, uint16_t size, const char *filename ); +void memory_init( memory_t *memory, memory_type_t type, uint16_t addr, uint16_t size ); +void memory_load( memory_t *memory, const char *filename ); + +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 |