diff --git a/src/mess/drivers/b2m.c b/src/mess/drivers/b2m.c index 49001b688f1..dd08da6c0cb 100644 --- a/src/mess/drivers/b2m.c +++ b/src/mess/drivers/b2m.c @@ -14,9 +14,10 @@ #include "machine/pit8253.h" #include "machine/pic8259.h" #include "machine/i8251.h" -#include "machine/wd17xx.h" +#include "formats/hxcmfm_dsk.h" +#include "formats/mfi_dsk.h" #include "imagedev/flopdrv.h" -#include "formats/basicdsk.h" +#include "machine/wd1772.h" #include "machine/ram.h" #include "includes/b2m.h" @@ -39,11 +40,8 @@ static ADDRESS_MAP_START( b2m_io, AS_IO, 8, b2m_state ) AM_RANGE(0x10, 0x13) AM_READWRITE(b2m_palette_r,b2m_palette_w) AM_RANGE(0x14, 0x15) AM_DEVREADWRITE_LEGACY("pic8259", pic8259_r, pic8259_w ) AM_RANGE(0x18, 0x18) AM_DEVREADWRITE("uart", i8251_device, data_r, data_w) - AM_RANGE(0x19, 0x19) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) - AM_RANGE(0x1c, 0x1c) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_status_r,wd17xx_command_w) - AM_RANGE(0x1d, 0x1d) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_track_r,wd17xx_track_w) - AM_RANGE(0x1e, 0x1e) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_sector_r,wd17xx_sector_w) - AM_RANGE(0x1f, 0x1f) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_data_r,wd17xx_data_w) + AM_RANGE(0x19, 0x19) AM_DEVREADWRITE("uart", i8251_device, status_r, control_w) + AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("wd1793", wd1773_t, read, write) ADDRESS_MAP_END static ADDRESS_MAP_START( b2m_rom_io, AS_IO, 8, b2m_state ) @@ -175,7 +173,7 @@ static INPUT_PORTS_START( b2m ) PORT_CONFSETTING( 0x01, "Color") PORT_CONFSETTING( 0x00, "B/W") INPUT_PORTS_END - +/* static LEGACY_FLOPPY_OPTIONS_START(b2m) LEGACY_FLOPPY_OPTION(b2m, "cpm", "Bashkiria-2M disk image", basicdsk_identify_default, basicdsk_construct_default, NULL, HEADS([2]) @@ -184,20 +182,18 @@ static LEGACY_FLOPPY_OPTIONS_START(b2m) SECTOR_LENGTH([1024]) FIRST_SECTOR_ID([1])) LEGACY_FLOPPY_OPTIONS_END +*/ -static const floppy_interface b2m_floppy_interface = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(b2m), - NULL, +static const floppy_format_type floppy_formats[] = { + FLOPPY_MFM_FORMAT, FLOPPY_MFI_FORMAT, NULL }; +static SLOT_INTERFACE_START( b2m_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END + + /* Machine driver */ static MACHINE_CONFIG_START( b2m, b2m_state ) /* basic machine hardware */ @@ -236,9 +232,10 @@ static MACHINE_CONFIG_START( b2m, b2m_state ) /* uart */ MCFG_I8251_ADD("uart", default_i8251_interface) - MCFG_FD1793_ADD("wd1793", default_wd17xx_interface_2_drives ) + MCFG_WD1773x_ADD("wd1793", XTAL_8MHz ) - MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(b2m_floppy_interface) + MCFG_FLOPPY_DRIVE_ADD("fd0", b2m_floppies, "525dd", 0, floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd1", b2m_floppies, "525dd", 0, floppy_formats) /* internal ram */ MCFG_RAM_ADD(RAM_TAG) diff --git a/src/mess/includes/b2m.h b/src/mess/includes/b2m.h index 9ee44a63d9e..6cb00a8fe32 100644 --- a/src/mess/includes/b2m.h +++ b/src/mess/includes/b2m.h @@ -10,6 +10,7 @@ #include "machine/i8255.h" #include "machine/pit8253.h" #include "machine/pic8259.h" +#include "machine/wd1772.h" #include "sound/speaker.h" #include "sound/wave.h" @@ -35,7 +36,7 @@ public: UINT8 m_vblank_state; /* devices */ - device_t *m_fdc; + wd1773_t *m_fdc; device_t *m_pic; device_t *m_speaker; DECLARE_READ8_MEMBER(b2m_keyboard_r); diff --git a/src/mess/machine/b2m.c b/src/mess/machine/b2m.c index 9cffdd90708..3ce0f9ee7c8 100644 --- a/src/mess/machine/b2m.c +++ b/src/mess/machine/b2m.c @@ -12,7 +12,7 @@ #include "imagedev/cassette.h" #include "machine/i8255.h" #include "machine/pit8253.h" -#include "machine/wd17xx.h" +#include "machine/wd1772.h" #include "machine/pic8259.h" #include "machine/i8251.h" #include "includes/b2m.h" @@ -206,22 +206,22 @@ WRITE8_MEMBER(b2m_state::b2m_ext_8255_portc_w) { UINT8 drive = ((data >> 1) & 1) ^ 1; UINT8 side = (data & 1) ^ 1; - floppy_mon_w(floppy_get_device(machine(), 0), 1); - floppy_mon_w(floppy_get_device(machine(), 1), 1); + + static const char *names[] = { "fd0", "fd1"}; + floppy_image_device *floppy = NULL; + floppy_connector *con = machine().device(names[drive]); + if(con) + floppy = con->get_device(); + floppy->mon_w(0); + m_fdc->set_floppy(floppy); if (m_b2m_drive!=drive) { - wd17xx_set_drive(m_fdc,drive); - floppy_mon_w(floppy_get_device(machine(), 0), 0); - floppy_drive_set_ready_state(floppy_get_device(machine(), 0), 1, 1); m_b2m_drive = drive; } - if (m_b2m_side!=side) { - wd17xx_set_side(m_fdc,side); - floppy_mon_w(floppy_get_device(machine(), 1), 0); - floppy_drive_set_ready_state(floppy_get_device(machine(), 1), 1, 1); + floppy->ss_w(side); + if (m_b2m_side!=side) { m_b2m_side = side; } - wd17xx_dden_w(m_fdc, 0); } I8255A_INTERFACE( b2m_ppi8255_interface_2 ) @@ -312,11 +312,9 @@ static void b2m_postload(b2m_state *state) void b2m_state::machine_start() { m_pic = machine().device("pic8259"); - m_fdc = machine().device("wd1793"); + m_fdc = machine().device("wd1793"); m_speaker = machine().device(SPEAKER_TAG); - wd17xx_set_pause_time(m_fdc,10); - /* register for state saving */ save_item(NAME(m_b2m_8255_porta)); save_item(NAME(m_b2m_video_scroll)); diff --git a/src/mess/machine/wd1772.c b/src/mess/machine/wd1772.c index 43db7961c4d..0ceff1674c4 100644 --- a/src/mess/machine/wd1772.c +++ b/src/mess/machine/wd1772.c @@ -255,6 +255,8 @@ void wd177x_t::seek_continue() break; case SEEK_DONE: + if (!has_motor()) status |= S_HLD; + if(command & 0x04) { sub_state = SCAN_ID; counter = 0; diff --git a/src/mess/machine/wd1772.h b/src/mess/machine/wd1772.h index 2cd7187da2c..57b2a8a738c 100644 --- a/src/mess/machine/wd1772.h +++ b/src/mess/machine/wd1772.h @@ -209,9 +209,11 @@ private: S_CRC = 0x08, S_RNF = 0x10, S_SPIN = 0x20, + S_HLD = 0x20, S_DDM = 0x20, S_WP = 0x40, - S_MON = 0x80 + S_MON = 0x80, + S_NRDY = 0x80 }; floppy_image_device *floppy;