--- trunk/src/devices/dev_fdc.c 2007/10/08 16:21:17 34 +++ trunk/src/devices/dev_fdc.c 2007/10/08 16:22:32 42 @@ -25,9 +25,9 @@ * SUCH DAMAGE. * * - * $Id: dev_fdc.c,v 1.19 2006/12/30 13:30:58 debug Exp $ + * $Id: dev_fdc.c,v 1.21 2007/06/15 19:11:15 debug Exp $ * - * PC-style floppy controller. + * COMMENT: PC-style floppy controller * * TODO! (This is just a dummy skeleton right now.) * @@ -42,6 +42,7 @@ #include #include "device.h" +#include "interrupt.h" #include "machine.h" #include "memory.h" #include "misc.h" @@ -51,19 +52,16 @@ struct fdc_data { - unsigned char reg[DEV_FDC_LENGTH]; - int irqnr; + uint8_t reg[DEV_FDC_LENGTH]; + struct interrupt irq; }; -/* - * dev_fdc_access(): - */ DEVICE_ACCESS(fdc) { + struct fdc_data *d = extra; uint64_t idata = 0, odata = 0; size_t i; - struct fdc_data *d = extra; if (writeflag == MEM_WRITE) idata = memory_readmax64(cpu, data, len); @@ -95,13 +93,10 @@ { struct fdc_data *d; - d = malloc(sizeof(struct fdc_data)); - if (d == NULL) { - fprintf(stderr, "out of memory\n"); - exit(1); - } + CHECK_ALLOCATION(d = malloc(sizeof(struct fdc_data))); memset(d, 0, sizeof(struct fdc_data)); - d->irqnr = devinit->irq_nr; + + INTERRUPT_CONNECT(devinit->interrupt_path, d->irq); memory_device_register(devinit->machine->memory, devinit->name, devinit->addr, DEV_FDC_LENGTH, dev_fdc_access, d,