fixed a floppy drive access issue

It took a few hours that I noticed fdc.c decides the floppy drive type by the machine name.
This commit is contained in:
Akamaki
2025-02-15 16:44:07 +09:00
parent 16fc5e7902
commit db056e0b66
2 changed files with 5 additions and 7 deletions

View File

@@ -743,7 +743,7 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
/* Bit 2: FIFO test mode (PS/55 only? This is not documented in neither the PS/2 HITR nor the 82077AA datasheet.) /* Bit 2: FIFO test mode (PS/55 only? This is not documented in neither the PS/2 HITR nor the 82077AA datasheet.)
The Power-on Self Test of PS/55 writes and verifies 8 bytes of FIFO buffer through I/O 3F5h. The Power-on Self Test of PS/55 writes and verifies 8 bytes of FIFO buffer through I/O 3F5h.
If it fails, then floppy drives will be treated as DD drives. */ If it fails, then floppy drives will be treated as DD drives. */
if (fdc->flags & FDC_FLAG_PS2) { if (fdc->flags & FDC_FLAG_PS2_MCA) {
if (val & 0x04) if (val & 0x04)
{ {
fdc->tfifo = 8; fdc->tfifo = 8;
@@ -769,6 +769,7 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
case 5: /*Command register*/ case 5: /*Command register*/
if (fdc->fifointest) if (fdc->fifointest)
{ {
/* Write FIFO buffer in the test mode (PS/55) */
fdc_log("FIFO buffer position = %X\n", ((fifo_t *)fdc->fifo_p)->end); fdc_log("FIFO buffer position = %X\n", ((fifo_t *)fdc->fifo_p)->end);
fifo_write(val, fdc->fifo_p); fifo_write(val, fdc->fifo_p);
if (fifo_get_full(fdc->fifo_p)) if (fifo_get_full(fdc->fifo_p))
@@ -1358,10 +1359,7 @@ fdc_read(uint16_t addr, void *priv)
ret = 0x10; ret = 0x10;
else else
ret = 0x00; ret = 0x00;
} /* PS/55 POST throws an error and halt if ret = 1 or 2, somehow. */
else if (fdc->flags & FDC_FLAG_PS2) {
/* error when ret = 1, 2*/
ret = (fdc->fifointest) ? 4 : 0;
} }
else if (!fdc->enh_mode) else if (!fdc->enh_mode)
ret = 0x20; ret = 0x20;
@@ -1374,6 +1372,7 @@ fdc_read(uint16_t addr, void *priv)
case 5: /*Data*/ case 5: /*Data*/
if (fdc->fifointest) if (fdc->fifointest)
{ {
/* Read FIFO buffer in the test mode (PS/55) */
ret = fifo_read(fdc->fifo_p); ret = fifo_read(fdc->fifo_p);
break; break;
} }
@@ -1698,7 +1697,6 @@ fdc_callback(void *priv)
else if (fdc->params[5] == 0) else if (fdc->params[5] == 0)
fdc->sector++; fdc->sector++;
ui_sb_update_icon(SB_FLOPPY | real_drive(fdc, fdc->drive), 1); ui_sb_update_icon(SB_FLOPPY | real_drive(fdc, fdc->drive), 1);
//fdc_log("cb_rwsect: %d %d %d %d %d %xh\n", real_drive(fdc, fdc->drive), fdc->sector, fdc->rw_track, fdc->head, fdc->rate, fdc->params[4]);
switch (fdc->interrupt) { switch (fdc->interrupt) {
case 5: case 5:
case 9: case 9:

View File

@@ -294,7 +294,7 @@ fdd_type_invert_densel(int type)
int ret; int ret;
if (drive_types[type].flags & FLAG_PS2) if (drive_types[type].flags & FLAG_PS2)
ret = (!!strstr(machine_getname(), "PS/1")) || (!!strstr(machine_getname(), "PS/2")); ret = (!!strstr(machine_getname(), "PS/1")) || (!!strstr(machine_getname(), "PS/2")) || (!!strstr(machine_getname(), "PS/55"));
else else
ret = drive_types[type].flags & FLAG_INVERT_DENSEL; ret = drive_types[type].flags & FLAG_INVERT_DENSEL;