diff --git a/src/bus.c b/src/bus.c index 6a508d2..978a481 100644 --- a/src/bus.c +++ b/src/bus.c @@ -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; } diff --git a/src/device_ram.c b/src/device_ram.c index c94add2..9bcbaa2 100644 --- a/src/device_ram.c +++ b/src/device_ram.c @@ -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; } diff --git a/src/device_ram.h b/src/device_ram.h index b2fdea6..1e1019a 100644 --- a/src/device_ram.h +++ b/src/device_ram.h @@ -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_ */