diff options
Diffstat (limited to 'emu/memory.c')
-rw-r--r-- | emu/memory.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/emu/memory.c b/emu/memory.c index 620261b..c73c668 100644 --- a/emu/memory.c +++ b/emu/memory.c @@ -20,7 +20,7 @@ void memory_init( memory_t *memory, memory_type_t type, uint16_t addr, uint16_t memory->size = size; memory->cell = malloc( memory->size ); if( initialize ) { - memset( memory->cell, 0, memory->size ); + memory_reset( memory ); } memory->base.vtable = (device_vtable_t *)&memory_vtable; @@ -43,6 +43,16 @@ void memory_load( memory_t *memory, const char *filename ) } } +void memory_set( memory_t *memory, uint16_t addr, uint8_t *buf, int bufsize ) +{ + memcpy( &memory->cell[addr], buf, bufsize ); +} + +void memory_reset( memory_t *memory ) +{ + memset( memory->cell, 0, memory->size ); +} + uint8_t memory_read( void *obj, uint16_t addr ) { memory_t *memory = (memory_t *)obj; |