summaryrefslogtreecommitdiff
path: root/emu/memory.c
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2020-12-10 19:50:39 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2020-12-10 19:50:39 +0100
commit1269d11d15f1014b7ac87fc2bb2c76367404e16c (patch)
treed8d4595811b279d2e7d5ccef32f55ba5cbcba585 /emu/memory.c
parent84e25eb07749636b48deb802d673f44841c55d91 (diff)
download6502-1269d11d15f1014b7ac87fc2bb2c76367404e16c.tar.gz
6502-1269d11d15f1014b7ac87fc2bb2c76367404e16c.tar.bz2
some more unit testing
Diffstat (limited to 'emu/memory.c')
-rw-r--r--emu/memory.c12
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;