From f356f30e6efe63385449dc483c8e6bedbe30b6bd Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 13 Dec 2012 12:41:31 +0000 Subject: [PATCH] specimx: made floppy boot with new core, still some stalling to fix (nw) --- src/mess/drivers/special.c | 37 +++++++++++++------------------------ src/mess/includes/special.h | 11 +++++------ src/mess/machine/b2m.c | 3 ++- src/mess/machine/special.c | 32 ++++++++++++++++++++++++++------ 4 files changed, 46 insertions(+), 37 deletions(-) diff --git a/src/mess/drivers/special.c b/src/mess/drivers/special.c index 505cddca336..dff8bdeb046 100644 --- a/src/mess/drivers/special.c +++ b/src/mess/drivers/special.c @@ -44,10 +44,7 @@ static ADDRESS_MAP_START( erik_io_map, AS_IO, 8, special_state ) AM_RANGE(0xf1, 0xf1) AM_READWRITE(erik_rr_reg_r, erik_rr_reg_w) AM_RANGE(0xf2, 0xf2) AM_READWRITE(erik_rc_reg_r, erik_rc_reg_w) AM_RANGE(0xf3, 0xf3) AM_READWRITE(erik_disk_reg_r, erik_disk_reg_w) - AM_RANGE(0xf4, 0xf4) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_status_r, wd17xx_command_w) - AM_RANGE(0xf5, 0xf5) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_track_r, wd17xx_track_w) - AM_RANGE(0xf6, 0xf6) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_sector_r, wd17xx_sector_w) - AM_RANGE(0xf7, 0xf7) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_data_r, wd17xx_data_w) + AM_RANGE(0xf4, 0xf7) AM_DEVREADWRITE("fd1793", fd1793_t, read, write) ADDRESS_MAP_END static ADDRESS_MAP_START(specimx_mem, AS_PROGRAM, 8, special_state ) @@ -58,10 +55,7 @@ static ADDRESS_MAP_START(specimx_mem, AS_PROGRAM, 8, special_state ) AM_RANGE( 0xffc0, 0xffdf ) AM_RAMBANK("bank4") AM_RANGE( 0xffe0, 0xffe3 ) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) AM_RANGE( 0xffe4, 0xffe7 ) AM_RAM //external 8255 - AM_RANGE( 0xffe8, 0xffe8 ) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_status_r,wd17xx_command_w) - AM_RANGE( 0xffe9, 0xffe9 ) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_track_r,wd17xx_track_w) - AM_RANGE( 0xffea, 0xffea ) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_sector_r,wd17xx_sector_w) - AM_RANGE( 0xffea, 0xffeb ) AM_DEVREADWRITE_LEGACY("wd1793", wd17xx_data_r,wd17xx_data_w) + AM_RANGE( 0xffe8, 0xffeb ) AM_DEVREADWRITE("fd1793", fd1793_t, read, write) AM_RANGE( 0xffec, 0xffef ) AM_DEVREADWRITE_LEGACY("pit8253", pit8253_r, pit8253_w) AM_RANGE( 0xfff0, 0xfff3 ) AM_READWRITE(specimx_disk_ctrl_r, specimx_disk_ctrl_w) AM_RANGE( 0xfff8, 0xfff8 ) AM_READWRITE(specimx_video_color_r,specimx_video_color_w) @@ -385,18 +379,9 @@ static const cassette_interface special_cassette_interface = NULL }; -static const floppy_interface specimx_floppy_interface = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(specimx), - NULL, - NULL -}; +static SLOT_INTERFACE_START( specimx_floppies ) + SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) +SLOT_INTERFACE_END /* Machine driver */ static MACHINE_CONFIG_START( special, special_state ) @@ -459,8 +444,10 @@ static MACHINE_CONFIG_DERIVED( specimx, special ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) /* Devices */ - MCFG_FD1793_ADD("wd1793", default_wd17xx_interface_2_drives ) - MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(specimx_floppy_interface) + MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8) + + MCFG_FLOPPY_DRIVE_ADD("fd0", specimx_floppies, "525dd", 0, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd1", specimx_floppies, "525dd", 0, floppy_image_device::default_floppy_formats) /* internal ram */ MCFG_RAM_ADD(RAM_TAG) @@ -495,9 +482,11 @@ static MACHINE_CONFIG_START( erik, special_state ) /* Devices */ MCFG_CASSETTE_ADD( CASSETTE_TAG, special_cassette_interface ) - MCFG_FD1793_ADD("wd1793", default_wd17xx_interface_2_drives ) - MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(specimx_floppy_interface) MCFG_I8255_ADD( "ppi8255", specialist_ppi8255_interface ) + MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8) + + MCFG_FLOPPY_DRIVE_ADD("fd0", specimx_floppies, "525dd", 0, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fd1", specimx_floppies, "525dd", 0, floppy_image_device::default_floppy_formats) /* internal ram */ MCFG_RAM_ADD(RAM_TAG) diff --git a/src/mess/includes/special.h b/src/mess/includes/special.h index 198766bb8b0..ae606426764 100644 --- a/src/mess/includes/special.h +++ b/src/mess/includes/special.h @@ -15,11 +15,8 @@ #include "machine/i8255.h" #include "machine/pit8253.h" #include "imagedev/cassette.h" -#include "imagedev/flopdrv.h" -#include "formats/basicdsk.h" #include "formats/rk_cas.h" -#include "formats/smx_dsk.h" -#include "machine/wd17xx.h" +#include "machine/wd_fdc.h" #include "machine/ram.h" @@ -30,7 +27,7 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_ppi(*this, "ppi8255"), - m_fdc(*this, "wd1793"), + m_fdc(*this, "fd1793"), m_dac(*this, "dac"), m_cass(*this, CASSETTE_TAG), m_ram(*this, RAM_TAG), @@ -73,11 +70,12 @@ public: UINT8 m_RC_register; required_device m_maincpu; optional_device m_ppi; - optional_device m_fdc; + optional_device m_fdc; optional_device m_dac; optional_device m_cass; optional_device m_ram; optional_shared_ptr m_p_videoram; + int m_drive; DECLARE_DRIVER_INIT(erik); DECLARE_DRIVER_INIT(special); DECLARE_MACHINE_RESET(special); @@ -96,6 +94,7 @@ public: UINT32 screen_update_specimx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_CALLBACK_MEMBER(special_reset); TIMER_CALLBACK_MEMBER(setup_pit8253_gates); + void fdc_drq(bool state); }; diff --git a/src/mess/machine/b2m.c b/src/mess/machine/b2m.c index 0c786db8358..a8689ec9bc0 100644 --- a/src/mess/machine/b2m.c +++ b/src/mess/machine/b2m.c @@ -226,9 +226,10 @@ WRITE8_MEMBER(b2m_state::b2m_ext_8255_portc_w) if (m_b2m_drive!=drive) { m_b2m_drive = drive; } - floppy->ss_w(side); + if (m_b2m_side!=side) { m_b2m_side = side; + floppy->ss_w(side); } /* When bit 5 is set CPU is in HALT state and stay there until diff --git a/src/mess/machine/special.c b/src/mess/machine/special.c index b376c19e36d..3ead45b349f 100644 --- a/src/mess/machine/special.c +++ b/src/mess/machine/special.c @@ -221,6 +221,8 @@ const struct pit8253_config specimx_pit8253_intf = MACHINE_START_MEMBER(special_state,specimx) { m_specimx_audio = machine().device("custom"); + m_drive = 0; + m_fdc->setup_drq_cb(fd1793_t::line_cb(FUNC(special_state::fdc_drq), this)); } TIMER_CALLBACK_MEMBER(special_state::setup_pit8253_gates) @@ -236,9 +238,6 @@ MACHINE_RESET_MEMBER(special_state,specimx) { specimx_set_bank(2, 0); // Initiali load ROM disk machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(special_state::setup_pit8253_gates),this)); - device_t *fdc = machine().device("wd1793"); - wd17xx_set_pause_time(fdc,12); - wd17xx_dden_w(fdc, 0); } READ8_MEMBER( special_state::specimx_disk_ctrl_r ) @@ -246,15 +245,35 @@ READ8_MEMBER( special_state::specimx_disk_ctrl_r ) return 0xff; } +void special_state::fdc_drq(bool state) +{ + /* Clears HALT state of CPU when data is ready to read */ + if(state) { + m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); + } +} + WRITE8_MEMBER( special_state::specimx_disk_ctrl_w ) { + static const char *names[] = { "fd0", "fd1"}; + floppy_image_device *floppy = NULL; + floppy_connector *con = machine().device(names[m_drive & 1]); + if(con) + floppy = con->get_device(); + + m_fdc->set_floppy(floppy); + floppy->mon_w(0); + switch(offset) { + case 0 : + m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); + break; case 2 : - wd17xx_set_side(m_fdc, data & 1); + floppy->ss_w(data & 1); break; case 3 : - wd17xx_set_drive(m_fdc, data & 1); + m_drive = data & 1; break; } } @@ -380,10 +399,11 @@ READ8_MEMBER( special_state::erik_disk_reg_r ) WRITE8_MEMBER( special_state::erik_disk_reg_w ) { +/* wd17xx_set_side (m_fdc,data & 1); wd17xx_set_drive(m_fdc,(data >> 1) & 1); wd17xx_dden_w(m_fdc, BIT(data, 2)); floppy_mon_w(floppy_get_device(machine(), BIT(data, 1)), 0); floppy_mon_w(floppy_get_device(machine(), BIT(data, 1) ^ 1), 1); - floppy_drive_set_ready_state(floppy_get_device(machine(), BIT(data, 1)), 1, 1); + floppy_drive_set_ready_state(floppy_get_device(machine(), BIT(data, 1)), 1, 1);*/ }