summaryrefslogtreecommitdiff
path: root/emu/bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'emu/bus.c')
-rw-r--r--emu/bus.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/emu/bus.c b/emu/bus.c
index 68ec972..33617c7 100644
--- a/emu/bus.c
+++ b/emu/bus.c
@@ -6,7 +6,9 @@
static device_vtable_t const bus_vtable = {
bus_read,
bus_write,
- device_draw,
+#ifdef WITH_GUI
+ bus_draw,
+#endif
bus_deinit
};
@@ -55,13 +57,26 @@ void bus_write( void *obj, uint16_t addr, uint8_t data )
for( int i = 0; i < bus->nof_devices; i++ ) {
registered_device_t *reg = &bus->devices[i];
if( reg->from <= addr && addr <= reg->to ) {
- return reg->device->vtable->write( reg->device, addr, data );
+ reg->device->vtable->write( reg->device, addr, data );
+ return;
}
}
- fprintf( stderr, "ERROR: illegal bus access writing from address %04X\n", addr );
+ fprintf( stderr, "ERROR: illegal bus access writing to address %04X\n", addr );
}
+#ifdef WITH_GUI
+void bus_draw( void *obj, SDL_Renderer *renderer )
+{
+ bus_t *bus = (bus_t *)obj;
+
+ for( int i = 0; i < bus->nof_devices; i++ ) {
+ device_t *device = bus->devices[i].device;
+ device->vtable->draw( device, renderer );
+ }
+}
+#endif
+
void bus_deinit( void *obj )
{
bus_t *bus = (bus_t *)obj;