From 5642f550622c929ae347d8e1f2653c43c0c6be8d Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 22 Nov 2017 02:21:47 -0500 Subject: slicer: Add 74LS259 (nw) --- src/mame/drivers/slicer.cpp | 53 ++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/src/mame/drivers/slicer.cpp b/src/mame/drivers/slicer.cpp index 4e9bca5b073..872a69b7da4 100644 --- a/src/mame/drivers/slicer.cpp +++ b/src/mame/drivers/slicer.cpp @@ -7,6 +7,7 @@ #include "emu.h" #include "cpu/i86/i186.h" +#include "machine/74259.h" #include "machine/wd_fdc.h" #include "machine/mc68681.h" #include "bus/rs232/rs232.h" @@ -24,7 +25,7 @@ public: } DECLARE_WRITE8_MEMBER(sio_out_w); - DECLARE_WRITE8_MEMBER(drive_sel_w); + template DECLARE_WRITE_LINE_MEMBER(drive_sel_w); protected: required_device m_fdc; @@ -46,35 +47,18 @@ WRITE8_MEMBER(slicer_state::sio_out_w) } } -WRITE8_MEMBER(slicer_state::drive_sel_w) +template +WRITE_LINE_MEMBER(slicer_state::drive_sel_w) { - data &= 1; - switch(offset) - { - case 0: - m_sasi->write_sel(data); - break; - case 1: - m_sasi->write_rst(data); - break; - case 7: - m_fdc->dden_w(data); - break; - - default: - { - floppy_image_device *floppy; - char devname[8]; - unsigned int drive = 3 - (offset - 2); - if((drive > 3) || !data) - break; - - sprintf(devname, "%d", drive); - floppy = m_fdc->subdevice(devname)->get_device(); - m_fdc->set_floppy(floppy); - break; - } - } + floppy_image_device *floppy; + char devname[8]; + + if (!state) + return; + + sprintf(devname, "%d", drive); + floppy = m_fdc->subdevice(devname)->get_device(); + m_fdc->set_floppy(floppy); } static ADDRESS_MAP_START( slicer_map, AS_PROGRAM, 16, slicer_state ) @@ -86,7 +70,7 @@ static ADDRESS_MAP_START( slicer_io, AS_IO, 16, slicer_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x0000, 0x007f) AM_DEVREADWRITE8("fdc", fd1797_device, read, write, 0x00ff) //PCS0 AM_RANGE(0x0080, 0x00ff) AM_DEVREADWRITE8("duart", scn2681_device, read, write, 0x00ff) //PCS1 - AM_RANGE(0x0100, 0x017f) AM_WRITE8(drive_sel_w, 0x00ff) //PCS2 + AM_RANGE(0x0100, 0x0107) AM_MIRROR(0x0078) AM_DEVWRITE8("drivelatch", ls259_device, write_d0, 0x00ff) //PCS2 // TODO: 0x180 sets ack AM_RANGE(0x0180, 0x0181) AM_DEVREAD8("sasi_data_in", input_buffer_device, read, 0x00ff) AM_DEVWRITE8("sasi_data_out", output_latch_device, write, 0x00ff) //PCS3 AM_RANGE(0x0180, 0x0181) AM_DEVREAD8("sasi_ctrl_in", input_buffer_device, read, 0xff00) @@ -123,6 +107,15 @@ static MACHINE_CONFIG_START( slicer ) MCFG_FLOPPY_DRIVE_ADD("fdc:2", slicer_floppies, nullptr, floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fdc:3", slicer_floppies, nullptr, floppy_image_device::default_floppy_formats) + MCFG_DEVICE_ADD("drivelatch", LS259, 0) // U29 + MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(DEVWRITELINE("sasi", scsi_port_device, write_sel)) + MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(DEVWRITELINE("sasi", scsi_port_device, write_rst)) + MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(slicer_state, drive_sel_w<3>)) + MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(slicer_state, drive_sel_w<2>)) + MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(slicer_state, drive_sel_w<1>)) + MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(slicer_state, drive_sel_w<0>)) + MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(DEVWRITELINE("fdc", fd1797_device, dden_w)) + MCFG_DEVICE_ADD("sasi", SCSI_PORT, 0) MCFG_SCSI_DATA_INPUT_BUFFER("sasi_data_in") MCFG_SCSI_BSY_HANDLER(DEVWRITELINE("sasi_ctrl_in", input_buffer_device, write_bit3)) -- cgit v1.2.3