From 052899e196c6a2660651b9896ceed3313e7d0bac Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 21 Nov 2020 21:08:43 +0100 Subject: started a simple emulator --- emu/memory.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 emu/memory.h (limited to 'emu/memory.h') diff --git a/emu/memory.h b/emu/memory.h new file mode 100644 index 0000000..35fd0ef --- /dev/null +++ b/emu/memory.h @@ -0,0 +1,23 @@ +#ifndef MEMORY_H +#define MEMORY_H + +#include + +enum { + MEMORY_SIZE = 65535 +}; + +typedef struct memory_t +{ + uint8_t cell[MEMORY_SIZE]; + + uint8_t (*read)( struct memory_t *memory, uint16_t addr ); + void (*write)( struct memory_t *memory, uint16_t addr, uint8_t data ); +} memory_t; + +void memory_init( memory_t *memory ); +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 ); + +#endif -- cgit v1.2.3-54-g00ecf