2017-05-30 03:38:38 +02:00
|
|
|
/*
|
2022-11-13 16:37:58 -05:00
|
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
|
|
|
* running old operating systems and software designed for IBM
|
|
|
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
|
|
|
* system designs based on the PCI bus.
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
2022-11-13 16:37:58 -05:00
|
|
|
* This file is part of the 86Box distribution.
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
2022-11-13 16:37:58 -05:00
|
|
|
* Implementation of the NEC uPD-765 and compatible floppy disk
|
|
|
|
|
* controller.
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
2020-03-25 00:46:02 +02:00
|
|
|
*
|
2017-05-30 03:38:38 +02:00
|
|
|
*
|
2023-01-06 15:36:29 -05:00
|
|
|
* Authors: Sarah Walker, <https://pcem-emulator.co.uk/>
|
2022-11-13 16:37:58 -05:00
|
|
|
* Miran Grca, <mgrca8@gmail.com>
|
2017-10-17 01:59:09 -04:00
|
|
|
*
|
2022-11-13 16:37:58 -05:00
|
|
|
* Copyright 2008-2020 Sarah Walker.
|
|
|
|
|
* Copyright 2016-2020 Miran Grca.
|
2017-05-30 03:38:38 +02:00
|
|
|
*/
|
2016-06-26 00:34:39 +02:00
|
|
|
#include <stdio.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <stdint.h>
|
2018-01-17 18:43:36 +01:00
|
|
|
#include <stdlib.h>
|
2016-06-26 00:34:39 +02:00
|
|
|
#include <string.h>
|
2017-09-25 04:31:20 -04:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <wchar.h>
|
2018-01-17 18:43:36 +01:00
|
|
|
#define HAVE_STDARG_H
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/86box.h>
|
|
|
|
|
#include <86box/device.h>
|
2020-02-29 19:12:23 +01:00
|
|
|
#include "cpu.h"
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/machine.h>
|
|
|
|
|
#include <86box/io.h>
|
|
|
|
|
#include <86box/dma.h>
|
|
|
|
|
#include <86box/pic.h>
|
|
|
|
|
#include <86box/timer.h>
|
|
|
|
|
#include <86box/ui.h>
|
|
|
|
|
#include <86box/fdd.h>
|
|
|
|
|
#include <86box/fdc.h>
|
2020-06-16 16:41:35 +02:00
|
|
|
#include <86box/fdc_ext.h>
|
2023-07-26 10:57:01 -04:00
|
|
|
#include <86box/plat_fallthrough.h>
|
2023-06-26 12:47:04 -04:00
|
|
|
#include <86box/plat_unused.h>
|
2017-09-04 01:52:29 -04:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
extern uint64_t motoron[FDD_NUM];
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2020-06-21 01:08:05 +02:00
|
|
|
const uint8_t command_has_drivesel[32] = {
|
2022-09-18 17:14:15 -04:00
|
|
|
0, 0,
|
|
|
|
|
1, /* READ TRACK */
|
|
|
|
|
0,
|
|
|
|
|
1, /* SENSE DRIVE STATUS */
|
|
|
|
|
1, /* WRITE DATA */
|
|
|
|
|
1, /* READ DATA */
|
|
|
|
|
1, /* RECALIBRATE */
|
|
|
|
|
0,
|
|
|
|
|
1, /* WRITE DELETED DATA */
|
|
|
|
|
1, /* READ ID */
|
|
|
|
|
0,
|
|
|
|
|
1, /* READ DELETED DATA */
|
|
|
|
|
1, /* FORMAT TRACK */
|
|
|
|
|
0,
|
|
|
|
|
1, /* SEEK, RELATIVE SEEK */
|
|
|
|
|
0,
|
|
|
|
|
1, /* SCAN EQUAL */
|
|
|
|
|
0, 0, 0, 0,
|
|
|
|
|
1, /* VERIFY */
|
|
|
|
|
0, 0,
|
|
|
|
|
1, /* SCAN LOW OR EQUAL */
|
|
|
|
|
0, 0, 0,
|
|
|
|
|
1, /* SCAN HIGH OR EQUAL */
|
|
|
|
|
0, 0
|
2017-09-04 01:52:29 -04:00
|
|
|
};
|
2016-11-02 22:39:07 +01:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
static uint8_t current_drive = 0;
|
2018-01-17 18:43:36 +01:00
|
|
|
|
|
|
|
|
static void fdc_callback(void *priv);
|
2022-09-18 17:14:15 -04:00
|
|
|
int lastbyte = 0;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2017-09-04 01:52:29 -04:00
|
|
|
int floppymodified[4];
|
|
|
|
|
int floppyrate[4];
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2020-06-17 14:29:24 +02:00
|
|
|
int fdc_type = 0;
|
2020-06-16 16:25:23 +02:00
|
|
|
|
2017-10-19 21:08:34 -04:00
|
|
|
#ifdef ENABLE_FDC_LOG
|
|
|
|
|
int fdc_do_log = ENABLE_FDC_LOG;
|
2017-01-16 01:49:19 +01:00
|
|
|
|
2017-11-24 02:23:00 -05:00
|
|
|
static void
|
2017-12-09 01:03:44 -05:00
|
|
|
fdc_log(const char *fmt, ...)
|
2017-01-16 01:49:19 +01:00
|
|
|
{
|
2022-09-18 17:14:15 -04:00
|
|
|
va_list ap;
|
2017-12-05 23:35:35 +01:00
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
if (fdc_do_log) {
|
|
|
|
|
va_start(ap, fmt);
|
|
|
|
|
pclog_ex(fmt, ap);
|
|
|
|
|
va_end(ap);
|
|
|
|
|
}
|
2017-01-16 01:49:19 +01:00
|
|
|
}
|
2018-10-19 00:39:32 +02:00
|
|
|
#else
|
2022-09-18 17:14:15 -04:00
|
|
|
# define fdc_log(fmt, ...)
|
2018-10-19 00:39:32 +02:00
|
|
|
#endif
|
2017-01-16 01:49:19 +01:00
|
|
|
|
2023-06-26 12:47:04 -04:00
|
|
|
#if 0
|
2022-10-27 12:19:51 -04:00
|
|
|
const device_t fdc_none_device = {
|
|
|
|
|
.name = "None",
|
|
|
|
|
.internal_name = "none",
|
|
|
|
|
.flags = 0,
|
|
|
|
|
.local = 0,
|
|
|
|
|
.init = NULL,
|
|
|
|
|
.close = NULL,
|
|
|
|
|
.reset = NULL,
|
|
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
|
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
|
|
|
|
};
|
2023-06-26 12:47:04 -04:00
|
|
|
#endif
|
2022-10-27 12:19:51 -04:00
|
|
|
|
2022-02-02 18:08:43 -05:00
|
|
|
const device_t fdc_internal_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "Internal",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "internal",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = 0,
|
|
|
|
|
.init = NULL,
|
|
|
|
|
.close = NULL,
|
|
|
|
|
.reset = NULL,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2022-02-02 18:08:43 -05:00
|
|
|
};
|
|
|
|
|
|
2020-06-17 14:29:24 +02:00
|
|
|
typedef const struct {
|
2022-09-18 17:14:15 -04:00
|
|
|
const device_t *device;
|
2020-06-17 14:29:24 +02:00
|
|
|
} fdc_cards_t;
|
|
|
|
|
|
|
|
|
|
static fdc_cards_t fdc_cards[] = {
|
2022-09-18 17:14:15 -04:00
|
|
|
// clang-format off
|
2023-06-26 12:47:04 -04:00
|
|
|
#if 0
|
|
|
|
|
{ &fdc_none_device },
|
|
|
|
|
#endif
|
2022-03-13 09:38:53 -04:00
|
|
|
{ &fdc_internal_device },
|
|
|
|
|
{ &fdc_b215_device },
|
|
|
|
|
{ &fdc_pii151b_device },
|
|
|
|
|
{ &fdc_pii158b_device },
|
2022-12-21 16:14:59 -05:00
|
|
|
{ &fdc_monster_device },
|
2022-03-13 09:38:53 -04:00
|
|
|
{ NULL }
|
2022-09-18 17:14:15 -04:00
|
|
|
// clang-format on
|
2020-06-16 16:25:23 +02:00
|
|
|
};
|
|
|
|
|
|
2020-06-17 14:29:24 +02:00
|
|
|
int
|
|
|
|
|
fdc_card_available(int card)
|
2020-06-16 16:37:48 +02:00
|
|
|
{
|
2020-06-17 14:29:24 +02:00
|
|
|
if (fdc_cards[card].device)
|
2022-09-18 17:14:15 -04:00
|
|
|
return (device_available(fdc_cards[card].device));
|
2020-06-17 14:29:24 +02:00
|
|
|
|
2023-05-16 15:43:20 -04:00
|
|
|
return 1;
|
2020-06-16 16:37:48 +02:00
|
|
|
}
|
|
|
|
|
|
2020-06-17 14:29:24 +02:00
|
|
|
const device_t *
|
|
|
|
|
fdc_card_getdevice(int card)
|
2020-06-16 16:25:23 +02:00
|
|
|
{
|
2022-09-18 17:14:15 -04:00
|
|
|
return (fdc_cards[card].device);
|
2020-06-16 16:25:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2020-06-17 14:29:24 +02:00
|
|
|
fdc_card_has_config(int card)
|
2020-06-16 16:25:23 +02:00
|
|
|
{
|
2022-09-18 17:14:15 -04:00
|
|
|
if (!fdc_cards[card].device)
|
2023-05-16 15:43:20 -04:00
|
|
|
return 0;
|
2020-06-17 14:29:24 +02:00
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
return (device_has_config(fdc_cards[card].device) ? 1 : 0);
|
2020-06-17 14:29:24 +02:00
|
|
|
}
|
|
|
|
|
|
2023-08-21 20:23:04 -04:00
|
|
|
const char *
|
2020-06-17 14:29:24 +02:00
|
|
|
fdc_card_get_internal_name(int card)
|
|
|
|
|
{
|
2022-02-03 03:10:06 +01:00
|
|
|
return device_get_internal_name(fdc_cards[card].device);
|
2020-06-16 16:25:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2020-06-17 14:29:24 +02:00
|
|
|
fdc_card_get_from_internal_name(char *s)
|
2020-06-16 16:25:23 +02:00
|
|
|
{
|
|
|
|
|
int c = 0;
|
|
|
|
|
|
2022-02-03 03:10:06 +01:00
|
|
|
while (fdc_cards[c].device != NULL) {
|
2023-08-21 20:23:04 -04:00
|
|
|
if (!strcmp(fdc_cards[c].device->internal_name, s))
|
2023-05-16 15:43:20 -04:00
|
|
|
return c;
|
2022-09-18 17:14:15 -04:00
|
|
|
c++;
|
2020-06-16 16:25:23 +02:00
|
|
|
}
|
2022-02-20 02:26:27 -05:00
|
|
|
|
2023-05-16 15:43:20 -04:00
|
|
|
return 0;
|
2020-06-16 16:25:23 +02:00
|
|
|
}
|
|
|
|
|
|
2020-06-17 14:29:24 +02:00
|
|
|
void
|
|
|
|
|
fdc_card_init(void)
|
2020-06-16 16:25:23 +02:00
|
|
|
{
|
2020-06-17 14:29:24 +02:00
|
|
|
if (!fdc_cards[fdc_type].device)
|
2022-09-18 17:14:15 -04:00
|
|
|
return;
|
2020-06-16 16:25:23 +02:00
|
|
|
|
2020-06-17 14:29:24 +02:00
|
|
|
device_add(fdc_cards[fdc_type].device);
|
2020-06-16 16:25:23 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
uint8_t
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
fdc_get_current_drive(void)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
return current_drive;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
2016-08-15 01:34:46 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
2023-06-28 13:46:28 -04:00
|
|
|
fdc_ctrl_reset(void *priv)
|
2016-11-11 03:16:41 +01:00
|
|
|
{
|
2023-06-28 13:46:28 -04:00
|
|
|
fdc_t *fdc = (fdc_t *) priv;
|
2018-01-17 18:43:36 +01:00
|
|
|
|
|
|
|
|
fdc->stat = 0x80;
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->pnum = fdc->ptot = 0;
|
|
|
|
|
fdc->st0 = 0;
|
|
|
|
|
fdc->lock = 0;
|
|
|
|
|
fdc->head = 0;
|
|
|
|
|
fdc->step = 0;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if (!(fdc->flags & FDC_FLAG_AT))
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->rate = 2;
|
2016-11-11 03:16:41 +01:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
sector_id_t
|
|
|
|
|
fdc_get_read_track_sector(fdc_t *fdc)
|
2017-03-05 19:42:56 +01:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->read_track_sector;
|
2017-03-05 19:42:56 +01:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_get_compare_condition(fdc_t *fdc)
|
2016-10-05 05:37:07 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
switch (fdc->interrupt) {
|
2022-09-18 17:14:15 -04:00
|
|
|
default:
|
2023-06-28 13:46:28 -04:00
|
|
|
case 0x11:
|
2022-09-18 17:14:15 -04:00
|
|
|
return 0;
|
|
|
|
|
case 0x19:
|
|
|
|
|
return 1;
|
|
|
|
|
case 0x1D:
|
|
|
|
|
return 2;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
2016-10-05 05:37:07 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_is_deleted(fdc_t *fdc)
|
2016-10-05 00:47:50 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->deleted & 1;
|
2016-10-05 00:47:50 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_is_sk(fdc_t *fdc)
|
2016-10-05 00:47:50 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return (fdc->deleted & 0x20) ? 1 : 0;
|
2016-10-05 00:47:50 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_set_wrong_am(fdc_t *fdc)
|
2016-10-05 00:47:50 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->wrong_am = 1;
|
2016-10-05 00:47:50 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_get_drive(fdc_t *fdc)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->drive;
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
int fdc_get_bitcell_period(fdc_t *fdc);
|
|
|
|
|
int fdc_get_bit_rate(fdc_t *fdc);
|
|
|
|
|
static void fdc_rate(fdc_t *fdc, int drive);
|
2018-01-17 18:43:36 +01:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
fdc_get_perp(fdc_t *fdc)
|
2016-09-17 20:22:02 +02:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
if (!(fdc->flags & FDC_FLAG_AT) || (fdc->flags & FDC_FLAG_PCJR))
|
2022-09-18 17:14:15 -04:00
|
|
|
return 0;
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->perp;
|
2016-09-17 20:22:02 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_get_gap2(fdc_t *fdc, int drive)
|
2016-09-22 21:22:56 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
int auto_gap2 = 22;
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (!(fdc->flags & FDC_FLAG_AT) || (fdc->flags & FDC_FLAG_PCJR))
|
2022-09-18 17:14:15 -04:00
|
|
|
return 22;
|
2016-09-22 21:22:56 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
if (fdc->perp & 3)
|
2022-09-18 17:14:15 -04:00
|
|
|
return ((fdc->perp & 3) == 3) ? 41 : 22;
|
2018-01-17 18:43:36 +01:00
|
|
|
else {
|
2022-09-18 17:14:15 -04:00
|
|
|
auto_gap2 = (fdc_get_bit_rate(fdc) >= 3) ? 41 : 22;
|
|
|
|
|
return (fdc->perp & (4 << drive)) ? auto_gap2 : 22;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
2016-09-22 21:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_get_format_n(fdc_t *fdc)
|
2016-08-31 22:49:56 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->format_n;
|
2016-08-31 22:49:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_is_mfm(fdc_t *fdc)
|
2016-08-21 03:42:24 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->mfm ? 1 : 0;
|
2016-08-21 03:42:24 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_request_next_sector_id(fdc_t *fdc)
|
2016-08-20 03:40:12 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->dma)
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->stat = 0xf0;
|
2022-07-20 19:56:49 +02:00
|
|
|
else {
|
2022-09-18 17:14:15 -04:00
|
|
|
dma_set_drq(fdc->dma_ch, 1);
|
|
|
|
|
fdc->stat = 0xd0;
|
2022-07-20 19:56:49 +02:00
|
|
|
}
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_stop_id_request(fdc_t *fdc)
|
2016-08-20 03:40:12 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->stat &= 0x7f;
|
2016-08-20 03:40:12 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_get_gap(fdc_t *fdc)
|
2016-08-15 01:34:46 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->gap;
|
2016-08-15 01:34:46 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_get_dtl(fdc_t *fdc)
|
2016-08-15 01:34:46 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->dtl;
|
2016-08-15 01:34:46 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_get_format_sectors(fdc_t *fdc)
|
2016-08-15 01:34:46 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->format_sectors;
|
2016-08-15 01:34:46 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static void
|
|
|
|
|
fdc_reset_fifo_buf(fdc_t *fdc)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
memset(fdc->fifobuf, 0, 16);
|
|
|
|
|
fdc->fifobufpos = 0;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static void
|
|
|
|
|
fdc_fifo_buf_advance(fdc_t *fdc)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
if (fdc->fifobufpos == fdc->tfifo)
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->fifobufpos = 0;
|
2018-01-17 18:43:36 +01:00
|
|
|
else
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->fifobufpos++;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static void
|
|
|
|
|
fdc_fifo_buf_write(fdc_t *fdc, uint8_t val)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->fifobuf[fdc->fifobufpos] = val;
|
|
|
|
|
fdc_fifo_buf_advance(fdc);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static int
|
|
|
|
|
fdc_fifo_buf_read(fdc_t *fdc)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
int temp = fdc->fifobuf[fdc->fifobufpos];
|
|
|
|
|
fdc_fifo_buf_advance(fdc);
|
2018-02-02 04:54:35 +01:00
|
|
|
if (!fdc->fifobufpos)
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->data_ready = 0;
|
2018-01-17 18:43:36 +01:00
|
|
|
return temp;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
static void
|
|
|
|
|
fdc_int(fdc_t *fdc, int set_fintr)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-02-02 18:39:48 +01:00
|
|
|
int ienable = 0;
|
|
|
|
|
|
|
|
|
|
if (!(fdc->flags & FDC_FLAG_PCJR))
|
2022-09-18 17:14:15 -04:00
|
|
|
ienable = !!(fdc->dor & 8);
|
2018-02-02 18:39:48 +01:00
|
|
|
|
|
|
|
|
if (ienable)
|
2022-09-18 17:14:15 -04:00
|
|
|
picint(1 << fdc->irq);
|
2018-02-02 18:39:48 +01:00
|
|
|
|
2019-09-26 09:53:02 +02:00
|
|
|
if (set_fintr)
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->fintr = 1;
|
2019-09-26 09:53:02 +02:00
|
|
|
fdc_log("fdc_int(%i): fdc->fintr = %i\n", set_fintr, fdc->fintr);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static void
|
|
|
|
|
fdc_watchdog_poll(void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_t *fdc = (fdc_t *) priv;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->watchdog_count--;
|
|
|
|
|
if (fdc->watchdog_count)
|
2022-09-18 17:14:15 -04:00
|
|
|
timer_advance_u64(&fdc->watchdog_timer, 1000 * TIMER_USEC);
|
2018-01-17 18:43:36 +01:00
|
|
|
else {
|
2022-09-18 17:14:15 -04:00
|
|
|
if (fdc->dor & 0x20)
|
|
|
|
|
picint(1 << fdc->irq);
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
/* fdc->rwc per Winbond W83877F datasheet:
|
|
|
|
|
0 = normal;
|
|
|
|
|
1 = 500 kbps, 360 rpm;
|
|
|
|
|
2 = 500 kbps, 300 rpm;
|
|
|
|
|
3 = 250 kbps
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
Drive is only aware of selected rate and densel, so on real hardware, the rate expected by fdc_t and the rate actually being
|
|
|
|
|
processed by drive can mismatch, in which case the fdc_t won't receive the correct data.
|
|
|
|
|
*/
|
2016-09-14 23:18:14 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_update_rates(fdc_t *fdc)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_rate(fdc, 0);
|
|
|
|
|
fdc_rate(fdc, 1);
|
|
|
|
|
fdc_rate(fdc, 2);
|
|
|
|
|
fdc_rate(fdc, 3);
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_update_max_track(fdc_t *fdc, int max_track)
|
2016-09-14 23:18:14 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->max_track = max_track;
|
2016-09-14 23:18:14 +02:00
|
|
|
}
|
2016-09-07 03:00:52 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_update_enh_mode(fdc_t *fdc, int enh_mode)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->enh_mode = enh_mode;
|
|
|
|
|
fdc_update_rates(fdc);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_get_rwc(fdc_t *fdc, int drive)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->rwc[drive];
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_update_rwc(fdc_t *fdc, int drive, int rwc)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_log("FDD %c: New RWC is %i\n", 0x41 + drive, rwc);
|
|
|
|
|
fdc->rwc[drive] = rwc;
|
|
|
|
|
fdc_rate(fdc, drive);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_get_boot_drive(fdc_t *fdc)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->boot_drive;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_update_boot_drive(fdc_t *fdc, int boot_drive)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->boot_drive = boot_drive;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_update_densel_polarity(fdc_t *fdc, int densel_polarity)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_log("FDC: New DENSEL polarity is %i\n", densel_polarity);
|
|
|
|
|
fdc->densel_polarity = densel_polarity;
|
|
|
|
|
fdc_update_rates(fdc);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
uint8_t
|
|
|
|
|
fdc_get_densel_polarity(fdc_t *fdc)
|
2016-09-14 23:18:14 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->densel_polarity;
|
2016-09-14 23:18:14 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_update_densel_force(fdc_t *fdc, int densel_force)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_log("FDC: New DENSEL force is %i\n", densel_force);
|
|
|
|
|
fdc->densel_force = densel_force;
|
|
|
|
|
fdc_update_rates(fdc);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_update_drvrate(fdc_t *fdc, int drive, int drvrate)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_log("FDD %c: New drive rate is %i\n", 0x41 + drive, drvrate);
|
|
|
|
|
fdc->drvrate[drive] = drvrate;
|
|
|
|
|
fdc_rate(fdc, drive);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_update_drv2en(fdc_t *fdc, int drv2en)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->drv2en = drv2en;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_update_rate(fdc_t *fdc, int drive)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
if (((fdc->rwc[drive] == 1) || (fdc->rwc[drive] == 2)) && fdc->enh_mode)
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->bit_rate = 500;
|
2018-01-17 18:43:36 +01:00
|
|
|
else if ((fdc->rwc[drive] == 3) && fdc->enh_mode)
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->bit_rate = 250;
|
|
|
|
|
else
|
|
|
|
|
switch (fdc->rate) {
|
|
|
|
|
case 0: /*High density*/
|
|
|
|
|
fdc->bit_rate = 500;
|
|
|
|
|
break;
|
|
|
|
|
case 1: /*Double density (360 rpm)*/
|
|
|
|
|
switch (fdc->drvrate[drive]) {
|
|
|
|
|
case 0:
|
|
|
|
|
fdc->bit_rate = 300;
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
fdc->bit_rate = 500;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
fdc->bit_rate = 2000;
|
|
|
|
|
break;
|
2023-06-28 13:46:28 -04:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2022-09-18 17:14:15 -04:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 2: /*Double density*/
|
|
|
|
|
fdc->bit_rate = 250;
|
|
|
|
|
break;
|
|
|
|
|
case 3: /*Extended density*/
|
|
|
|
|
fdc->bit_rate = 1000;
|
|
|
|
|
break;
|
2023-06-28 13:46:28 -04:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2022-09-18 17:14:15 -04:00
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2020-06-19 12:02:17 +02:00
|
|
|
fdc->bitcell_period = (1000000 / fdc->bit_rate) * 2; /*Bitcell period in ns*/
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_get_bit_rate(fdc_t *fdc)
|
2016-08-31 22:49:56 +02:00
|
|
|
{
|
2022-09-18 17:14:15 -04:00
|
|
|
switch (fdc->bit_rate) {
|
|
|
|
|
case 500:
|
|
|
|
|
return 0;
|
|
|
|
|
case 300:
|
|
|
|
|
return 1;
|
|
|
|
|
case 2000:
|
|
|
|
|
return 1 | 4;
|
|
|
|
|
case 250:
|
|
|
|
|
return 2;
|
|
|
|
|
case 1000:
|
|
|
|
|
return 3;
|
2023-06-28 13:46:28 -04:00
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
default:
|
2023-06-28 13:46:28 -04:00
|
|
|
break;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
return 2;
|
2016-08-31 22:49:56 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_get_bitcell_period(fdc_t *fdc)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->bitcell_period;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static int
|
|
|
|
|
fdc_get_densel(fdc_t *fdc, int drive)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
if (fdc->enh_mode) {
|
2022-09-18 17:14:15 -04:00
|
|
|
switch (fdc->rwc[drive]) {
|
|
|
|
|
case 1:
|
|
|
|
|
case 3:
|
|
|
|
|
return 0;
|
|
|
|
|
case 2:
|
|
|
|
|
return 1;
|
2023-06-28 13:46:28 -04:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2022-09-18 17:14:15 -04:00
|
|
|
}
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
if (!(fdc->flags & FDC_FLAG_NSC)) {
|
2022-09-18 17:14:15 -04:00
|
|
|
switch (fdc->densel_force) {
|
|
|
|
|
case 2:
|
|
|
|
|
return 1;
|
|
|
|
|
case 3:
|
|
|
|
|
return 0;
|
2023-06-28 13:46:28 -04:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2022-09-18 17:14:15 -04:00
|
|
|
}
|
2018-01-17 18:43:36 +01:00
|
|
|
} else {
|
2022-09-18 17:14:15 -04:00
|
|
|
switch (fdc->densel_force) {
|
|
|
|
|
case 0:
|
|
|
|
|
return 0;
|
|
|
|
|
case 1:
|
|
|
|
|
return 1;
|
2023-06-28 13:46:28 -04:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2022-09-18 17:14:15 -04:00
|
|
|
}
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
2017-05-05 01:49:42 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
switch (fdc->rate) {
|
2022-09-18 17:14:15 -04:00
|
|
|
case 0:
|
|
|
|
|
case 3:
|
|
|
|
|
return fdc->densel_polarity ? 1 : 0;
|
|
|
|
|
case 1:
|
|
|
|
|
case 2:
|
|
|
|
|
return fdc->densel_polarity ? 0 : 1;
|
2023-06-28 13:46:28 -04:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
fdc_rate(fdc_t *fdc, int drive)
|
|
|
|
|
{
|
|
|
|
|
fdc_update_rate(fdc, drive);
|
2023-06-26 12:47:04 -04:00
|
|
|
#if 0
|
|
|
|
|
fdc_log("FDD %c: Setting rate: %i, %i, %i (%i, %i)\n", 0x41 + drive, fdc->drvrate[drive], fdc->rate, fdc_get_densel(fdc, drive), fdc->rwc[drive], fdc->densel_force);
|
|
|
|
|
#endif
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
fdc_log("FDD %c: [%i] Setting rate: %i, %i, %i (%i, %i, %i)\n", 0x41 + drive, fdc->enh_mode, fdc->drvrate[drive], fdc->rate, fdc_get_densel(fdc, drive), fdc->rwc[drive], fdc->densel_force, fdc->densel_polarity);
|
2018-01-17 18:43:36 +01:00
|
|
|
fdd_set_densel(fdc_get_densel(fdc, drive));
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
fdc_log("FDD %c: [%i] Densel: %i\n", 0x41 + drive, fdc->enh_mode, fdc_get_densel(fdc, drive));
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
real_drive(fdc_t *fdc, int drive)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
if (drive < 2)
|
2022-09-18 17:14:15 -04:00
|
|
|
return drive ^ fdc->swap;
|
2018-01-17 18:43:36 +01:00
|
|
|
else
|
2022-09-18 17:14:15 -04:00
|
|
|
return drive;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_seek(fdc_t *fdc, int drive, int params)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdd_seek(real_drive(fdc, drive), params);
|
|
|
|
|
fdc->stat |= (1 << fdc->drive);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static void
|
|
|
|
|
fdc_bad_command(fdc_t *fdc)
|
2016-12-24 05:37:14 +01:00
|
|
|
{
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->stat = 0x10;
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->interrupt = 0xfc;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
timer_set_delay_u64(&fdc->timer, 100 * TIMER_USEC);
|
2016-12-24 05:37:14 +01:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static void
|
|
|
|
|
fdc_io_command_phase1(fdc_t *fdc, int out)
|
|
|
|
|
{
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
#if 0
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
pclog_toggle_suppr();
|
|
|
|
|
pclog("%02X ", fdc->processed_cmd);
|
|
|
|
|
for (i = 0; i < fdc->pnum; i++)
|
2023-01-06 15:36:05 -05:00
|
|
|
pclog("%02X ", fdc->params[i]);
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
pclog("\n");
|
|
|
|
|
pclog_toggle_suppr();
|
|
|
|
|
#endif
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_reset_fifo_buf(fdc);
|
|
|
|
|
fdc_rate(fdc, fdc->drive);
|
|
|
|
|
fdc->head = fdc->params[2];
|
|
|
|
|
fdd_set_head(real_drive(fdc, fdc->drive), (fdc->params[0] & 4) ? 1 : 0);
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->sector = fdc->params[3];
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->eot[fdc->drive] = fdc->params[5];
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->gap = fdc->params[6];
|
|
|
|
|
fdc->dtl = fdc->params[7];
|
|
|
|
|
fdc->rw_track = fdc->params[1];
|
2020-06-20 22:34:51 +02:00
|
|
|
|
|
|
|
|
if (fdc->config & 0x40) {
|
2022-09-18 17:14:15 -04:00
|
|
|
if (fdc->rw_track != fdc->pcn[fdc->params[0] & 3]) {
|
|
|
|
|
fdc_seek(fdc, fdc->drive, ((int) fdc->rw_track) - ((int) fdc->pcn[fdc->params[0] & 3]));
|
|
|
|
|
fdc->pcn[fdc->params[0] & 3] = fdc->rw_track;
|
|
|
|
|
}
|
2020-06-20 22:34:51 +02:00
|
|
|
}
|
|
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
ui_sb_update_icon(SB_FLOPPY | real_drive(fdc, fdc->drive), 1);
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->stat = out ? 0x90 : 0x50;
|
|
|
|
|
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->dma)
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->stat |= 0x20;
|
2022-07-20 19:56:49 +02:00
|
|
|
else
|
2022-09-18 17:14:15 -04:00
|
|
|
dma_set_drq(fdc->dma_ch, 1);
|
2020-06-23 18:48:16 +02:00
|
|
|
if (out)
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->pos = 0;
|
2020-06-23 18:48:16 +02:00
|
|
|
else
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->inread = 1;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
|
2018-02-02 04:54:35 +01:00
|
|
|
static void
|
|
|
|
|
fdc_sis(fdc_t *fdc)
|
|
|
|
|
{
|
|
|
|
|
int drive_num;
|
|
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->stat = (fdc->stat & 0xf) | 0xd0;
|
2018-02-02 04:54:35 +01:00
|
|
|
|
2018-02-02 18:39:48 +01:00
|
|
|
if (fdc->reset_stat) {
|
2022-09-18 17:14:15 -04:00
|
|
|
drive_num = real_drive(fdc, 4 - fdc->reset_stat);
|
|
|
|
|
if ((drive_num < FDD_NUM) && fdd_get_flags(drive_num)) {
|
|
|
|
|
fdd_stop(drive_num);
|
|
|
|
|
fdd_set_head(drive_num, 0);
|
|
|
|
|
fdc->res[9] = 0xc0 | (4 - fdc->reset_stat) | (fdd_get_head(drive_num) ? 4 : 0);
|
|
|
|
|
} else
|
|
|
|
|
fdc->res[9] = 0xc0 | (4 - fdc->reset_stat);
|
|
|
|
|
|
|
|
|
|
fdc->reset_stat--;
|
2018-02-02 04:54:35 +01:00
|
|
|
} else {
|
2022-09-18 17:14:15 -04:00
|
|
|
if (fdc->fintr) {
|
|
|
|
|
fdc->res[9] = (fdc->st0 & ~0x04) | (fdd_get_head(real_drive(fdc, fdc->drive)) ? 4 : 0);
|
|
|
|
|
fdc->fintr = 0;
|
|
|
|
|
} else {
|
|
|
|
|
fdc->res[10] = 0x80;
|
|
|
|
|
fdc->paramstogo = 1;
|
|
|
|
|
return;
|
|
|
|
|
}
|
2018-02-02 04:54:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fdc->res[10] = fdc->pcn[fdc->res[9] & 3];
|
|
|
|
|
|
|
|
|
|
fdc_log("Sense interrupt status: 2 parameters to go\n");
|
|
|
|
|
fdc->paramstogo = 2;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static void
|
|
|
|
|
fdc_write(uint16_t addr, uint8_t val, void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_t *fdc = (fdc_t *) priv;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2023-05-16 15:43:20 -04:00
|
|
|
int drive;
|
|
|
|
|
int i;
|
|
|
|
|
int drive_num;
|
2017-05-05 01:49:42 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_log("Write FDC %04X %02X\n", addr, val);
|
|
|
|
|
|
2020-11-26 18:20:24 +01:00
|
|
|
cycles -= ISA_CYCLES(8);
|
2018-03-10 21:46:38 +01:00
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
switch (addr & 7) {
|
|
|
|
|
case 0:
|
|
|
|
|
return;
|
|
|
|
|
case 1:
|
|
|
|
|
return;
|
|
|
|
|
case 2: /*DOR*/
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PCJR) {
|
|
|
|
|
if ((fdc->dor & 0x40) && !(val & 0x40)) {
|
|
|
|
|
timer_set_delay_u64(&fdc->watchdog_timer, 1000 * TIMER_USEC);
|
|
|
|
|
fdc->watchdog_count = 1000;
|
|
|
|
|
picintc(1 << fdc->irq);
|
|
|
|
|
}
|
|
|
|
|
if ((val & 0x80) && !(fdc->dor & 0x80)) {
|
|
|
|
|
timer_set_delay_u64(&fdc->timer, 8 * TIMER_USEC);
|
|
|
|
|
fdc->interrupt = -1;
|
|
|
|
|
ui_sb_update_icon(SB_FLOPPY | 0, 0);
|
|
|
|
|
fdc_ctrl_reset(fdc);
|
|
|
|
|
fdd_changed[0] = 1;
|
|
|
|
|
}
|
|
|
|
|
if (!fdd_get_flags(0))
|
|
|
|
|
val &= 0xfe;
|
|
|
|
|
fdd_set_motor_enable(0, val & 0x01);
|
|
|
|
|
fdc->st0 &= ~0x07;
|
|
|
|
|
fdc->st0 |= (fdd_get_head(0) ? 4 : 0);
|
|
|
|
|
} else {
|
|
|
|
|
if (!(val & 8) && (fdc->dor & 8)) {
|
|
|
|
|
fdc->tc = 1;
|
|
|
|
|
fdc_int(fdc, 1);
|
|
|
|
|
}
|
|
|
|
|
if (!(val & 4)) {
|
|
|
|
|
fdd_stop(real_drive(fdc, val & 3));
|
|
|
|
|
fdc->stat = 0x00;
|
|
|
|
|
fdc->pnum = fdc->ptot = 0;
|
|
|
|
|
}
|
|
|
|
|
if ((val & 4) && !(fdc->dor & 4)) {
|
|
|
|
|
timer_set_delay_u64(&fdc->timer, 8 * TIMER_USEC);
|
|
|
|
|
fdc->interrupt = -1;
|
|
|
|
|
fdc->perp &= 0xfc;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < FDD_NUM; i++)
|
|
|
|
|
ui_sb_update_icon(SB_FLOPPY | i, 0);
|
|
|
|
|
|
|
|
|
|
fdc_ctrl_reset(fdc);
|
|
|
|
|
}
|
|
|
|
|
/* We can now simplify this since each motor now spins separately. */
|
|
|
|
|
for (i = 0; i < FDD_NUM; i++) {
|
|
|
|
|
drive_num = real_drive(fdc, i);
|
|
|
|
|
if ((!fdd_get_flags(drive_num)) || (drive_num >= FDD_NUM))
|
|
|
|
|
val &= ~(0x10 << drive_num);
|
|
|
|
|
else
|
|
|
|
|
fdd_set_motor_enable(i, (val & (0x10 << drive_num)));
|
|
|
|
|
}
|
|
|
|
|
drive_num = real_drive(fdc, val & 0x03);
|
|
|
|
|
current_drive = drive_num;
|
|
|
|
|
fdc->st0 = (fdc->st0 & 0xf8) | (val & 0x03) | (fdd_get_head(drive_num) ? 4 : 0);
|
|
|
|
|
}
|
|
|
|
|
fdc->dor = val;
|
|
|
|
|
return;
|
|
|
|
|
case 3: /* TDR */
|
|
|
|
|
if (fdc->enh_mode) {
|
|
|
|
|
drive = real_drive(fdc, fdc->dor & 3);
|
|
|
|
|
fdc_update_rwc(fdc, drive, (val & 0x30) >> 4);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
case 4:
|
|
|
|
|
if (val & 0x80) {
|
|
|
|
|
timer_set_delay_u64(&fdc->timer, 8 * TIMER_USEC);
|
|
|
|
|
fdc->interrupt = -1;
|
|
|
|
|
fdc->perp &= 0xfc;
|
|
|
|
|
fdc_ctrl_reset(fdc);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
case 5: /*Command register*/
|
|
|
|
|
if ((fdc->stat & 0xf0) == 0xb0) {
|
|
|
|
|
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->fifo) {
|
|
|
|
|
fdc->dat = val;
|
|
|
|
|
fdc->stat &= ~0x80;
|
2018-01-17 18:43:36 +01:00
|
|
|
} else {
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc_fifo_buf_write(fdc, val);
|
|
|
|
|
if (fdc->fifobufpos == 0)
|
|
|
|
|
fdc->stat &= ~0x80;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (fdc->pnum == fdc->ptot) {
|
|
|
|
|
if ((fdc->stat & 0xf0) != 0x80) {
|
|
|
|
|
/* If bit 4 of the MSR is set, or the MSR is 0x00,
|
|
|
|
|
the fdc_t is NOT in the command phase, therefore
|
|
|
|
|
do NOT accept commands. */
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fdc->stat &= 0xf;
|
|
|
|
|
|
|
|
|
|
fdc->tc = 0;
|
|
|
|
|
fdc->data_ready = 0;
|
|
|
|
|
|
|
|
|
|
fdc->command = val;
|
|
|
|
|
fdc->stat |= 0x10;
|
|
|
|
|
fdc_log("Starting FDC command %02X\n", fdc->command);
|
|
|
|
|
fdc->error = 0;
|
|
|
|
|
|
|
|
|
|
if (((fdc->command & 0x1f) == 0x02) || ((fdc->command & 0x1f) == 0x05) || ((fdc->command & 0x1f) == 0x06) || ((fdc->command & 0x1f) == 0x0a) || ((fdc->command & 0x1f) == 0x0c) || ((fdc->command & 0x1f) == 0x0d) || ((fdc->command & 0x1f) == 0x11) || ((fdc->command & 0x1f) == 0x16) || ((fdc->command & 0x1f) == 0x19) || ((fdc->command & 0x1f) == 0x1d))
|
|
|
|
|
fdc->processed_cmd = fdc->command & 0x1f;
|
|
|
|
|
else
|
|
|
|
|
fdc->processed_cmd = fdc->command;
|
|
|
|
|
|
|
|
|
|
switch (fdc->processed_cmd) {
|
|
|
|
|
case 0x01: /*Mode*/
|
|
|
|
|
if (fdc->flags & FDC_FLAG_NSC) {
|
|
|
|
|
fdc->pnum = 0;
|
|
|
|
|
fdc->ptot = 4;
|
|
|
|
|
fdc->stat |= 0x90;
|
|
|
|
|
fdc->pos = 0;
|
|
|
|
|
fdc->format_state = 0;
|
|
|
|
|
} else
|
|
|
|
|
fdc_bad_command(fdc);
|
|
|
|
|
break;
|
|
|
|
|
case 0x02: /*Read track*/
|
|
|
|
|
fdc->satisfying_sectors = 0;
|
|
|
|
|
fdc->sc = 0;
|
|
|
|
|
fdc->wrong_am = 0;
|
|
|
|
|
fdc->pnum = 0;
|
|
|
|
|
fdc->ptot = 8;
|
|
|
|
|
fdc->stat |= 0x90;
|
|
|
|
|
fdc->pos = 0;
|
|
|
|
|
fdc->mfm = (fdc->command & 0x40) ? 1 : 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x03: /*Specify*/
|
|
|
|
|
fdc->pnum = 0;
|
|
|
|
|
fdc->ptot = 2;
|
|
|
|
|
fdc->stat |= 0x90;
|
|
|
|
|
break;
|
|
|
|
|
case 0x04: /*Sense drive status*/
|
|
|
|
|
fdc->pnum = 0;
|
|
|
|
|
fdc->ptot = 1;
|
|
|
|
|
fdc->stat |= 0x90;
|
|
|
|
|
break;
|
|
|
|
|
case 0x05: /*Write data*/
|
|
|
|
|
case 0x09: /*Write deleted data*/
|
|
|
|
|
fdc->satisfying_sectors = 0;
|
|
|
|
|
fdc->sc = 0;
|
|
|
|
|
fdc->wrong_am = 0;
|
|
|
|
|
fdc->deleted = ((fdc->command & 0x1F) == 9) ? 1 : 0;
|
|
|
|
|
fdc->pnum = 0;
|
|
|
|
|
fdc->ptot = 8;
|
|
|
|
|
fdc->stat |= 0x90;
|
|
|
|
|
fdc->pos = 0;
|
|
|
|
|
fdc->mfm = (fdc->command & 0x40) ? 1 : 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x06: /*Read data*/
|
|
|
|
|
case 0x0c: /*Read deleted data*/
|
|
|
|
|
case 0x11: /*Scan equal*/
|
|
|
|
|
case 0x19: /*Scan low or equal*/
|
|
|
|
|
case 0x16: /*Verify*/
|
|
|
|
|
case 0x1d: /*Scan high or equal*/
|
|
|
|
|
fdc->satisfying_sectors = 0;
|
|
|
|
|
fdc->sc = 0;
|
|
|
|
|
fdc->wrong_am = 0;
|
|
|
|
|
fdc->deleted = ((fdc->command & 0x1F) == 0xC) ? 1 : 0;
|
|
|
|
|
if ((fdc->command & 0x1F) == 0x16)
|
|
|
|
|
fdc->deleted = 2;
|
|
|
|
|
fdc->deleted |= (fdc->command & 0x20);
|
|
|
|
|
fdc->pnum = 0;
|
|
|
|
|
fdc->ptot = 8;
|
|
|
|
|
fdc->stat |= 0x90;
|
|
|
|
|
fdc->pos = 0;
|
|
|
|
|
fdc->mfm = (fdc->command & 0x40) ? 1 : 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x17: /*Powerdown mode*/
|
|
|
|
|
if (!(fdc->flags & FDC_FLAG_ALI)) {
|
|
|
|
|
fdc_bad_command(fdc);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2023-08-09 19:44:56 -04:00
|
|
|
fallthrough;
|
2022-09-18 17:14:15 -04:00
|
|
|
case 0x07: /*Recalibrate*/
|
|
|
|
|
fdc->pnum = 0;
|
|
|
|
|
fdc->ptot = 1;
|
|
|
|
|
fdc->stat |= 0x90;
|
|
|
|
|
break;
|
|
|
|
|
case 0x08: /*Sense interrupt status*/
|
|
|
|
|
fdc_log("fdc->fintr = %i, fdc->reset_stat = %i\n", fdc->fintr, fdc->reset_stat);
|
|
|
|
|
fdc->lastdrive = fdc->drive;
|
|
|
|
|
fdc->pos = 0;
|
|
|
|
|
fdc_sis(fdc);
|
|
|
|
|
break;
|
|
|
|
|
case 0x0a: /*Read sector ID*/
|
|
|
|
|
fdc->pnum = 0;
|
|
|
|
|
fdc->ptot = 1;
|
|
|
|
|
fdc->stat |= 0x90;
|
|
|
|
|
fdc->pos = 0;
|
|
|
|
|
fdc->mfm = (fdc->command & 0x40) ? 1 : 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x0d: /*Format track*/
|
|
|
|
|
fdc->pnum = 0;
|
|
|
|
|
fdc->ptot = 5;
|
|
|
|
|
fdc->stat |= 0x90;
|
|
|
|
|
fdc->pos = 0;
|
|
|
|
|
fdc->mfm = (fdc->command & 0x40) ? 1 : 0;
|
|
|
|
|
fdc->format_state = 0;
|
|
|
|
|
break;
|
|
|
|
|
case 0x0e: /*Dump registers*/
|
|
|
|
|
fdc->lastdrive = fdc->drive;
|
|
|
|
|
fdc->interrupt = 0x0e;
|
|
|
|
|
fdc->pos = 0;
|
|
|
|
|
fdc_callback(fdc);
|
|
|
|
|
break;
|
|
|
|
|
case 0x0f: /*Seek*/
|
|
|
|
|
fdc->pnum = 0;
|
|
|
|
|
fdc->ptot = 2;
|
|
|
|
|
fdc->stat |= 0x90;
|
|
|
|
|
break;
|
|
|
|
|
case 0x18: /*NSC*/
|
|
|
|
|
if (!(fdc->flags & FDC_FLAG_NSC)) {
|
|
|
|
|
fdc_bad_command(fdc);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2023-08-09 19:44:56 -04:00
|
|
|
fallthrough;
|
2022-09-18 17:14:15 -04:00
|
|
|
case 0x10: /*Get version*/
|
|
|
|
|
case 0x14: /*Unlock*/
|
|
|
|
|
case 0x94: /*Lock*/
|
|
|
|
|
fdc->lastdrive = fdc->drive;
|
|
|
|
|
fdc->interrupt = fdc->command;
|
|
|
|
|
fdc->pos = 0;
|
|
|
|
|
fdc_callback(fdc);
|
|
|
|
|
break;
|
|
|
|
|
case 0x12: /*Set perpendicular mode*/
|
|
|
|
|
if ((fdc->flags & FDC_FLAG_AT) && !(fdc->flags & FDC_FLAG_PCJR)) {
|
|
|
|
|
fdc->pnum = 0;
|
|
|
|
|
fdc->ptot = 1;
|
|
|
|
|
fdc->stat |= 0x90;
|
|
|
|
|
fdc->pos = 0;
|
|
|
|
|
} else
|
|
|
|
|
fdc_bad_command(fdc);
|
|
|
|
|
break;
|
|
|
|
|
case 0x13: /*Configure*/
|
|
|
|
|
fdc->pnum = 0;
|
|
|
|
|
fdc->ptot = 3;
|
|
|
|
|
fdc->stat |= 0x90;
|
|
|
|
|
fdc->pos = 0;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
fdc_bad_command(fdc);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
fdc->stat = 0x10 | (fdc->stat & 0xf);
|
|
|
|
|
fdc->params[fdc->pnum++] = val;
|
|
|
|
|
if (fdc->pnum == 1) {
|
|
|
|
|
if (command_has_drivesel[fdc->command & 0x1F]) {
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PCJR)
|
|
|
|
|
fdc->drive = 0;
|
|
|
|
|
else
|
|
|
|
|
fdc->drive = fdc->dor & 3;
|
|
|
|
|
fdc->rw_drive = fdc->params[0] & 3;
|
|
|
|
|
if (((fdc->command & 0x1F) == 7) || ((fdc->command & 0x1F) == 15))
|
|
|
|
|
fdc->stat |= (1 << real_drive(fdc, fdc->drive));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (fdc->pnum == fdc->ptot) {
|
|
|
|
|
fdc_log("Got all params %02X\n", fdc->command);
|
|
|
|
|
fdc->interrupt = fdc->processed_cmd;
|
|
|
|
|
fdc->reset_stat = 0;
|
|
|
|
|
/* Disable timer if enabled. */
|
|
|
|
|
timer_disable(&fdc->timer);
|
|
|
|
|
/* Start timer if needed at this point. */
|
|
|
|
|
switch (fdc->interrupt & 0x1f) {
|
|
|
|
|
case 0x02: /* Read a track */
|
|
|
|
|
case 0x03: /* Specify */
|
|
|
|
|
case 0x0a: /* Read sector ID */
|
|
|
|
|
case 0x05: /* Write data */
|
|
|
|
|
case 0x06: /* Read data */
|
|
|
|
|
case 0x09: /* Write deleted data */
|
|
|
|
|
case 0x0c: /* Read deleted data */
|
|
|
|
|
case 0x11: /* Scan equal */
|
|
|
|
|
case 0x12: /* Perpendicular mode */
|
|
|
|
|
case 0x16: /* Verify */
|
|
|
|
|
case 0x19: /* Scan low or equal */
|
|
|
|
|
case 0x1d: /* Scan high or equal */
|
|
|
|
|
/* Do nothing. */
|
|
|
|
|
break;
|
|
|
|
|
case 0x07: /* Recalibrate */
|
|
|
|
|
case 0x0f: /* Seek */
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PCJR)
|
|
|
|
|
timer_set_delay_u64(&fdc->timer, 1000 * TIMER_USEC);
|
|
|
|
|
else
|
|
|
|
|
timer_set_delay_u64(&fdc->timer, 256 * TIMER_USEC);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
timer_set_delay_u64(&fdc->timer, 256 * TIMER_USEC);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
/* Process the firt phase of the command. */
|
|
|
|
|
switch (fdc->processed_cmd) {
|
|
|
|
|
case 0x02: /* Read a track */
|
|
|
|
|
fdc_io_command_phase1(fdc, 0);
|
|
|
|
|
fdc->read_track_sector.id.c = fdc->params[1];
|
|
|
|
|
fdc->read_track_sector.id.h = fdc->params[2];
|
|
|
|
|
fdc->read_track_sector.id.r = 1;
|
|
|
|
|
fdc->read_track_sector.id.n = fdc->params[4];
|
|
|
|
|
if ((fdc->head & 0x01) && !fdd_is_double_sided(real_drive(fdc, fdc->drive))) {
|
|
|
|
|
fdc_noidam(fdc);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fdd_readsector(real_drive(fdc, fdc->drive), SECTOR_FIRST, fdc->params[1], fdc->head, fdc->rate, fdc->params[4]);
|
|
|
|
|
break;
|
|
|
|
|
case 0x03: /* Specify */
|
|
|
|
|
fdc->stat = 0x80;
|
|
|
|
|
fdc->specify[0] = fdc->params[0];
|
|
|
|
|
fdc->specify[1] = fdc->params[1];
|
|
|
|
|
fdc->dma = (fdc->specify[1] & 1) ^ 1;
|
|
|
|
|
if (!fdc->dma)
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0x04: /*Sense drive status*/
|
|
|
|
|
fdd_set_head(real_drive(fdc, fdc->drive), (fdc->params[0] & 4) ? 1 : 0);
|
|
|
|
|
break;
|
|
|
|
|
case 0x05: /* Write data */
|
|
|
|
|
case 0x09: /* Write deleted data */
|
|
|
|
|
fdc_io_command_phase1(fdc, 1);
|
|
|
|
|
if ((fdc->head & 0x01) && !fdd_is_double_sided(real_drive(fdc, fdc->drive))) {
|
|
|
|
|
fdc_noidam(fdc);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fdd_writesector(real_drive(fdc, fdc->drive), fdc->sector, fdc->params[1], fdc->head, fdc->rate, fdc->params[4]);
|
|
|
|
|
break;
|
|
|
|
|
case 0x11: /* Scan equal */
|
|
|
|
|
case 0x19: /* Scan low or equal */
|
|
|
|
|
case 0x1d: /* Scan high or equal */
|
|
|
|
|
fdc_io_command_phase1(fdc, 1);
|
|
|
|
|
if ((fdc->head & 0x01) && !fdd_is_double_sided(real_drive(fdc, fdc->drive))) {
|
|
|
|
|
fdc_noidam(fdc);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
fdd_comparesector(real_drive(fdc, fdc->drive), fdc->sector, fdc->params[1], fdc->head, fdc->rate, fdc->params[4]);
|
|
|
|
|
break;
|
|
|
|
|
case 0x16: /* Verify */
|
|
|
|
|
if (fdc->params[0] & 0x80)
|
|
|
|
|
fdc->sc = fdc->params[7];
|
2023-08-09 19:44:56 -04:00
|
|
|
fallthrough;
|
2022-09-18 17:14:15 -04:00
|
|
|
case 0x06: /* Read data */
|
|
|
|
|
case 0x0c: /* Read deleted data */
|
|
|
|
|
fdc_io_command_phase1(fdc, 0);
|
|
|
|
|
fdc_log("Reading sector (drive %i) (%i) (%i %i %i %i) (%i %i %i)\n", fdc->drive, fdc->params[0], fdc->params[1], fdc->params[2], fdc->params[3], fdc->params[4], fdc->params[5], fdc->params[6], fdc->params[7]);
|
|
|
|
|
if ((fdc->head & 0x01) && !fdd_is_double_sided(real_drive(fdc, fdc->drive))) {
|
|
|
|
|
fdc_noidam(fdc);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (((dma_mode(2) & 0x0C) == 0x00) && !(fdc->flags & FDC_FLAG_PCJR) && fdc->dma) {
|
|
|
|
|
/* DMA is in verify mode, treat this like a VERIFY command. */
|
|
|
|
|
fdc_log("Verify-mode read!\n");
|
|
|
|
|
fdc->tc = 1;
|
|
|
|
|
fdc->deleted |= 2;
|
|
|
|
|
}
|
|
|
|
|
fdd_readsector(real_drive(fdc, fdc->drive), fdc->sector, fdc->params[1], fdc->head, fdc->rate, fdc->params[4]);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 0x07: /* Recalibrate */
|
|
|
|
|
fdc->rw_drive = fdc->params[0] & 3;
|
|
|
|
|
fdc->stat = (1 << real_drive(fdc, fdc->drive));
|
|
|
|
|
if (!(fdc->flags & FDC_FLAG_PCJR))
|
|
|
|
|
fdc->stat |= 0x80;
|
|
|
|
|
fdc->st0 = fdc->params[0] & 3;
|
|
|
|
|
fdc->st0 |= fdd_get_head(real_drive(fdc, fdc->drive)) ? 0x04 : 0x00;
|
|
|
|
|
fdc->st0 |= 0x80;
|
|
|
|
|
drive_num = real_drive(fdc, fdc->drive);
|
|
|
|
|
/* Three conditions under which the command should fail. */
|
|
|
|
|
if ((drive_num >= FDD_NUM) || !fdd_get_flags(drive_num) || !motoron[drive_num] || fdd_track0(drive_num)) {
|
|
|
|
|
fdc_log("Failed recalibrate\n");
|
|
|
|
|
if ((drive_num >= FDD_NUM) || !fdd_get_flags(drive_num) || !motoron[drive_num])
|
|
|
|
|
fdc->st0 = 0x70 | (fdc->params[0] & 3);
|
|
|
|
|
else
|
|
|
|
|
fdc->st0 = 0x20 | (fdc->params[0] & 3);
|
|
|
|
|
fdc->pcn[fdc->params[0] & 3] = 0;
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PCJR) {
|
|
|
|
|
fdc->fintr = 1;
|
|
|
|
|
fdc->interrupt = -4;
|
|
|
|
|
} else {
|
|
|
|
|
timer_disable(&fdc->timer);
|
|
|
|
|
fdc->interrupt = -3;
|
|
|
|
|
fdc_callback(fdc);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if ((real_drive(fdc, fdc->drive) != 1) || fdc->drv2en)
|
|
|
|
|
fdc_seek(fdc, fdc->drive, -fdc->max_track);
|
|
|
|
|
fdc_log("Recalibrating...\n");
|
|
|
|
|
fdc->seek_dir = fdc->step = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 0x0a: /* Read sector ID */
|
|
|
|
|
fdc_rate(fdc, fdc->drive);
|
|
|
|
|
fdc->head = (fdc->params[0] & 4) ? 1 : 0;
|
|
|
|
|
fdd_set_head(real_drive(fdc, fdc->drive), (fdc->params[0] & 4) ? 1 : 0);
|
|
|
|
|
if ((real_drive(fdc, fdc->drive) != 1) || fdc->drv2en) {
|
|
|
|
|
fdd_readaddress(real_drive(fdc, fdc->drive), fdc->head, fdc->rate);
|
|
|
|
|
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->dma)
|
|
|
|
|
fdc->stat = 0x70;
|
|
|
|
|
else
|
|
|
|
|
fdc->stat = 0x50;
|
|
|
|
|
} else
|
|
|
|
|
fdc_noidam(fdc);
|
|
|
|
|
break;
|
|
|
|
|
case 0x0d: /* Format */
|
|
|
|
|
fdc_rate(fdc, fdc->drive);
|
|
|
|
|
fdc->head = (fdc->params[0] & 4) ? 1 : 0;
|
|
|
|
|
fdd_set_head(real_drive(fdc, fdc->drive), (fdc->params[0] & 4) ? 1 : 0);
|
|
|
|
|
fdc->gap = fdc->params[3];
|
|
|
|
|
fdc->format_sectors = fdc->params[2];
|
|
|
|
|
fdc->format_n = fdc->params[1];
|
|
|
|
|
fdc->format_state = 1;
|
|
|
|
|
fdc->pos = 0;
|
|
|
|
|
fdc->stat = 0x10;
|
|
|
|
|
break;
|
|
|
|
|
case 0x0f: /* Seek */
|
|
|
|
|
fdc->rw_drive = fdc->params[0] & 3;
|
|
|
|
|
fdc->stat = (1 << fdc->drive);
|
|
|
|
|
if (!(fdc->flags & FDC_FLAG_PCJR))
|
|
|
|
|
fdc->stat |= 0x80;
|
2023-06-26 12:47:04 -04:00
|
|
|
#if 0
|
|
|
|
|
fdc->head = (fdc->params[0] & 4) ? 1 : 0;
|
|
|
|
|
#endif
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->head = 0; /* TODO: See if this is correct. */
|
|
|
|
|
fdc->st0 = fdc->params[0] & 0x03;
|
|
|
|
|
fdc->st0 |= (fdc->params[0] & 4);
|
|
|
|
|
fdc->st0 |= 0x80;
|
|
|
|
|
fdd_set_head(real_drive(fdc, fdc->drive), (fdc->params[0] & 4) ? 1 : 0);
|
|
|
|
|
drive_num = real_drive(fdc, fdc->drive);
|
|
|
|
|
/* Three conditions under which the command should fail. */
|
|
|
|
|
if (!fdd_get_flags(drive_num) || (drive_num >= FDD_NUM) || !motoron[drive_num]) {
|
|
|
|
|
/* Yes, failed SEEK's still report success, unlike failed RECALIBRATE's. */
|
|
|
|
|
fdc->st0 = 0x20 | (fdc->params[0] & 3);
|
|
|
|
|
if (fdc->command & 0x80) {
|
|
|
|
|
if (fdc->command & 0x40)
|
|
|
|
|
fdc->pcn[fdc->params[0] & 3] += fdc->params[1];
|
|
|
|
|
else
|
|
|
|
|
fdc->pcn[fdc->params[0] & 3] -= fdc->params[1];
|
|
|
|
|
} else
|
|
|
|
|
fdc->pcn[fdc->params[0] & 3] = fdc->params[1];
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PCJR) {
|
|
|
|
|
fdc->fintr = 1;
|
|
|
|
|
fdc->interrupt = -4;
|
|
|
|
|
} else {
|
|
|
|
|
timer_disable(&fdc->timer);
|
|
|
|
|
fdc->interrupt = -3;
|
|
|
|
|
fdc_callback(fdc);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (fdc->command & 0x80) {
|
|
|
|
|
if (fdc->params[1]) {
|
|
|
|
|
if (fdc->command & 0x40) {
|
|
|
|
|
/* Relative seek inwards. */
|
|
|
|
|
fdc->seek_dir = 0;
|
|
|
|
|
fdc_seek(fdc, fdc->drive, fdc->params[1]);
|
|
|
|
|
fdc->pcn[fdc->params[0] & 3] += fdc->params[1];
|
|
|
|
|
} else {
|
|
|
|
|
/* Relative seek outwards. */
|
|
|
|
|
fdc->seek_dir = 1;
|
|
|
|
|
fdc_seek(fdc, fdc->drive, -fdc->params[1]);
|
|
|
|
|
fdc->pcn[fdc->params[0] & 3] -= fdc->params[1];
|
|
|
|
|
}
|
|
|
|
|
fdc->step = 1;
|
|
|
|
|
} else {
|
|
|
|
|
fdc->st0 = 0x20 | (fdc->params[0] & 3);
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PCJR) {
|
|
|
|
|
fdc->fintr = 1;
|
|
|
|
|
fdc->interrupt = -4;
|
|
|
|
|
} else {
|
|
|
|
|
timer_disable(&fdc->timer);
|
|
|
|
|
fdc->interrupt = -3;
|
|
|
|
|
fdc_callback(fdc);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
fdc_log("Seeking to track %i (PCN = %i)...\n", fdc->params[1], fdc->pcn[fdc->params[0] & 3]);
|
|
|
|
|
if ((fdc->params[1] - fdc->pcn[fdc->params[0] & 3]) == 0) {
|
|
|
|
|
fdc_log("Failed seek\n");
|
|
|
|
|
fdc->st0 = 0x20 | (fdc->params[0] & 3);
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PCJR) {
|
|
|
|
|
fdc->fintr = 1;
|
|
|
|
|
fdc->interrupt = -4;
|
|
|
|
|
} else {
|
|
|
|
|
timer_disable(&fdc->timer);
|
|
|
|
|
fdc->interrupt = -3;
|
|
|
|
|
fdc_callback(fdc);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (fdc->params[1] > fdc->pcn[fdc->params[0] & 3])
|
|
|
|
|
fdc->seek_dir = 0;
|
|
|
|
|
else
|
|
|
|
|
fdc->seek_dir = 1;
|
|
|
|
|
fdc_seek(fdc, fdc->drive, fdc->params[1] - fdc->pcn[fdc->params[0] & 3]);
|
|
|
|
|
fdc->pcn[fdc->params[0] & 3] = fdc->params[1];
|
|
|
|
|
fdc->step = 1;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 0x12: /* Perpendicular mode */
|
|
|
|
|
fdc->stat = 0x80;
|
|
|
|
|
if (fdc->params[0] & 0x80)
|
|
|
|
|
fdc->perp = fdc->params[0] & 0x3f;
|
|
|
|
|
else {
|
|
|
|
|
fdc->perp &= 0xfc;
|
|
|
|
|
fdc->perp |= (fdc->params[0] & 0x03);
|
|
|
|
|
}
|
|
|
|
|
return;
|
2023-06-28 13:46:28 -04:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2022-09-18 17:14:15 -04:00
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
fdc->stat = 0x90 | (fdc->stat & 0xf);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
case 7:
|
|
|
|
|
if (!(fdc->flags & FDC_FLAG_TOSHIBA) && !(fdc->flags & FDC_FLAG_AT) && !(fdc->flags & FDC_FLAG_UMC))
|
|
|
|
|
return;
|
|
|
|
|
fdc->rate = val & 0x03;
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PS1)
|
|
|
|
|
fdc->noprec = !!(val & 0x04);
|
|
|
|
|
return;
|
2023-06-28 13:46:28 -04:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-02 19:33:02 +01:00
|
|
|
uint8_t
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_read(uint16_t addr, void *priv)
|
|
|
|
|
{
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc_t *fdc = (fdc_t *) priv;
|
2018-01-17 18:43:36 +01:00
|
|
|
uint8_t ret;
|
2022-10-27 11:20:31 -04:00
|
|
|
int drive = 0;
|
2018-03-10 21:46:38 +01:00
|
|
|
|
2020-11-26 18:20:24 +01:00
|
|
|
cycles -= ISA_CYCLES(8);
|
2018-03-10 21:46:38 +01:00
|
|
|
|
2019-02-06 03:34:39 +01:00
|
|
|
switch (addr & 7) {
|
2022-09-18 17:14:15 -04:00
|
|
|
case 0: /* STA */
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PS1) {
|
|
|
|
|
drive = real_drive(fdc, fdc->dor & 3);
|
|
|
|
|
ret = 0x00;
|
|
|
|
|
/* TODO:
|
|
|
|
|
Bit 2: INDEX (best return always 0 as it goes by very fast)
|
|
|
|
|
*/
|
|
|
|
|
if (fdc->seek_dir) /* nDIRECTION */
|
|
|
|
|
ret |= 0x01;
|
|
|
|
|
if (writeprot[drive]) /* WRITEPROT */
|
|
|
|
|
ret |= 0x02;
|
|
|
|
|
if (!fdd_get_head(drive)) /* nHDSEL */
|
|
|
|
|
ret |= 0x08;
|
|
|
|
|
if (fdd_track0(drive)) /* TRK0 */
|
|
|
|
|
ret |= 0x10;
|
|
|
|
|
if (fdc->step) /* STEP */
|
|
|
|
|
ret |= 0x20;
|
|
|
|
|
if (dma_get_drq(fdc->dma_ch)) /* DRQ */
|
|
|
|
|
ret |= 0x40;
|
|
|
|
|
if (fdc->fintr || fdc->reset_stat) /* INTR */
|
|
|
|
|
ret |= 0x80;
|
|
|
|
|
} else
|
|
|
|
|
ret = 0xff;
|
|
|
|
|
break;
|
|
|
|
|
case 1: /* STB */
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PS1) {
|
|
|
|
|
drive = real_drive(fdc, fdc->dor & 3);
|
|
|
|
|
ret = 0x00;
|
|
|
|
|
/* -Drive 2 Installed */
|
|
|
|
|
if (!fdd_get_type(1))
|
|
|
|
|
ret |= 0x80;
|
|
|
|
|
/* -Drive Select 1,0 */
|
|
|
|
|
switch (drive) {
|
|
|
|
|
case 0:
|
|
|
|
|
ret |= 0x43;
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
ret |= 0x23;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
ret |= 0x62;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
ret |= 0x61;
|
|
|
|
|
break;
|
2023-06-28 13:46:28 -04:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2022-09-18 17:14:15 -04:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (is486 || !fdc->enable_3f1)
|
|
|
|
|
ret = 0xff;
|
|
|
|
|
else {
|
|
|
|
|
if (fdc->flags & FDC_FLAG_UMC) {
|
|
|
|
|
drive = real_drive(fdc, fdc->dor & 1);
|
|
|
|
|
ret = !fdd_is_dd(drive) ? ((fdc->dor & 1) ? 2 : 1) : 0;
|
|
|
|
|
} else {
|
|
|
|
|
ret = 0x70;
|
|
|
|
|
|
|
|
|
|
drive = real_drive(fdc, fdc->dor & 3);
|
|
|
|
|
|
|
|
|
|
if (drive)
|
|
|
|
|
ret &= ~0x40;
|
|
|
|
|
else
|
|
|
|
|
ret &= ~0x20;
|
|
|
|
|
|
|
|
|
|
if (fdc->dor & 0x10)
|
|
|
|
|
ret |= 1;
|
|
|
|
|
if (fdc->dor & 0x20)
|
|
|
|
|
ret |= 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
ret = fdc->dor;
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
drive = real_drive(fdc, fdc->dor & 3);
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PS1) {
|
|
|
|
|
/* PS/1 Model 2121 seems return drive type in port
|
|
|
|
|
* 0x3f3, despite the 82077AA fdc_t not implementing
|
|
|
|
|
* this. This is presumably implemented outside the
|
|
|
|
|
* fdc_t on one of the motherboard's support chips.
|
|
|
|
|
*
|
|
|
|
|
* Confirmed: 00=1.44M 3.5
|
2023-01-06 15:36:05 -05:00
|
|
|
* 10=2.88M 3.5
|
|
|
|
|
* 20=1.2M 5.25
|
|
|
|
|
* 30=1.2M 5.25
|
2022-09-18 17:14:15 -04:00
|
|
|
*
|
|
|
|
|
* as reported by Configur.exe.
|
|
|
|
|
*/
|
|
|
|
|
if (fdd_is_525(drive))
|
|
|
|
|
ret = 0x20;
|
|
|
|
|
else if (fdd_is_ed(drive))
|
|
|
|
|
ret = 0x10;
|
|
|
|
|
else
|
|
|
|
|
ret = 0x00;
|
|
|
|
|
} else if (!fdc->enh_mode)
|
|
|
|
|
ret = 0x20;
|
|
|
|
|
else
|
|
|
|
|
ret = fdc->rwc[drive] << 4;
|
|
|
|
|
break;
|
|
|
|
|
case 4: /*Status*/
|
|
|
|
|
ret = fdc->stat;
|
|
|
|
|
break;
|
|
|
|
|
case 5: /*Data*/
|
|
|
|
|
if ((fdc->stat & 0xf0) == 0xf0) {
|
|
|
|
|
fdc->stat &= ~0x80;
|
|
|
|
|
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->fifo) {
|
|
|
|
|
fdc->data_ready = 0;
|
|
|
|
|
ret = fdc->dat;
|
|
|
|
|
} else
|
|
|
|
|
ret = fdc_fifo_buf_read(fdc);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
fdc->stat &= ~0x80;
|
|
|
|
|
if (fdc->paramstogo) {
|
|
|
|
|
fdc_log("%i parameters to go\n", fdc->paramstogo);
|
|
|
|
|
fdc->paramstogo--;
|
|
|
|
|
ret = fdc->res[10 - fdc->paramstogo];
|
|
|
|
|
if (!fdc->paramstogo)
|
|
|
|
|
fdc->stat = 0x80;
|
|
|
|
|
else
|
|
|
|
|
fdc->stat |= 0xC0;
|
|
|
|
|
} else {
|
|
|
|
|
if (lastbyte)
|
|
|
|
|
fdc->stat = 0x80;
|
|
|
|
|
lastbyte = 0;
|
|
|
|
|
ret = fdc->dat;
|
|
|
|
|
fdc->data_ready = 0;
|
|
|
|
|
}
|
|
|
|
|
fdc->stat &= 0xf0;
|
|
|
|
|
break;
|
|
|
|
|
case 7: /*Disk change*/
|
|
|
|
|
drive = real_drive(fdc, fdc->dor & 3);
|
|
|
|
|
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PS1) {
|
|
|
|
|
if (fdc->dor & (0x10 << drive)) {
|
|
|
|
|
ret = (fdd_changed[drive] || drive_empty[drive]) ? 0x00 : 0x80;
|
|
|
|
|
ret |= (fdc->dor & 0x08);
|
|
|
|
|
ret |= (fdc->noprec << 2);
|
|
|
|
|
ret |= (fdc->rate & 0x03);
|
|
|
|
|
} else
|
|
|
|
|
ret = 0x00;
|
|
|
|
|
} else {
|
|
|
|
|
if (fdc->dor & (0x10 << drive)) {
|
|
|
|
|
if ((drive == 1) && (fdc->flags & FDC_FLAG_TOSHIBA))
|
|
|
|
|
ret = 0x00;
|
|
|
|
|
else
|
|
|
|
|
ret = (fdd_changed[drive] || drive_empty[drive]) ? 0x80 : 0x00;
|
|
|
|
|
} else
|
|
|
|
|
ret = 0x00;
|
|
|
|
|
if (fdc->flags & FDC_FLAG_DISKCHG_ACTLOW) /*PC2086/3086 seem to reverse this bit*/
|
|
|
|
|
ret ^= 0x80;
|
|
|
|
|
|
|
|
|
|
/* 0 = ????, 1 = Ext. FDD off, 2 = Ext. FDD = FDD A, 3 = Ext. FDD = FDD B */
|
|
|
|
|
if (fdc->flags & FDC_FLAG_TOSHIBA) {
|
|
|
|
|
ret |= (3 << 5);
|
|
|
|
|
ret |= 0x01;
|
|
|
|
|
} else
|
|
|
|
|
ret |= 0x7F;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fdc->step = 0;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ret = 0xFF;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
// fdc_log("Read FDC %04X %02X\n", addr, ret);
|
|
|
|
|
fdc_log("[%04X:%08X] Read FDC %04X %02X [%i:%02X]\n", CS, cpu_state.pc, addr, ret, drive, fdc->dor & (0x10 << drive));
|
2018-01-17 18:43:36 +01:00
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
fdc_poll_common_finish(fdc_t *fdc, int compare, int st5)
|
|
|
|
|
{
|
2019-09-26 09:53:02 +02:00
|
|
|
fdc_int(fdc, 1);
|
2018-04-25 23:51:13 +02:00
|
|
|
if (!(fdc->flags & FDC_FLAG_PS1))
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->fintr = 0;
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->stat = 0xD0;
|
2018-02-02 18:39:48 +01:00
|
|
|
fdc->st0 = fdc->res[4] = (fdd_get_head(real_drive(fdc, fdc->drive)) ? 4 : 0) | fdc->rw_drive;
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->res[5] = st5;
|
|
|
|
|
fdc->res[6] = 0;
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
if (fdc->error) {
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->error = 0;
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
fdc->st0 |= 0x40;
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->res[4] |= 0x40;
|
|
|
|
|
fdc->res[5] |= fdc->st5;
|
|
|
|
|
fdc->res[6] |= fdc->st6;
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
}
|
2018-01-17 18:43:36 +01:00
|
|
|
if (fdc->wrong_am) {
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->res[6] |= 0x40;
|
|
|
|
|
fdc->wrong_am = 0;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
if (compare == 1) {
|
2022-09-18 17:14:15 -04:00
|
|
|
if (!fdc->satisfying_sectors)
|
|
|
|
|
fdc->res[6] |= 4;
|
|
|
|
|
else if (fdc->satisfying_sectors == (fdc->params[5] << ((fdc->command & 80) ? 1 : 0)))
|
|
|
|
|
fdc->res[6] |= 8;
|
2018-01-17 18:43:36 +01:00
|
|
|
} else if (compare == 2) {
|
2022-09-18 17:14:15 -04:00
|
|
|
if (fdc->satisfying_sectors & 1)
|
|
|
|
|
fdc->res[5] |= 0x20;
|
|
|
|
|
if (fdc->satisfying_sectors & 2) {
|
|
|
|
|
fdc->res[5] |= 0x20;
|
|
|
|
|
fdc->res[6] |= 0x20;
|
|
|
|
|
}
|
|
|
|
|
if (fdc->satisfying_sectors & 4)
|
|
|
|
|
fdc->res[5] |= 0x04;
|
|
|
|
|
if (fdc->satisfying_sectors & 8) {
|
|
|
|
|
fdc->res[5] |= 0x04;
|
|
|
|
|
fdc->res[6] |= 0x02;
|
|
|
|
|
}
|
|
|
|
|
if (fdc->satisfying_sectors & 0x10) {
|
|
|
|
|
fdc->res[5] |= 0x04;
|
|
|
|
|
fdc->res[6] |= 0x10;
|
|
|
|
|
}
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->res[7] = fdc->rw_track;
|
|
|
|
|
fdc->res[8] = fdc->head;
|
|
|
|
|
fdc->res[9] = fdc->sector;
|
|
|
|
|
fdc->res[10] = fdc->params[4];
|
|
|
|
|
fdc_log("Read/write finish (%02X %02X %02X %02X %02X %02X %02X)\n", fdc->res[4], fdc->res[5], fdc->res[6], fdc->res[7], fdc->res[8], fdc->res[9], fdc->res[10]);
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
ui_sb_update_icon(SB_FLOPPY | real_drive(fdc, fdc->drive), 0);
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->paramstogo = 7;
|
2022-07-20 19:56:49 +02:00
|
|
|
dma_set_drq(fdc->dma_ch, 0);
|
2016-09-14 23:18:14 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static void
|
|
|
|
|
fdc_poll_readwrite_finish(fdc_t *fdc, int compare)
|
2016-09-14 23:18:14 +02:00
|
|
|
{
|
2020-06-29 02:19:05 +02:00
|
|
|
if ((fdc->interrupt == 5) || (fdc->interrupt == 9))
|
2022-09-18 17:14:15 -04:00
|
|
|
fdd_do_writeback(real_drive(fdc, fdc->drive));
|
2020-06-29 02:19:05 +02:00
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->inread = 0;
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->interrupt = -2;
|
2016-11-10 21:16:24 +01:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_poll_common_finish(fdc, compare, 0);
|
2016-11-08 03:58:36 +01:00
|
|
|
}
|
2016-09-14 23:18:14 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static void
|
|
|
|
|
fdc_no_dma_end(fdc_t *fdc, int compare)
|
2016-11-08 03:58:36 +01:00
|
|
|
{
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
timer_disable(&fdc->timer);
|
2016-11-10 21:16:24 +01:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_poll_common_finish(fdc, compare, 0x80);
|
2016-09-14 23:18:14 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static void
|
|
|
|
|
fdc_callback(void *priv)
|
|
|
|
|
{
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc_t *fdc = (fdc_t *) priv;
|
|
|
|
|
int compare = 0;
|
|
|
|
|
int drive_num = 0;
|
|
|
|
|
int old_sector = 0;
|
2018-02-02 05:19:41 +01:00
|
|
|
fdc_log("fdc_callback(): %i\n", fdc->interrupt);
|
2018-01-17 18:43:36 +01:00
|
|
|
switch (fdc->interrupt) {
|
2022-09-18 17:14:15 -04:00
|
|
|
case -3: /*End of command with interrupt*/
|
|
|
|
|
case -4: /*Recalibrate/seek interrupt (PCjr only)*/
|
|
|
|
|
fdc_int(fdc, fdc->interrupt & 1);
|
|
|
|
|
fdc->stat = (fdc->stat & 0xf) | 0x80;
|
|
|
|
|
return;
|
|
|
|
|
case -2: /*End of command*/
|
|
|
|
|
fdc->stat = (fdc->stat & 0xf) | 0x80;
|
|
|
|
|
return;
|
|
|
|
|
case -1: /*Reset*/
|
|
|
|
|
fdc_int(fdc, 1);
|
|
|
|
|
fdc->fintr = 0;
|
|
|
|
|
memset(fdc->pcn, 0, 4 * sizeof(int));
|
|
|
|
|
fdc->reset_stat = 4;
|
|
|
|
|
return;
|
|
|
|
|
case 0x01: /* Mode */
|
|
|
|
|
fdc->stat = 0x80;
|
|
|
|
|
fdc->densel_force = (fdc->params[2] & 0xC0) >> 6;
|
|
|
|
|
return;
|
|
|
|
|
case 0x02: /* Read track */
|
|
|
|
|
ui_sb_update_icon(SB_FLOPPY | real_drive(fdc, fdc->drive), 1);
|
|
|
|
|
fdc->eot[fdc->drive]--;
|
|
|
|
|
fdc->read_track_sector.id.r++;
|
|
|
|
|
if (!fdc->eot[fdc->drive] || fdc->tc) {
|
|
|
|
|
fdc_poll_readwrite_finish(fdc, 2);
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
fdd_readsector(real_drive(fdc, fdc->drive), SECTOR_NEXT, fdc->rw_track, fdc->head, fdc->rate, fdc->params[4]);
|
|
|
|
|
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->dma)
|
|
|
|
|
fdc->stat = 0x70;
|
|
|
|
|
else {
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 1);
|
|
|
|
|
fdc->stat = 0x50;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
fdc->inread = 1;
|
|
|
|
|
return;
|
|
|
|
|
case 0x04: /* Sense drive status */
|
|
|
|
|
fdc->res[10] = (fdc->params[0] & 7) | 0x20;
|
|
|
|
|
if (fdd_is_double_sided(real_drive(fdc, fdc->drive)))
|
|
|
|
|
fdc->res[10] |= 0x08;
|
|
|
|
|
if ((real_drive(fdc, fdc->drive) != 1) || fdc->drv2en) {
|
|
|
|
|
if (fdd_track0(real_drive(fdc, fdc->drive)))
|
|
|
|
|
fdc->res[10] |= 0x10;
|
|
|
|
|
}
|
|
|
|
|
if (writeprot[fdc->drive])
|
|
|
|
|
fdc->res[10] |= 0x40;
|
|
|
|
|
|
|
|
|
|
fdc->stat = (fdc->stat & 0xf) | 0xd0;
|
|
|
|
|
fdc->paramstogo = 1;
|
|
|
|
|
fdc->interrupt = 0;
|
|
|
|
|
return;
|
|
|
|
|
case 0x05: /* Write data */
|
|
|
|
|
case 0x09: /* Write deleted data */
|
|
|
|
|
case 0x06: /* Read data */
|
|
|
|
|
case 0x0c: /* Read deleted data */
|
|
|
|
|
case 0x11: /* Scan equal */
|
|
|
|
|
case 0x19: /* Scan low or equal */
|
|
|
|
|
case 0x1c: /* Verify */
|
|
|
|
|
case 0x1d: /* Scan high or equal */
|
|
|
|
|
if ((fdc->interrupt == 0x11) || (fdc->interrupt == 0x19) || (fdc->interrupt == 0x1D))
|
|
|
|
|
compare = 1;
|
|
|
|
|
else
|
|
|
|
|
compare = 0;
|
|
|
|
|
if ((fdc->interrupt == 6) || (fdc->interrupt == 0xC)) {
|
|
|
|
|
if (fdc->wrong_am && !(fdc->deleted & 0x20)) {
|
|
|
|
|
/* Mismatching data address mark and no skip, set TC. */
|
|
|
|
|
fdc->tc = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
old_sector = fdc->sector;
|
|
|
|
|
if (fdc->tc) {
|
|
|
|
|
/* This is needed so that the correct results are returned
|
|
|
|
|
in case of TC. */
|
|
|
|
|
if (fdc->sector == fdc->params[5]) {
|
|
|
|
|
if (!(fdc->command & 0x80)) {
|
|
|
|
|
fdc->rw_track++;
|
|
|
|
|
fdc->sector = 1;
|
|
|
|
|
} else {
|
|
|
|
|
if (fdc->head)
|
|
|
|
|
fdc->rw_track++;
|
|
|
|
|
|
|
|
|
|
fdc->head ^= 1;
|
|
|
|
|
fdd_set_head(real_drive(fdc, fdc->drive), fdc->head);
|
|
|
|
|
fdc->sector = 1;
|
|
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
fdc->sector++;
|
|
|
|
|
fdc_poll_readwrite_finish(fdc, compare);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ((fdc->interrupt == 0x16) && (fdc->params[0] & 0x80)) {
|
|
|
|
|
/* VERIFY command, EC set */
|
|
|
|
|
fdc->sc--;
|
|
|
|
|
if (!fdc->sc) {
|
|
|
|
|
fdc->sector++;
|
|
|
|
|
fdc_poll_readwrite_finish(fdc, 0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* The rest is processed normally per MT flag and EOT. */
|
|
|
|
|
} else if ((fdc->interrupt == 0x16) && !(fdc->params[0] & 0x80)) {
|
|
|
|
|
/* VERIFY command, EC clear */
|
|
|
|
|
if ((fdc->sector == old_sector) && (fdc->head == (fdc->command & 0x80) ? 1 : 0)) {
|
|
|
|
|
fdc->sector++;
|
|
|
|
|
fdc_poll_readwrite_finish(fdc, 0);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (fdc->sector == fdc->params[5]) {
|
|
|
|
|
/* Reached end of track, MT bit is clear */
|
|
|
|
|
if (!(fdc->command & 0x80)) {
|
|
|
|
|
fdc->rw_track++;
|
|
|
|
|
fdc->sector = 1;
|
|
|
|
|
if (!(fdc->flags & FDC_FLAG_PCJR) && fdc->dma && (old_sector == 255))
|
|
|
|
|
fdc_no_dma_end(fdc, compare);
|
|
|
|
|
else
|
|
|
|
|
fdc_poll_readwrite_finish(fdc, compare);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
/* Reached end of track, MT bit is set, head is 1 */
|
|
|
|
|
if (fdd_get_head(real_drive(fdc, fdc->drive)) == 1) {
|
|
|
|
|
fdc->rw_track++;
|
|
|
|
|
fdc->sector = 1;
|
|
|
|
|
fdc->head &= 0xFE;
|
|
|
|
|
fdd_set_head(real_drive(fdc, fdc->drive), 0);
|
|
|
|
|
if (!(fdc->flags & FDC_FLAG_PCJR) && fdc->dma && (old_sector == 255))
|
|
|
|
|
fdc_no_dma_end(fdc, compare);
|
|
|
|
|
else
|
|
|
|
|
fdc_poll_readwrite_finish(fdc, compare);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-05-16 15:43:20 -04:00
|
|
|
if (fdd_get_head(real_drive(fdc, fdc->drive)) == 0) {
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->sector = 1;
|
|
|
|
|
fdc->head |= 1;
|
|
|
|
|
fdd_set_head(real_drive(fdc, fdc->drive), 1);
|
|
|
|
|
if (!fdd_is_double_sided(real_drive(fdc, fdc->drive))) {
|
|
|
|
|
fdc_noidam(fdc);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (fdc->sector < fdc->params[5])
|
|
|
|
|
fdc->sector++;
|
|
|
|
|
ui_sb_update_icon(SB_FLOPPY | real_drive(fdc, fdc->drive), 1);
|
|
|
|
|
switch (fdc->interrupt) {
|
|
|
|
|
case 5:
|
|
|
|
|
case 9:
|
|
|
|
|
fdd_writesector(real_drive(fdc, fdc->drive), fdc->sector, fdc->rw_track, fdc->head, fdc->rate, fdc->params[4]);
|
|
|
|
|
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->dma)
|
|
|
|
|
fdc->stat = 0xb0;
|
|
|
|
|
else {
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 1);
|
|
|
|
|
fdc->stat = 0x90;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
|
|
|
|
case 0xC:
|
|
|
|
|
case 0x16:
|
|
|
|
|
fdd_readsector(real_drive(fdc, fdc->drive), fdc->sector, fdc->rw_track, fdc->head, fdc->rate, fdc->params[4]);
|
|
|
|
|
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->dma)
|
|
|
|
|
fdc->stat = 0x70;
|
|
|
|
|
else {
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 1);
|
|
|
|
|
fdc->stat = 0x50;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 0x11:
|
|
|
|
|
case 0x19:
|
|
|
|
|
case 0x1D:
|
|
|
|
|
fdd_comparesector(real_drive(fdc, fdc->drive), fdc->sector, fdc->rw_track, fdc->head, fdc->rate, fdc->params[4]);
|
|
|
|
|
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->dma)
|
|
|
|
|
fdc->stat = 0xb0;
|
|
|
|
|
else {
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 1);
|
|
|
|
|
fdc->stat = 0x90;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2023-06-28 13:46:28 -04:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2022-09-18 17:14:15 -04:00
|
|
|
}
|
|
|
|
|
fdc->inread = 1;
|
|
|
|
|
return;
|
|
|
|
|
case 0x07: /* Recalibrate */
|
|
|
|
|
fdc->pcn[fdc->params[0] & 3] = 0;
|
|
|
|
|
drive_num = real_drive(fdc, fdc->rw_drive);
|
|
|
|
|
fdc->st0 = 0x20 | (fdc->params[0] & 3);
|
|
|
|
|
if (!fdd_track0(drive_num))
|
|
|
|
|
fdc->st0 |= 0x50;
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PCJR) {
|
|
|
|
|
fdc->fintr = 1;
|
|
|
|
|
fdc->interrupt = -4;
|
|
|
|
|
} else
|
|
|
|
|
fdc->interrupt = -3;
|
|
|
|
|
timer_set_delay_u64(&fdc->timer, 2048 * TIMER_USEC);
|
|
|
|
|
fdc->stat = 0x80 | (1 << fdc->rw_drive);
|
|
|
|
|
return;
|
|
|
|
|
case 0x0d: /*Format track*/
|
|
|
|
|
if (fdc->format_state == 1) {
|
|
|
|
|
fdc->format_state = 2;
|
|
|
|
|
timer_set_delay_u64(&fdc->timer, 8 * TIMER_USEC);
|
|
|
|
|
} else if (fdc->format_state == 2) {
|
|
|
|
|
fdd_format(real_drive(fdc, fdc->drive), fdc->head, fdc->rate, fdc->params[4]);
|
|
|
|
|
fdc->format_state = 3;
|
|
|
|
|
} else {
|
|
|
|
|
fdc->interrupt = -2;
|
|
|
|
|
fdc_int(fdc, 1);
|
|
|
|
|
if (!(fdc->flags & FDC_FLAG_PS1))
|
|
|
|
|
fdc->fintr = 0;
|
|
|
|
|
fdc->stat = 0xD0;
|
|
|
|
|
fdc->st0 = fdc->res[4] = (fdd_get_head(real_drive(fdc, fdc->drive)) ? 4 : 0) | fdc->drive;
|
|
|
|
|
fdc->res[5] = fdc->res[6] = 0;
|
|
|
|
|
fdc->res[7] = fdc->format_sector_id.id.c;
|
|
|
|
|
fdc->res[8] = fdc->format_sector_id.id.h;
|
|
|
|
|
fdc->res[9] = fdc->format_sector_id.id.r;
|
|
|
|
|
fdc->res[10] = fdc->format_sector_id.id.n;
|
|
|
|
|
fdc->paramstogo = 7;
|
|
|
|
|
fdc->format_state = 0;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
case 0x0e: /*Dump registers*/
|
|
|
|
|
fdc->stat = (fdc->stat & 0xf) | 0xd0;
|
|
|
|
|
fdc->res[1] = fdc->pcn[0];
|
|
|
|
|
fdc->res[2] = fdc->pcn[1];
|
|
|
|
|
fdc->res[3] = fdc->pcn[2];
|
|
|
|
|
fdc->res[4] = fdc->pcn[3];
|
|
|
|
|
fdc->res[5] = fdc->specify[0];
|
|
|
|
|
fdc->res[6] = fdc->specify[1];
|
|
|
|
|
fdc->res[7] = fdc->eot[fdc->drive];
|
|
|
|
|
fdc->res[8] = (fdc->perp & 0x7f) | ((fdc->lock) ? 0x80 : 0);
|
|
|
|
|
fdc->res[9] = fdc->config;
|
|
|
|
|
fdc->res[10] = fdc->pretrk;
|
|
|
|
|
fdc->paramstogo = 10;
|
|
|
|
|
fdc->interrupt = 0;
|
|
|
|
|
return;
|
|
|
|
|
case 0x0f: /*Seek*/
|
|
|
|
|
fdc->st0 = 0x20 | (fdc->params[0] & 3);
|
|
|
|
|
fdc->stat = 0x80 | (1 << fdc->rw_drive);
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PCJR) {
|
|
|
|
|
fdc->fintr = 1;
|
|
|
|
|
fdc->interrupt = -4;
|
|
|
|
|
timer_set_delay_u64(&fdc->timer, 1024 * TIMER_USEC);
|
|
|
|
|
} else {
|
|
|
|
|
fdc->interrupt = -3;
|
|
|
|
|
fdc_callback(fdc);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
case 0x10: /*Version*/
|
|
|
|
|
case 0x18: /*NSC*/
|
|
|
|
|
fdc->stat = (fdc->stat & 0xf) | 0xd0;
|
|
|
|
|
fdc->res[10] = (fdc->interrupt & 0x08) ? 0x73 : 0x90;
|
|
|
|
|
fdc->paramstogo = 1;
|
|
|
|
|
fdc->interrupt = 0;
|
|
|
|
|
return;
|
|
|
|
|
case 0x17: /*Powerdown mode*/
|
|
|
|
|
fdc->stat = (fdc->stat & 0xf) | 0xd0;
|
|
|
|
|
fdc->res[10] = fdc->params[0];
|
|
|
|
|
fdc->paramstogo = 1;
|
|
|
|
|
fdc->interrupt = 0;
|
|
|
|
|
return;
|
|
|
|
|
case 0x13: /*Configure*/
|
|
|
|
|
fdc->config = fdc->params[1];
|
|
|
|
|
fdc->pretrk = fdc->params[2];
|
|
|
|
|
fdc->fifo = (fdc->params[1] & 0x20) ? 0 : 1;
|
|
|
|
|
fdc->tfifo = (fdc->params[1] & 0xF);
|
|
|
|
|
fdc->stat = 0x80;
|
|
|
|
|
return;
|
|
|
|
|
case 0x14: /*Unlock*/
|
|
|
|
|
case 0x94: /*Lock*/
|
|
|
|
|
fdc->lock = (fdc->interrupt & 0x80) ? 1 : 0;
|
|
|
|
|
fdc->stat = (fdc->stat & 0xf) | 0xd0;
|
|
|
|
|
fdc->res[10] = (fdc->interrupt & 0x80) ? 0x10 : 0x00;
|
|
|
|
|
fdc->paramstogo = 1;
|
|
|
|
|
fdc->interrupt = 0;
|
|
|
|
|
return;
|
|
|
|
|
case 0xfc: /*Invalid*/
|
|
|
|
|
fdc->dat = fdc->st0 = 0x80;
|
|
|
|
|
fdc->stat = (fdc->stat & 0xf) | 0xd0;
|
|
|
|
|
fdc->res[10] = fdc->st0;
|
|
|
|
|
fdc->paramstogo = 1;
|
|
|
|
|
fdc->interrupt = 0;
|
|
|
|
|
return;
|
2023-06-28 13:46:28 -04:00
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
fdc_error(fdc_t *fdc, int st5, int st6)
|
|
|
|
|
{
|
2022-07-20 19:56:49 +02:00
|
|
|
dma_set_drq(fdc->dma_ch, 0);
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
#if 1
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
timer_disable(&fdc->timer);
|
2018-01-17 18:43:36 +01:00
|
|
|
|
2019-09-26 09:53:02 +02:00
|
|
|
fdc_int(fdc, 1);
|
2018-04-25 23:51:13 +02:00
|
|
|
if (!(fdc->flags & FDC_FLAG_PS1))
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->fintr = 0;
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->stat = 0xD0;
|
2018-02-02 18:39:48 +01:00
|
|
|
fdc->st0 = fdc->res[4] = 0x40 | (fdd_get_head(real_drive(fdc, fdc->drive)) ? 4 : 0) | fdc->rw_drive;
|
2018-07-15 01:41:53 +02:00
|
|
|
if (fdc->head && !fdd_is_double_sided(real_drive(fdc, fdc->drive)))
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->st0 |= 0x08;
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->res[5] = st5;
|
|
|
|
|
fdc->res[6] = st6;
|
2018-02-02 04:54:35 +01:00
|
|
|
fdc_log("FDC Error: %02X %02X %02X\n", fdc->res[4], fdc->res[5], fdc->res[6]);
|
2022-09-18 17:14:15 -04:00
|
|
|
switch (fdc->interrupt) {
|
|
|
|
|
case 0x02:
|
|
|
|
|
case 0x05:
|
|
|
|
|
case 0x06:
|
|
|
|
|
case 0x09:
|
|
|
|
|
case 0x0C:
|
|
|
|
|
case 0x11:
|
|
|
|
|
case 0x16:
|
|
|
|
|
case 0x19:
|
|
|
|
|
case 0x1D:
|
|
|
|
|
fdc->res[7] = fdc->rw_track;
|
|
|
|
|
fdc->res[8] = fdc->head;
|
|
|
|
|
fdc->res[9] = fdc->sector;
|
|
|
|
|
fdc->res[10] = fdc->params[4];
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
fdc->res[7] = 0;
|
|
|
|
|
fdc->res[8] = 0;
|
|
|
|
|
fdc->res[9] = 0;
|
|
|
|
|
fdc->res[10] = 0;
|
|
|
|
|
break;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
ui_sb_update_icon(SB_FLOPPY | real_drive(fdc, fdc->drive), 0);
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->paramstogo = 7;
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
#else
|
2022-09-18 17:14:15 -04:00
|
|
|
switch (fdc->interrupt) {
|
|
|
|
|
case 0x02:
|
|
|
|
|
case 0x05:
|
|
|
|
|
case 0x06:
|
|
|
|
|
case 0x09:
|
|
|
|
|
case 0x0C:
|
|
|
|
|
case 0x11:
|
|
|
|
|
case 0x16:
|
|
|
|
|
case 0x19:
|
|
|
|
|
case 0x1D:
|
|
|
|
|
fdc->error = 1;
|
|
|
|
|
fdc->st5 = st5;
|
|
|
|
|
fdc->st6 = st6;
|
|
|
|
|
fdc->tc = 1;
|
|
|
|
|
fdc->stat = 0x10;
|
|
|
|
|
fdc_callback(fdc);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
timer_disable(&fdc->timer);
|
|
|
|
|
|
|
|
|
|
fdc_int(fdc, 1);
|
|
|
|
|
if (!(fdc->flags & FDC_FLAG_PS1))
|
|
|
|
|
fdc->fintr = 0;
|
|
|
|
|
fdc->stat = 0xD0;
|
|
|
|
|
fdc->st0 = fdc->res[4] = 0x40 | (fdd_get_head(real_drive(fdc, fdc->drive)) ? 4 : 0) | fdc->rw_drive;
|
|
|
|
|
if (fdc->head && !fdd_is_double_sided(real_drive(fdc, fdc->drive)))
|
|
|
|
|
fdc->st0 |= 0x08;
|
|
|
|
|
fdc->res[5] = st5;
|
|
|
|
|
fdc->res[6] = st6;
|
|
|
|
|
fdc_log("FDC Error: %02X %02X %02X\n", fdc->res[4], fdc->res[5], fdc->res[6]);
|
|
|
|
|
|
|
|
|
|
fdc->res[7] = 0;
|
|
|
|
|
fdc->res[8] = 0;
|
|
|
|
|
fdc->res[9] = 0;
|
|
|
|
|
fdc->res[10] = 0;
|
|
|
|
|
|
|
|
|
|
ui_sb_update_icon(SB_FLOPPY | real_drive(fdc, fdc->drive), 0);
|
|
|
|
|
fdc->paramstogo = 7;
|
|
|
|
|
break;
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
}
|
|
|
|
|
#endif
|
2016-11-08 03:58:36 +01:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_overrun(fdc_t *fdc)
|
2016-11-08 03:58:36 +01:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdd_stop(fdc->drive);
|
2016-11-08 03:58:36 +01:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_error(fdc, 0x10, 0);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
|
|
|
|
fdc_is_verify(fdc_t *fdc)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return (fdc->deleted & 2) ? 1 : 0;
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
int
|
2021-09-17 02:18:23 +02:00
|
|
|
fdc_data(fdc_t *fdc, uint8_t data, int last)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2023-05-16 15:43:20 -04:00
|
|
|
int result = 0;
|
2021-09-17 02:18:23 +02:00
|
|
|
int n;
|
2016-12-23 03:16:24 +01:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
if (fdc->deleted & 2) {
|
2022-09-18 17:14:15 -04:00
|
|
|
/* We're in a VERIFY command, so return with 0. */
|
|
|
|
|
return 0;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->dma) {
|
2022-09-18 17:14:15 -04:00
|
|
|
if (fdc->tc)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (fdc->data_ready) {
|
|
|
|
|
fdc_overrun(fdc);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->fifo || (fdc->tfifo < 1)) {
|
|
|
|
|
fdc->dat = data;
|
|
|
|
|
fdc->data_ready = 1;
|
|
|
|
|
fdc->stat = 0xf0;
|
|
|
|
|
} else {
|
|
|
|
|
/* FIFO enabled */
|
|
|
|
|
fdc_fifo_buf_write(fdc, data);
|
|
|
|
|
if (fdc->fifobufpos == 0) {
|
|
|
|
|
/* We have wrapped around, means FIFO is over */
|
|
|
|
|
fdc->data_ready = 1;
|
|
|
|
|
fdc->stat = 0xf0;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-17 18:43:36 +01:00
|
|
|
} else {
|
2022-09-18 17:14:15 -04:00
|
|
|
if (fdc->tc)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (!fdc->fifo || (fdc->tfifo < 1)) {
|
|
|
|
|
fdc->data_ready = 1;
|
|
|
|
|
fdc->stat = 0xd0;
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 1);
|
|
|
|
|
|
|
|
|
|
fdc->fifobufpos = 0;
|
|
|
|
|
|
|
|
|
|
result = dma_channel_write(fdc->dma_ch, data);
|
|
|
|
|
|
|
|
|
|
if (result & DMA_OVER) {
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 0);
|
|
|
|
|
fdc->tc = 1;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 0);
|
|
|
|
|
} else {
|
|
|
|
|
/* FIFO enabled */
|
|
|
|
|
fdc_fifo_buf_write(fdc, data);
|
|
|
|
|
if (last || (fdc->fifobufpos == 0)) {
|
|
|
|
|
/* We have wrapped around, means FIFO is over */
|
|
|
|
|
fdc->data_ready = 1;
|
|
|
|
|
fdc->stat = 0xd0;
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 1);
|
|
|
|
|
|
|
|
|
|
n = (fdc->fifobufpos > 0) ? (fdc->fifobufpos - 1) : fdc->tfifo;
|
|
|
|
|
if (fdc->fifobufpos > 0)
|
|
|
|
|
fdc->fifobufpos = 0;
|
|
|
|
|
|
2023-05-16 15:43:20 -04:00
|
|
|
for (int i = 0; i <= n; i++) {
|
2022-09-18 17:14:15 -04:00
|
|
|
result = dma_channel_write(fdc->dma_ch, fdc->fifobuf[i]);
|
|
|
|
|
|
|
|
|
|
if (result & DMA_OVER) {
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 0);
|
|
|
|
|
fdc->tc = 1;
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_finishread(fdc_t *fdc)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2020-07-10 02:05:49 +02:00
|
|
|
fdc->inread = 0;
|
2016-11-10 21:16:24 +01:00
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_track_finishread(fdc_t *fdc, int condition)
|
2016-11-02 22:39:07 +01:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->stat = 0x10;
|
|
|
|
|
fdc->satisfying_sectors |= condition;
|
|
|
|
|
fdc->inread = 0;
|
|
|
|
|
fdc_callback(fdc);
|
2016-11-02 22:39:07 +01:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_sector_finishcompare(fdc_t *fdc, int satisfying)
|
2016-10-05 05:37:07 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->stat = 0x10;
|
2020-06-28 13:39:29 +02:00
|
|
|
if (satisfying)
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->satisfying_sectors++;
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->inread = 0;
|
|
|
|
|
fdc_callback(fdc);
|
2016-10-05 05:37:07 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_sector_finishread(fdc_t *fdc)
|
2016-08-21 03:42:24 +02:00
|
|
|
{
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->stat = 0x10;
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->inread = 0;
|
|
|
|
|
fdc_callback(fdc);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
2016-12-23 03:16:24 +01:00
|
|
|
|
|
|
|
|
/* There is no sector ID. */
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_noidam(fdc_t *fdc)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_error(fdc, 1, 0);
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Sector ID's are there, but there is no sector. */
|
2022-09-18 17:14:15 -04:00
|
|
|
void
|
|
|
|
|
fdc_nosector(fdc_t *fdc)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_error(fdc, 4, 0);
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* There is no sector data. */
|
2022-09-18 17:14:15 -04:00
|
|
|
void
|
|
|
|
|
fdc_nodataam(fdc_t *fdc)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_error(fdc, 1, 1);
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Abnormal termination with both status 1 and 2 set to 0, used when abnormally
|
2018-01-17 18:43:36 +01:00
|
|
|
terminating the fdc_t FORMAT TRACK command. */
|
2022-09-18 17:14:15 -04:00
|
|
|
void
|
|
|
|
|
fdc_cannotformat(fdc_t *fdc)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_error(fdc, 0, 0);
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_datacrcerror(fdc_t *fdc)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_error(fdc, 0x20, 0x20);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_headercrcerror(fdc_t *fdc)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_error(fdc, 0x20, 0);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_wrongcylinder(fdc_t *fdc)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_error(fdc, 4, 0x10);
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_badcylinder(fdc_t *fdc)
|
2016-12-23 03:16:24 +01:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_error(fdc, 4, 0x02);
|
2016-12-23 03:16:24 +01:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_writeprotect(fdc_t *fdc)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_error(fdc, 0x02, 0);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
int
|
|
|
|
|
fdc_getdata(fdc_t *fdc, int last)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2023-05-16 15:43:20 -04:00
|
|
|
int data = 0;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->dma) {
|
2022-09-18 17:14:15 -04:00
|
|
|
if ((fdc->flags & FDC_FLAG_PCJR) || !fdc->fifo || (fdc->tfifo < 1)) {
|
|
|
|
|
data = fdc->dat;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
if (!last)
|
|
|
|
|
fdc->stat = 0xb0;
|
|
|
|
|
} else {
|
|
|
|
|
data = fdc_fifo_buf_read(fdc);
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
if (!last && (fdc->fifobufpos == 0))
|
|
|
|
|
fdc->stat = 0xb0;
|
|
|
|
|
}
|
2018-01-17 18:43:36 +01:00
|
|
|
} else {
|
2022-09-18 17:14:15 -04:00
|
|
|
if (!fdc->fifo || (fdc->tfifo < 1)) {
|
|
|
|
|
data = dma_channel_read(fdc->dma_ch);
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 0);
|
|
|
|
|
|
|
|
|
|
if (data & DMA_OVER)
|
|
|
|
|
fdc->tc = 1;
|
|
|
|
|
|
|
|
|
|
if (!last) {
|
|
|
|
|
fdc->stat = 0x90;
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (fdc->fifobufpos == 0) {
|
2023-05-16 15:43:20 -04:00
|
|
|
for (int i = 0; i <= fdc->tfifo; i++) {
|
2022-09-18 17:14:15 -04:00
|
|
|
data = dma_channel_read(fdc->dma_ch);
|
|
|
|
|
fdc->fifobuf[i] = data;
|
|
|
|
|
|
|
|
|
|
if (data & DMA_OVER) {
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 0);
|
|
|
|
|
fdc->tc = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data = fdc_fifo_buf_read(fdc);
|
|
|
|
|
|
|
|
|
|
if (!last && (fdc->fifobufpos == 0)) {
|
|
|
|
|
dma_set_drq(fdc->dma_ch, 1);
|
|
|
|
|
fdc->stat = 0x90;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return data & 0xff;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
2023-06-26 12:47:04 -04:00
|
|
|
fdc_sectorid(fdc_t *fdc, uint8_t track, uint8_t side, uint8_t sector, uint8_t size, UNUSED(uint8_t crc1), UNUSED(uint8_t crc2))
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2019-09-26 09:53:02 +02:00
|
|
|
fdc_int(fdc, 1);
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->stat = 0xD0;
|
2018-02-02 18:39:48 +01:00
|
|
|
fdc->st0 = fdc->res[4] = (fdd_get_head(real_drive(fdc, fdc->drive)) ? 4 : 0) | fdc->drive;
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->res[5] = 0;
|
|
|
|
|
fdc->res[6] = 0;
|
|
|
|
|
fdc->res[7] = track;
|
|
|
|
|
fdc->res[8] = side;
|
|
|
|
|
fdc->res[9] = sector;
|
|
|
|
|
fdc->res[10] = size;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
ui_sb_update_icon(SB_FLOPPY | real_drive(fdc, fdc->drive), 0);
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->paramstogo = 7;
|
2022-07-20 19:56:49 +02:00
|
|
|
dma_set_drq(fdc->dma_ch, 0);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
uint8_t
|
|
|
|
|
fdc_get_swwp(fdc_t *fdc)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->swwp;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_set_swwp(fdc_t *fdc, uint8_t swwp)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->swwp = swwp;
|
|
|
|
|
}
|
2017-02-03 23:24:56 +01:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
uint8_t
|
|
|
|
|
fdc_get_diswr(fdc_t *fdc)
|
|
|
|
|
{
|
|
|
|
|
if (!fdc)
|
2022-09-18 17:14:15 -04:00
|
|
|
return 0;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
return fdc->disable_write;
|
|
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_set_diswr(fdc_t *fdc, uint8_t diswr)
|
|
|
|
|
{
|
|
|
|
|
fdc->disable_write = diswr;
|
|
|
|
|
}
|
2016-10-06 01:59:28 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
uint8_t
|
|
|
|
|
fdc_get_swap(fdc_t *fdc)
|
|
|
|
|
{
|
|
|
|
|
return fdc->swap;
|
|
|
|
|
}
|
2017-02-03 23:24:56 +01:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_set_swap(fdc_t *fdc, uint8_t swap)
|
|
|
|
|
{
|
|
|
|
|
fdc->swap = swap;
|
2017-01-31 20:39:36 +01:00
|
|
|
}
|
|
|
|
|
|
2020-02-29 19:12:23 +01:00
|
|
|
void
|
|
|
|
|
fdc_set_irq(fdc_t *fdc, int irq)
|
|
|
|
|
{
|
|
|
|
|
fdc->irq = irq;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-22 17:45:31 -03:00
|
|
|
void
|
|
|
|
|
fdc_set_dma_ch(fdc_t *fdc, int dma_ch)
|
|
|
|
|
{
|
|
|
|
|
fdc->dma_ch = dma_ch;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_set_base(fdc_t *fdc, int base)
|
2017-01-31 20:39:36 +01:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
int super_io = (fdc->flags & FDC_FLAG_SUPERIO);
|
2017-01-31 20:39:36 +01:00
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
if (fdc->flags & FDC_FLAG_NSC) {
|
|
|
|
|
io_sethandler(base + 2, 0x0001, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
io_sethandler(base + 4, 0x0002, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
io_sethandler(base + 7, 0x0001, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
2021-01-25 19:30:45 +01:00
|
|
|
} else {
|
2022-09-18 17:14:15 -04:00
|
|
|
if ((fdc->flags & FDC_FLAG_AT) || (fdc->flags & FDC_FLAG_AMSTRAD)) {
|
|
|
|
|
io_sethandler(base + (super_io ? 2 : 0), super_io ? 0x0004 : 0x0006, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
io_sethandler(base + 7, 0x0001, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
} else {
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PCJR)
|
|
|
|
|
io_sethandler(base, 0x0010, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
else {
|
|
|
|
|
if (fdc->flags & FDC_FLAG_UMC)
|
|
|
|
|
io_sethandler(base + 0x0001, 0x0001, fdc_read, NULL, NULL, NULL, NULL, NULL, fdc);
|
|
|
|
|
io_sethandler(base + 0x0002, 0x0001, NULL, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
io_sethandler(base + 0x0004, 0x0001, fdc_read, NULL, NULL, NULL, NULL, NULL, fdc);
|
|
|
|
|
io_sethandler(base + 0x0005, 0x0001, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
if ((fdc->flags & FDC_FLAG_TOSHIBA) || (fdc->flags & FDC_FLAG_UMC))
|
|
|
|
|
io_sethandler(base + 0x0007, 0x0001, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-25 19:30:45 +01:00
|
|
|
}
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->base_address = base;
|
2019-09-26 09:53:02 +02:00
|
|
|
fdc_log("FDC Base address set%s (%04X)\n", super_io ? " for Super I/O" : "", fdc->base_address);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_remove(fdc_t *fdc)
|
2017-02-03 23:24:56 +01:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
int super_io = (fdc->flags & FDC_FLAG_SUPERIO);
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2019-09-26 09:53:02 +02:00
|
|
|
fdc_log("FDC Removed (%04X)\n", fdc->base_address);
|
2022-09-18 17:14:15 -04:00
|
|
|
if (fdc->flags & FDC_FLAG_NSC) {
|
|
|
|
|
io_removehandler(fdc->base_address + 2, 0x0001, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
io_removehandler(fdc->base_address + 4, 0x0002, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
io_removehandler(fdc->base_address + 7, 0x0001, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
2021-01-25 19:30:45 +01:00
|
|
|
} else {
|
2022-09-18 17:14:15 -04:00
|
|
|
if ((fdc->flags & FDC_FLAG_AT) || (fdc->flags & FDC_FLAG_AMSTRAD)) {
|
|
|
|
|
io_removehandler(fdc->base_address + (super_io ? 2 : 0), super_io ? 0x0004 : 0x0006, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
io_removehandler(fdc->base_address + 7, 0x0001, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
} else {
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PCJR)
|
|
|
|
|
io_removehandler(fdc->base_address, 0x0010, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
else {
|
|
|
|
|
if (fdc->flags & FDC_FLAG_UMC)
|
|
|
|
|
io_removehandler(fdc->base_address + 0x0001, 0x0001, fdc_read, NULL, NULL, NULL, NULL, NULL, fdc);
|
|
|
|
|
io_removehandler(fdc->base_address + 0x0002, 0x0001, NULL, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
io_removehandler(fdc->base_address + 0x0004, 0x0001, fdc_read, NULL, NULL, NULL, NULL, NULL, fdc);
|
|
|
|
|
io_removehandler(fdc->base_address + 0x0005, 0x0001, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
if ((fdc->flags & FDC_FLAG_TOSHIBA) || (fdc->flags & FDC_FLAG_UMC))
|
|
|
|
|
io_removehandler(fdc->base_address + 0x0007, 0x0001, fdc_read, NULL, NULL, fdc_write, NULL, NULL, fdc);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-25 19:30:45 +01:00
|
|
|
}
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_reset(void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
uint8_t default_rwc;
|
2016-06-26 00:34:39 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_t *fdc = (fdc_t *) priv;
|
|
|
|
|
|
|
|
|
|
default_rwc = (fdc->flags & FDC_FLAG_START_RWC_1) ? 1 : 0;
|
|
|
|
|
|
|
|
|
|
fdc->enable_3f1 = 1;
|
|
|
|
|
|
|
|
|
|
fdc_update_enh_mode(fdc, 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
if (fdc->flags & FDC_FLAG_PS1)
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc_update_densel_polarity(fdc, 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc_update_densel_polarity(fdc, 1);
|
2019-02-06 03:34:39 +01:00
|
|
|
if (fdc->flags & FDC_FLAG_NSC)
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc_update_densel_force(fdc, 3);
|
2019-02-06 03:34:39 +01:00
|
|
|
else
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc_update_densel_force(fdc, 0);
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_update_rwc(fdc, 0, default_rwc);
|
|
|
|
|
fdc_update_rwc(fdc, 1, default_rwc);
|
|
|
|
|
fdc_update_rwc(fdc, 2, default_rwc);
|
|
|
|
|
fdc_update_rwc(fdc, 3, default_rwc);
|
|
|
|
|
fdc_update_drvrate(fdc, 0, 0);
|
|
|
|
|
fdc_update_drvrate(fdc, 1, 0);
|
|
|
|
|
fdc_update_drvrate(fdc, 2, 0);
|
|
|
|
|
fdc_update_drvrate(fdc, 3, 0);
|
|
|
|
|
fdc_update_drv2en(fdc, 1);
|
2019-02-06 03:34:39 +01:00
|
|
|
fdc_update_rates(fdc);
|
2018-01-17 18:43:36 +01:00
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->fifo = 0;
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->tfifo = 1;
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (fdc->flags & FDC_FLAG_PCJR) {
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->dma = 0;
|
|
|
|
|
fdc->specify[1] = 1;
|
2022-12-20 21:23:55 -05:00
|
|
|
} else if (fdc->flags & FDC_FLAG_SEC) {
|
|
|
|
|
fdc->dma = 1;
|
|
|
|
|
fdc->specify[1] = 0;
|
2023-02-03 00:37:20 -05:00
|
|
|
} else if (fdc->flags & FDC_FLAG_TER) {
|
|
|
|
|
fdc->dma = 1;
|
|
|
|
|
fdc->specify[1] = 0;
|
|
|
|
|
} else if (fdc->flags & FDC_FLAG_QUA) {
|
|
|
|
|
fdc->dma = 1;
|
|
|
|
|
fdc->specify[1] = 0;
|
2018-01-17 18:43:36 +01:00
|
|
|
} else {
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->dma = 1;
|
|
|
|
|
fdc->specify[1] = 0;
|
2018-01-17 18:43:36 +01:00
|
|
|
}
|
|
|
|
|
fdc->config = 0x20;
|
|
|
|
|
fdc->pretrk = 0;
|
|
|
|
|
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->swwp = 0;
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->disable_write = 0;
|
|
|
|
|
|
|
|
|
|
fdc_ctrl_reset(fdc);
|
|
|
|
|
|
|
|
|
|
fdc->max_track = (fdc->flags & FDC_FLAG_MORE_TRACKS) ? 85 : 79;
|
|
|
|
|
|
|
|
|
|
fdc_remove(fdc);
|
2022-10-27 12:19:51 -04:00
|
|
|
if (fdc->flags & FDC_FLAG_SEC) {
|
|
|
|
|
fdc_set_base(fdc, FDC_SECONDARY_ADDR);
|
2023-02-03 00:37:20 -05:00
|
|
|
} else if (fdc->flags & FDC_FLAG_TER) {
|
|
|
|
|
fdc_set_base(fdc, FDC_TERTIARY_ADDR);
|
|
|
|
|
} else if (fdc->flags & FDC_FLAG_QUA) {
|
|
|
|
|
fdc_set_base(fdc, FDC_QUATERNARY_ADDR);
|
2022-10-27 12:19:51 -04:00
|
|
|
} else {
|
|
|
|
|
fdc_set_base(fdc, (fdc->flags & FDC_FLAG_PCJR) ? FDC_PRIMARY_PCJR_ADDR : FDC_PRIMARY_ADDR);
|
|
|
|
|
}
|
2018-01-17 18:43:36 +01:00
|
|
|
|
|
|
|
|
current_drive = 0;
|
|
|
|
|
|
2023-05-16 15:43:20 -04:00
|
|
|
for (uint8_t i = 0; i < FDD_NUM; i++)
|
2022-09-18 17:14:15 -04:00
|
|
|
ui_sb_update_icon(SB_FLOPPY | i, 0);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static void
|
|
|
|
|
fdc_close(void *priv)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_t *fdc = (fdc_t *) priv;
|
|
|
|
|
|
|
|
|
|
fdc_reset(fdc);
|
|
|
|
|
|
|
|
|
|
/* Stop timers. */
|
|
|
|
|
fdc->watchdog_count = 0;
|
|
|
|
|
|
|
|
|
|
free(fdc);
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
static void *
|
2018-03-19 01:02:04 +01:00
|
|
|
fdc_init(const device_t *info)
|
2016-06-26 00:34:39 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc_t *fdc = (fdc_t *) malloc(sizeof(fdc_t));
|
|
|
|
|
memset(fdc, 0, sizeof(fdc_t));
|
|
|
|
|
|
|
|
|
|
fdc->flags = info->local;
|
|
|
|
|
|
2022-10-27 12:19:51 -04:00
|
|
|
if (fdc->flags & FDC_FLAG_SEC)
|
|
|
|
|
fdc->irq = FDC_SECONDARY_IRQ;
|
2023-02-03 01:03:55 -05:00
|
|
|
else if (fdc->flags & FDC_FLAG_TER)
|
|
|
|
|
fdc->irq = FDC_TERTIARY_IRQ;
|
|
|
|
|
else if (fdc->flags & FDC_FLAG_QUA)
|
|
|
|
|
fdc->irq = FDC_QUATERNARY_IRQ;
|
2022-10-27 12:19:51 -04:00
|
|
|
else
|
|
|
|
|
fdc->irq = FDC_PRIMARY_IRQ;
|
2018-01-17 18:43:36 +01:00
|
|
|
|
|
|
|
|
if (fdc->flags & FDC_FLAG_PCJR)
|
2022-09-18 17:14:15 -04:00
|
|
|
timer_add(&fdc->watchdog_timer, fdc_watchdog_poll, fdc, 0);
|
2022-10-27 12:19:51 -04:00
|
|
|
else if (fdc->flags & FDC_FLAG_SEC)
|
|
|
|
|
fdc->dma_ch = FDC_SECONDARY_DMA;
|
2023-02-03 00:37:20 -05:00
|
|
|
else if (fdc->flags & FDC_FLAG_TER)
|
|
|
|
|
fdc->dma_ch = FDC_TERTIARY_DMA;
|
|
|
|
|
else if (fdc->flags & FDC_FLAG_QUA)
|
|
|
|
|
fdc->dma_ch = FDC_QUATERNARY_DMA;
|
2018-01-17 18:43:36 +01:00
|
|
|
else
|
2022-09-18 17:14:15 -04:00
|
|
|
fdc->dma_ch = FDC_PRIMARY_DMA;
|
2018-01-17 18:43:36 +01:00
|
|
|
|
2018-02-02 04:54:35 +01:00
|
|
|
fdc_log("FDC added: %04X (flags: %08X)\n", fdc->base_address, fdc->flags);
|
2018-01-17 18:43:36 +01:00
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
timer_add(&fdc->timer, fdc_callback, fdc, 0);
|
2018-01-17 18:43:36 +01:00
|
|
|
|
|
|
|
|
d86f_set_fdc(fdc);
|
|
|
|
|
fdi_set_fdc(fdc);
|
|
|
|
|
fdd_set_fdc(fdc);
|
|
|
|
|
imd_set_fdc(fdc);
|
|
|
|
|
img_set_fdc(fdc);
|
2019-02-06 03:34:39 +01:00
|
|
|
mfm_set_fdc(fdc);
|
2018-01-17 18:43:36 +01:00
|
|
|
|
|
|
|
|
fdc_reset(fdc);
|
|
|
|
|
|
|
|
|
|
return fdc;
|
2016-06-26 00:34:39 +02:00
|
|
|
}
|
2016-07-19 02:44:32 +02:00
|
|
|
|
2018-01-17 18:43:36 +01:00
|
|
|
void
|
|
|
|
|
fdc_3f1_enable(fdc_t *fdc, int enable)
|
2016-07-19 02:44:32 +02:00
|
|
|
{
|
2018-01-17 18:43:36 +01:00
|
|
|
fdc->enable_3f1 = enable;
|
2016-07-19 02:44:32 +02:00
|
|
|
}
|
2018-01-17 18:43:36 +01:00
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
const device_t fdc_xt_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "PC/XT Floppy Drive Controller",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "fdc_xt",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = 0,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2018-01-17 18:43:36 +01:00
|
|
|
};
|
|
|
|
|
|
2022-10-27 12:19:51 -04:00
|
|
|
const device_t fdc_xt_sec_device = {
|
2022-11-19 08:49:04 -05:00
|
|
|
.name = "PC/XT Floppy Drive Controller (Secondary)",
|
2023-02-03 01:03:55 -05:00
|
|
|
.internal_name = "fdc_xt_sec",
|
2022-11-19 08:49:04 -05:00
|
|
|
.flags = FDC_FLAG_SEC,
|
|
|
|
|
.local = 0,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-10-27 12:19:51 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-11-19 08:49:04 -05:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2022-10-27 12:19:51 -04:00
|
|
|
};
|
|
|
|
|
|
2023-02-03 00:37:20 -05:00
|
|
|
const device_t fdc_xt_ter_device = {
|
|
|
|
|
.name = "PC/XT Floppy Drive Controller (Tertiary)",
|
|
|
|
|
.internal_name = "fdc_xt_ter",
|
|
|
|
|
.flags = FDC_FLAG_TER,
|
|
|
|
|
.local = 0,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
|
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
|
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const device_t fdc_xt_qua_device = {
|
|
|
|
|
.name = "PC/XT Floppy Drive Controller (Quaternary)",
|
|
|
|
|
.internal_name = "fdc_xt_qua",
|
|
|
|
|
.flags = FDC_FLAG_QUA,
|
|
|
|
|
.local = 0,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
|
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
|
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
|
|
|
|
};
|
|
|
|
|
|
2018-09-22 01:38:38 +02:00
|
|
|
const device_t fdc_xt_t1x00_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "PC/XT Floppy Drive Controller (Toshiba)",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "fdc_xt_t1x00",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_TOSHIBA,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2018-09-22 01:38:38 +02:00
|
|
|
};
|
|
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
const device_t fdc_xt_amstrad_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "PC/XT Floppy Drive Controller (Amstrad)",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "fdc_xt_amstrad",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AMSTRAD,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
};
|
|
|
|
|
|
2021-04-06 06:18:56 +02:00
|
|
|
const device_t fdc_xt_tandy_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "PC/XT Floppy Drive Controller (Tandy)",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "fdc_xt_tandy",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_AMSTRAD,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2021-04-06 06:18:56 +02:00
|
|
|
};
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
const device_t fdc_pcjr_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "PCjr Floppy Drive Controller",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "fdc_pcjr",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_PCJR,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2018-01-17 18:43:36 +01:00
|
|
|
};
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
const device_t fdc_at_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "PC/AT Floppy Drive Controller",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "fdc_at",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_AT,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2018-01-17 18:43:36 +01:00
|
|
|
};
|
|
|
|
|
|
2022-10-27 12:19:51 -04:00
|
|
|
const device_t fdc_at_sec_device = {
|
2022-11-19 08:49:04 -05:00
|
|
|
.name = "PC/AT Floppy Drive Controller (Secondary)",
|
2022-10-27 12:19:51 -04:00
|
|
|
.internal_name = "fdc_at_sec",
|
2022-11-19 08:49:04 -05:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_AT | FDC_FLAG_SEC,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-10-27 12:19:51 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-11-19 08:49:04 -05:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2022-10-27 12:19:51 -04:00
|
|
|
};
|
|
|
|
|
|
2023-02-03 00:37:20 -05:00
|
|
|
const device_t fdc_at_ter_device = {
|
|
|
|
|
.name = "PC/AT Floppy Drive Controller (Tertiary)",
|
|
|
|
|
.internal_name = "fdc_at_ter",
|
|
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_AT | FDC_FLAG_TER,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
|
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
|
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const device_t fdc_at_qua_device = {
|
|
|
|
|
.name = "PC/AT Floppy Drive Controller (Quaternary)",
|
|
|
|
|
.internal_name = "fdc_at_qua",
|
|
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_AT | FDC_FLAG_QUA,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
|
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
|
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
|
|
|
|
};
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
const device_t fdc_at_actlow_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "PC/AT Floppy Drive Controller (Active low)",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "fdc_at_actlow",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AT,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2018-01-17 18:43:36 +01:00
|
|
|
};
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
const device_t fdc_at_ps1_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "PC/AT Floppy Drive Controller (PS/1, PS/2 ISA)",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "fdc_at_ps1",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_DISKCHG_ACTLOW | FDC_FLAG_AT | FDC_FLAG_PS1,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2018-01-17 18:43:36 +01:00
|
|
|
};
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
const device_t fdc_at_smc_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "PC/AT Floppy Drive Controller (SM(s)C FDC37Cxxx)",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "fdc_at_smc",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_AT | FDC_FLAG_SUPERIO,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2018-01-17 18:43:36 +01:00
|
|
|
};
|
|
|
|
|
|
2022-07-23 03:19:51 +02:00
|
|
|
const device_t fdc_at_ali_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "PC/AT Floppy Drive Controller (ALi M512x/M1543C)",
|
2022-07-23 03:19:51 +02:00
|
|
|
.internal_name = "fdc_at_ali",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_AT | FDC_FLAG_SUPERIO | FDC_FLAG_ALI,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-07-23 03:19:51 +02:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2022-07-23 03:19:51 +02:00
|
|
|
};
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
const device_t fdc_at_winbond_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "PC/AT Floppy Drive Controller (Winbond W83x77F)",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "fdc_at_winbond",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_AT | FDC_FLAG_SUPERIO | FDC_FLAG_START_RWC_1 | FDC_FLAG_MORE_TRACKS,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2018-01-17 18:43:36 +01:00
|
|
|
};
|
|
|
|
|
|
2018-03-19 01:02:04 +01:00
|
|
|
const device_t fdc_at_nsc_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "PC/AT Floppy Drive Controller (NSC PC8730x)",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "fdc_at_nsc",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_AT | FDC_FLAG_MORE_TRACKS | FDC_FLAG_NSC,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2018-01-17 18:43:36 +01:00
|
|
|
};
|
2020-06-16 16:25:23 +02:00
|
|
|
|
|
|
|
|
const device_t fdc_dp8473_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "NS DP8473 Floppy Drive Controller",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "fdc_dp8473",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_AT | FDC_FLAG_NSC,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2020-06-16 16:25:23 +02:00
|
|
|
};
|
2021-02-08 18:01:43 +02:00
|
|
|
|
|
|
|
|
const device_t fdc_um8398_device = {
|
2022-09-18 17:14:15 -04:00
|
|
|
.name = "UMC UM8398 Floppy Drive Controller",
|
2022-03-13 09:38:53 -04:00
|
|
|
.internal_name = "fdc_um8398",
|
2022-09-18 17:14:15 -04:00
|
|
|
.flags = 0,
|
|
|
|
|
.local = FDC_FLAG_UMC,
|
|
|
|
|
.init = fdc_init,
|
|
|
|
|
.close = fdc_close,
|
|
|
|
|
.reset = fdc_reset,
|
2022-03-13 09:38:53 -04:00
|
|
|
{ .available = NULL },
|
|
|
|
|
.speed_changed = NULL,
|
2022-09-18 17:14:15 -04:00
|
|
|
.force_redraw = NULL,
|
|
|
|
|
.config = NULL
|
2021-02-08 18:01:43 +02:00
|
|
|
};
|