blob: a0d45b97df463d47af62c9d1cebf7861653ba454 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#ifndef MEMORY_H
#define MEMORY_H
#include "device.h"
#include <stdint.h>
typedef enum memory_type_t {
MEMORY_ROM = 1,
MEMORY_RAM = 2
} memory_type_t;
typedef struct memory_t
{
device_t base;
memory_type_t type;
uint16_t addr;
int size;
uint8_t *cell;
} memory_t;
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
|