Less magic numbers in FDC

This commit is contained in:
Jasmine Iwanek 2022-01-19 15:59:17 -05:00
parent 1c9c976125
commit 547fccccc6
3 changed files with 20 additions and 4 deletions

View file

@ -2311,7 +2311,7 @@ fdc_reset(void *priv)
fdc->max_track = (fdc->flags & FDC_FLAG_MORE_TRACKS) ? 85 : 79;
fdc_remove(fdc);
fdc_set_base(fdc, (fdc->flags & FDC_FLAG_PCJR) ? 0x00f0 : 0x03f0);
fdc_set_base(fdc, (fdc->flags & FDC_FLAG_PCJR) ? FDC_PRIMARY_PCJR_ADDR : FDC_PRIMARY_ADDR);
current_drive = 0;
@ -2342,12 +2342,12 @@ fdc_init(const device_t *info)
fdc->flags = info->local;
fdc->irq = 6;
fdc->irq = FDC_PRIMARY_IRQ;
if (fdc->flags & FDC_FLAG_PCJR)
timer_add(&fdc->watchdog_timer, fdc_watchdog_poll, fdc, 0);
else
fdc->dma_ch = 2;
fdc->dma_ch = FDC_PRIMARY_DMA;
fdc_log("FDC added: %04X (flags: %08X)\n", fdc->base_address, fdc->flags);

View file

@ -101,7 +101,7 @@ b215_init(const device_t *info)
rom_init(&dev->rom, ROM_B215, ROM_ADDR, 0x2000, 0x1fff, 0, MEM_MAPPING_EXTERNAL);
dev->fdc_controller = device_add(&fdc_um8398_device);
io_sethandler(0x03f0, 1, b215_read, NULL, NULL, NULL, NULL, NULL, dev);
io_sethandler(FDC_PRIMARY_ADDR, 1, b215_read, NULL, NULL, NULL, NULL, NULL, dev);
return dev;
}

View file

@ -24,6 +24,22 @@
extern int fdc_type;
#define FDC_PRIMARY_ADDR 0x03f0
#define FDC_PRIMARY_IRQ 6
#define FDC_PRIMARY_DMA 2
#define FDC_PRIMARY_PCJR_ADDR 0x00f0
#define FDC_PRIMARY_PCJR_IRQ 6
#define FDC_PRIMARY_PCJR_DMA 2
#define FDC_SECONDARY_ADDR 0x0370
#define FDC_SECONDARY_IRQ 6
#define FDC_SECONDARY_DMA 2
#define FDC_TERTIARY_ADDR 0x0360
#define FDC_TERTIARY_IRQ 6
#define FDC_TERTIARY_DMA 2
#define FDC_QUATERNARY_ADDR 0x03e0
#define FDC_QUATERNARY_IRQ 6
#define FDC_QUATERNARY_DMA 2
#define FDC_FLAG_PCJR 0x01 /* PCjr */
#define FDC_FLAG_DISKCHG_ACTLOW 0x02 /* Amstrad, PS/1, PS/2 ISA */
#define FDC_FLAG_AT 0x04 /* AT+, PS/x */