summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/iq151_disc2.c
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2012-10-10 15:33:51 +0000
committer Olivier Galibert <galibert@pobox.com>2012-10-10 15:33:51 +0000
commit9d1aaf97ae5a4d5b2272f064fe6b6fe7df9dbf88 (patch)
tree74e3dc1e5558b42717e62f9b81cc7d7d47b90449 /src/mess/machine/iq151_disc2.c
parent204b78cf00de0c3bd8b6afefa601cd26aa391c91 (diff)
(mess) upd765: Modernize [O. Galibert]
Remaining TODO list: - take WP into account - test the amstrad, implement its observational format (edsk) using pasti as a start. Or find the legendary amstrad IPFs. Or both. - correct read track, the implementation is completely wrong. See previous for testing, it's only used in protections the check the inter-sector gaps. - shake and bake on the amstrad, protections are the best to find bugs in a fdc - add the scan id commands, but nothing seems to use them - debug the 2.88M formatting which is unreliable. Fix its IDAM/DAM gap size on formatting too (but that's not what's making it unreliable) - test all the systems that were hit, and fix what needs to be fixed. Beware that multiple problems may happen: - upd765 may be wrong - the driver may not be working - the hookup may be wrong/incomplete (bitrate selection and floppy rpm in particular) - the driver may be too limited for the new implementation (the x68k dma device does not handle non-instant dma yet for instance) - report invalid command when appropriate depending on the actual chip emulated - add the russian clones with their real names
Diffstat (limited to 'src/mess/machine/iq151_disc2.c')
-rw-r--r--src/mess/machine/iq151_disc2.c49
1 files changed, 17 insertions, 32 deletions
diff --git a/src/mess/machine/iq151_disc2.c b/src/mess/machine/iq151_disc2.c
index 5ff4df25017..634e8893f13 100644
--- a/src/mess/machine/iq151_disc2.c
+++ b/src/mess/machine/iq151_disc2.c
@@ -6,46 +6,28 @@
#include "emu.h"
#include "iq151_disc2.h"
+#include "formats/mfi_dsk.h"
+#include "formats/iq151_dsk.h"
/***************************************************************************
IMPLEMENTATION
***************************************************************************/
-static LEGACY_FLOPPY_OPTIONS_START( iq151_disc2 )
- LEGACY_FLOPPY_OPTION( iq151_disk, "iqd", "IQ-151 disk image", basicdsk_identify_default, basicdsk_construct_default, NULL,
- HEADS([1])
- TRACKS([77])
- SECTORS([26])
- SECTOR_LENGTH([128])
- FIRST_SECTOR_ID([1]))
-LEGACY_FLOPPY_OPTIONS_END
-
-static const floppy_interface iq151_disc2_intf =
-{
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- DEVCB_NULL,
- FLOPPY_STANDARD_8_SSSD,
- LEGACY_FLOPPY_OPTIONS_NAME(iq151_disc2),
- "floppy_8",
+static const floppy_format_type iq151_disc2_floppy_formats[] = {
+ FLOPPY_IQ151_FORMAT,
+ FLOPPY_MFI_FORMAT,
NULL
};
-static const upd765_interface iq151_disc2_fdc_intf =
-{
- DEVCB_NULL,
- DEVCB_NULL,
- NULL,
- UPD765_RDY_PIN_NOT_CONNECTED,
- { NULL, FLOPPY_0, FLOPPY_1, NULL }
-};
+static SLOT_INTERFACE_START( iq151_disc2_floppies )
+ SLOT_INTERFACE( "8sssd", FLOPPY_8_SSSD )
+SLOT_INTERFACE_END
static MACHINE_CONFIG_FRAGMENT( iq151_disc2 )
- MCFG_UPD72065_ADD("fdc", iq151_disc2_fdc_intf)
- MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(iq151_disc2_intf)
+ MCFG_UPD72065_ADD("fdc", false, true)
+ MCFG_FLOPPY_DRIVE_ADD("fdc:1", iq151_disc2_floppies, "8sssd", 0, iq151_disc2_floppy_formats)
+ MCFG_FLOPPY_DRIVE_ADD("fdc:2", iq151_disc2_floppies, "8sssd", 0, iq151_disc2_floppy_formats)
MACHINE_CONFIG_END
ROM_START( iq151_disc2 )
@@ -129,10 +111,12 @@ void iq151_disc2_device::read(offs_t offset, UINT8 &data)
void iq151_disc2_device::io_read(offs_t offset, UINT8 &data)
{
+ /* This is gross */
+ address_space *space = NULL;
if (offset == 0xaa)
- data = upd765_status_r(m_fdc, machine().driver_data()->generic_space(), 0);
+ data = m_fdc->msr_r(*space, 0, 0xff);
else if (offset == 0xab)
- data = upd765_data_r(m_fdc, machine().driver_data()->generic_space(), 0);
+ data = m_fdc->fifo_r(*space, 0, 0xff);
}
//-------------------------------------------------
@@ -141,8 +125,9 @@ void iq151_disc2_device::io_read(offs_t offset, UINT8 &data)
void iq151_disc2_device::io_write(offs_t offset, UINT8 data)
{
+ address_space *space = NULL;
if (offset == 0xab)
- upd765_data_w(m_fdc, machine().driver_data()->generic_space(), 0, data);
+ m_fdc->fifo_w(*space, 0, data, 0xff);
else if (offset == 0xac)
m_rom_enabled = (data == 0x01);
}