blob: 3a15bfea4cba96349cb5cabe66f694cba7ae17ad (
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
31
32
33
|
#ifndef MEMORY_H
#define MEMORY_H
#include "device.h"
#include <stdint.h>
#include <stdbool.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, bool initialize );
void memory_load( memory_t *memory, const char *filename );
void memory_set( memory_t *memory, uint16_t addr, uint8_t *buf, int bufsize );
void memory_reset( memory_t *memory );
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
|