blob: 35fd0ef76eb37019ca21a84aaae4fa041651511e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#ifndef MEMORY_H
#define MEMORY_H
#include <stdint.h>
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
|