Fix the DP8473 FDC flags, closes #4538.

This commit is contained in:
OBattler
2024-06-13 19:01:57 +02:00
parent 5df111568d
commit fb267d1f8b
2 changed files with 14 additions and 1 deletions

View File

@@ -931,6 +931,10 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
fdc->format_state = 0; fdc->format_state = 0;
break; break;
case 0x0e: /*Dump registers*/ case 0x0e: /*Dump registers*/
if (fdc->flags & FDC_FLAG_NEC) {
fdc_bad_command(fdc);
break;
}
fdc->lastdrive = fdc->drive; fdc->lastdrive = fdc->drive;
fdc->interrupt = 0x0e; fdc->interrupt = 0x0e;
fdc_callback(fdc); fdc_callback(fdc);
@@ -949,6 +953,10 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
case 0x10: /*Get version*/ case 0x10: /*Get version*/
case 0x14: /*Unlock*/ case 0x14: /*Unlock*/
case 0x94: /*Lock*/ case 0x94: /*Lock*/
if (fdc->flags & FDC_FLAG_NEC) {
fdc_bad_command(fdc);
break;
}
fdc->lastdrive = fdc->drive; fdc->lastdrive = fdc->drive;
fdc->interrupt = fdc->command; fdc->interrupt = fdc->command;
fdc_callback(fdc); fdc_callback(fdc);
@@ -962,6 +970,10 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
fdc_bad_command(fdc); fdc_bad_command(fdc);
break; break;
case 0x13: /*Configure*/ case 0x13: /*Configure*/
if (fdc->flags & FDC_FLAG_NEC) {
fdc_bad_command(fdc);
break;
}
fdc->pnum = 0; fdc->pnum = 0;
fdc->ptot = 3; fdc->ptot = 3;
fdc->stat |= 0x90; fdc->stat |= 0x90;
@@ -2682,7 +2694,7 @@ const device_t fdc_dp8473_device = {
.name = "NS DP8473 Floppy Drive Controller", .name = "NS DP8473 Floppy Drive Controller",
.internal_name = "fdc_dp8473", .internal_name = "fdc_dp8473",
.flags = 0, .flags = 0,
.local = FDC_FLAG_AT | FDC_FLAG_NSC, .local = FDC_FLAG_AT | FDC_FLAG_NEC | FDC_FLAG_NO_DSR_RESET,
.init = fdc_init, .init = fdc_init,
.close = fdc_close, .close = fdc_close,
.reset = fdc_reset, .reset = fdc_reset,

View File

@@ -57,6 +57,7 @@ extern int fdc_type;
#define FDC_FLAG_QUA 0x3000 /* Is Quaternary */ #define FDC_FLAG_QUA 0x3000 /* Is Quaternary */
#define FDC_FLAG_CHANNEL 0x3000 /* Channel mask */ #define FDC_FLAG_CHANNEL 0x3000 /* Channel mask */
#define FDC_FLAG_NO_DSR_RESET 0x4000 /* Has no DSR reset */ #define FDC_FLAG_NO_DSR_RESET 0x4000 /* Has no DSR reset */
#define FDC_FLAG_NEC 0x8000 /* Is NEC upd765-compatible */
typedef struct fdc_t { typedef struct fdc_t {
uint8_t dor; uint8_t dor;