mirror of
https://github.com/rkujawa/rk65c02.git
synced 2024-12-11 18:49:16 +00:00
Make RAM size configurable.
This commit is contained in:
parent
eeb337a0d6
commit
363bb56fc6
@ -135,7 +135,7 @@ bus_init_with_default_devs()
|
||||
|
||||
t = bus_init();
|
||||
|
||||
bus_device_add(&t, device_ram_init(), 0x0);
|
||||
bus_device_add(&t, device_ram_init(0xDFFF), 0x0);
|
||||
|
||||
return t;
|
||||
}
|
||||
@ -177,6 +177,8 @@ bus_load_file(bus_t *t, uint16_t addr, const char *filename)
|
||||
|
||||
close(fd);
|
||||
|
||||
rk65c02_log(LOG_DEBUG, "Loaded file %s at %x.", filename, addr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include "bus.h"
|
||||
#include "device.h"
|
||||
|
||||
#define RAM_SIZE 0xDFFF /* should be configurable */
|
||||
|
||||
uint8_t device_ram_read_1(void *, uint16_t);
|
||||
void device_ram_write_1(void *, uint16_t, uint8_t);
|
||||
|
||||
@ -36,7 +34,7 @@ device_ram_write_1(void *vd, uint16_t offset, uint8_t val)
|
||||
}
|
||||
|
||||
device_t *
|
||||
device_ram_init()
|
||||
device_ram_init(uint16_t size)
|
||||
{
|
||||
device_t *d;
|
||||
|
||||
@ -45,13 +43,13 @@ device_ram_init()
|
||||
assert(d != NULL);
|
||||
|
||||
d->name = "RAM";
|
||||
d->size = RAM_SIZE;
|
||||
d->size = size;
|
||||
|
||||
d->read_1 = device_ram_read_1;
|
||||
d->write_1 = device_ram_write_1;
|
||||
|
||||
d->aux = malloc(RAM_SIZE);
|
||||
memset(d->aux, 0, RAM_SIZE);
|
||||
d->aux = malloc(size);
|
||||
memset(d->aux, 0, size);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "device.h"
|
||||
|
||||
device_t * device_ram_init();
|
||||
device_t * device_ram_init(uint16_t);
|
||||
void device_ram_finish(device_t *);
|
||||
|
||||
#endif /* _DEVICE_RAM_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user