Some FDC, SM(S)C FDC37C66x, and VLSI VL82C480 changes.

This commit is contained in:
OBattler
2025-05-18 08:14:46 +02:00
parent 3f93bde031
commit 7b9b2bc10d
4 changed files with 71 additions and 31 deletions

View File

@@ -469,9 +469,11 @@ fdc_update_drv2en(fdc_t *fdc, int drv2en)
void
fdc_update_rate(fdc_t *fdc, int drive)
{
if (((fdc->rwc[drive] == 1) || (fdc->rwc[drive] == 2)) && fdc->enh_mode)
if (((fdc->rwc[drive] == 1) || (fdc->rwc[drive] == 2)) &&
fdc->enh_mode && !(fdc->flags & FDC_FLAG_SMC661))
fdc->bit_rate = 500;
else if ((fdc->rwc[drive] == 3) && fdc->enh_mode)
else if ((fdc->rwc[drive] == 3) && fdc->enh_mode &&
!(fdc->flags & FDC_FLAG_SMC661))
fdc->bit_rate = 250;
else switch (fdc->rate) {
default:
@@ -535,7 +537,7 @@ fdc_get_bitcell_period(fdc_t *fdc)
static int
fdc_get_densel(fdc_t *fdc, int drive)
{
if (fdc->enh_mode) {
if (fdc->enh_mode && !(fdc->flags & FDC_FLAG_SMC661)) {
switch (fdc->rwc[drive]) {
case 1:
case 3:
@@ -770,8 +772,13 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
return;
case 3: /* TDR */
if (fdc->enh_mode) {
drive = real_drive(fdc, fdc->dor & 3);
fdc_update_rwc(fdc, drive, (val & 0x30) >> 4);
if (fdc->flags & FDC_FLAG_SMC661) {
fdc_set_swap(fdc, !!(val & 0x20));
fdc_update_densel_force(fdc, (val & 0x18) >> 3);
} else {
drive = real_drive(fdc, fdc->dor & 3);
fdc_update_rwc(fdc, drive, (val & 0x30) >> 4);
}
}
/* Bit 2: FIFO test mode (PS/55 5550-S,T only. Undocumented)
The Power-on Self Test of PS/55 writes and verifies 8 bytes of FIFO buffer through I/O 3F5h.
@@ -1391,6 +1398,8 @@ fdc_read(uint16_t addr, void *priv)
/* PS/55 POST throws an error and halt if ret = 1 or 2, somehow. */
} else if (!fdc->enh_mode)
ret = 0x20;
else if (fdc->flags & FDC_FLAG_SMC661)
ret = (fdc->densel_force << 3) | ((!!fdc->swap) << 5) | (fdc->media_id << 6);
else
ret = (fdc->rwc[drive] << 4) | (fdc->media_id << 6);
break;
@@ -2401,6 +2410,8 @@ fdc_init(const device_t *info)
fdc_t *fdc = (fdc_t *) calloc(1, sizeof(fdc_t));
fdc->flags = info->local;
if (fdc->flags & FDC_FLAG_SMC661)
pclog("661!\n");
if (fdc->flags & FDC_FLAG_SEC)
fdc->irq = FDC_SECONDARY_IRQ;
@@ -2644,6 +2655,20 @@ const device_t fdc_at_actlow_device = {
.config = NULL
};
const device_t fdc_at_smc_661_device = {
.name = "PC/AT Floppy Drive Controller (SM(s)C FDC37C661/2)",
.internal_name = "fdc_at_smc",
.flags = 0,
.local = FDC_FLAG_AT | FDC_FLAG_SUPERIO | FDC_FLAG_SMC661,
.init = fdc_init,
.close = fdc_close,
.reset = fdc_reset,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};
const device_t fdc_at_smc_device = {
.name = "PC/AT Floppy Drive Controller (SM(s)C FDC37Cxxx)",
.internal_name = "fdc_at_smc",