From fb267d1f8b4a51bdb1f552f5b7bd22e498443c16 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 13 Jun 2024 19:01:57 +0200 Subject: [PATCH] Fix the DP8473 FDC flags, closes #4538. --- src/floppy/fdc.c | 14 +++++++++++++- src/include/86box/fdc.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index 1a0aa2f10..4c1170eb9 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -931,6 +931,10 @@ fdc_write(uint16_t addr, uint8_t val, void *priv) fdc->format_state = 0; break; case 0x0e: /*Dump registers*/ + if (fdc->flags & FDC_FLAG_NEC) { + fdc_bad_command(fdc); + break; + } fdc->lastdrive = fdc->drive; fdc->interrupt = 0x0e; fdc_callback(fdc); @@ -949,6 +953,10 @@ fdc_write(uint16_t addr, uint8_t val, void *priv) case 0x10: /*Get version*/ case 0x14: /*Unlock*/ case 0x94: /*Lock*/ + if (fdc->flags & FDC_FLAG_NEC) { + fdc_bad_command(fdc); + break; + } fdc->lastdrive = fdc->drive; fdc->interrupt = fdc->command; fdc_callback(fdc); @@ -962,6 +970,10 @@ fdc_write(uint16_t addr, uint8_t val, void *priv) fdc_bad_command(fdc); break; case 0x13: /*Configure*/ + if (fdc->flags & FDC_FLAG_NEC) { + fdc_bad_command(fdc); + break; + } fdc->pnum = 0; fdc->ptot = 3; fdc->stat |= 0x90; @@ -2682,7 +2694,7 @@ const device_t fdc_dp8473_device = { .name = "NS DP8473 Floppy Drive Controller", .internal_name = "fdc_dp8473", .flags = 0, - .local = FDC_FLAG_AT | FDC_FLAG_NSC, + .local = FDC_FLAG_AT | FDC_FLAG_NEC | FDC_FLAG_NO_DSR_RESET, .init = fdc_init, .close = fdc_close, .reset = fdc_reset, diff --git a/src/include/86box/fdc.h b/src/include/86box/fdc.h index 9529fde5c..6bb8f081e 100644 --- a/src/include/86box/fdc.h +++ b/src/include/86box/fdc.h @@ -57,6 +57,7 @@ extern int fdc_type; #define FDC_FLAG_QUA 0x3000 /* Is Quaternary */ #define FDC_FLAG_CHANNEL 0x3000 /* Channel mask */ #define FDC_FLAG_NO_DSR_RESET 0x4000 /* Has no DSR reset */ +#define FDC_FLAG_NEC 0x8000 /* Is NEC upd765-compatible */ typedef struct fdc_t { uint8_t dor;