summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/bus/ql
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/bus/ql')
-rw-r--r--src/emu/bus/ql/sandy_superdisk.c133
-rw-r--r--src/emu/bus/ql/sandy_superdisk.h13
2 files changed, 142 insertions, 4 deletions
diff --git a/src/emu/bus/ql/sandy_superdisk.c b/src/emu/bus/ql/sandy_superdisk.c
index 835bea20ee6..11bed2c9c6b 100644
--- a/src/emu/bus/ql/sandy_superdisk.c
+++ b/src/emu/bus/ql/sandy_superdisk.c
@@ -18,6 +18,7 @@
//**************************************************************************
#define WD1772_TAG "wd1772"
+#define TTL74273_TAG "ttl74273"
#define CENTRONICS_TAG "centronics"
@@ -68,17 +69,28 @@ FLOPPY_FORMATS_END
//-------------------------------------------------
+// centronics
+//-------------------------------------------------
+
+WRITE_LINE_MEMBER( sandy_super_disk_t::busy_w )
+{
+ m_busy = state;
+ check_interrupt();
+}
+
+
+//-------------------------------------------------
// MACHINE_CONFIG_FRAGMENT( sandy_super_disk )
//-------------------------------------------------
static MACHINE_CONFIG_FRAGMENT( sandy_super_disk )
MCFG_DEVICE_ADD(WD1772_TAG, WD1772x, 8000000)
- //MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(sandy_super_disk_t, fdc_intrq_w))
- //MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(sandy_super_disk_t, fdc_drq_w))
MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", sandy_super_disk_floppies, "35dd", sandy_super_disk_t::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":1", sandy_super_disk_floppies, NULL, sandy_super_disk_t::floppy_formats)
MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_printers, "printer")
+ MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(sandy_super_disk_t, busy_w))
+ MCFG_CENTRONICS_OUTPUT_LATCH_ADD(TTL74273_TAG, CENTRONICS_TAG)
MACHINE_CONFIG_END
@@ -105,8 +117,13 @@ machine_config_constructor sandy_super_disk_t::device_mconfig_additions() const
sandy_super_disk_t::sandy_super_disk_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, SANDY_SUPER_DISK, "Sandy Super Disk", tag, owner, clock, "sandy_super_disk", __FILE__),
device_ql_expansion_card_interface(mconfig, *this),
+ m_fdc(*this, WD1772_TAG),
+ m_floppy0(*this, WD1772_TAG":0"),
+ m_floppy1(*this, WD1772_TAG":1"),
+ m_centronics(*this, CENTRONICS_TAG),
+ m_latch(*this, TTL74273_TAG),
m_rom(*this, "rom"),
- m_ram(*this, "ram")
+ m_busy(1)
{
}
@@ -126,6 +143,12 @@ void sandy_super_disk_t::device_start()
void sandy_super_disk_t::device_reset()
{
+ m_fdc->reset();
+ m_fdc->set_floppy(NULL);
+ m_fdc->dden_w(0);
+
+ m_latch->write(0);
+ m_centronics->write_strobe(1);
}
@@ -135,6 +158,42 @@ void sandy_super_disk_t::device_reset()
UINT8 sandy_super_disk_t::read(address_space &space, offs_t offset, UINT8 data)
{
+ if ((offset & 0xf0000) == 0xc0000)
+ {
+ if ((offset & 0xffc0) == 0x3fc0)
+ {
+ switch ((offset >> 2) & 0x03)
+ {
+ case 0:
+ data = m_fdc->read(space, offset & 0x03);
+ break;
+
+ case 3:
+ /*
+
+ bit description
+
+ 0 BUSY
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+
+ */
+
+ data = m_busy;
+ break;
+ }
+ }
+ else
+ {
+ data = m_rom->base()[offset & 0x3fff];
+ }
+ }
+
return data;
}
@@ -145,4 +204,72 @@ UINT8 sandy_super_disk_t::read(address_space &space, offs_t offset, UINT8 data)
void sandy_super_disk_t::write(address_space &space, offs_t offset, UINT8 data)
{
+ if ((offset & 0xf0000) == 0xc0000)
+ {
+ if ((offset & 0xffc0) == 0x3fc0)
+ {
+ switch ((offset >> 2) & 0x03)
+ {
+ case 0:
+ m_fdc->write(space, offset & 0x03, data);
+ break;
+
+ case 1:
+ {
+ /*
+
+ bit description
+
+ 0 SIDE ONE
+ 1 DSEL0
+ 2 DSEL1
+ 3 M ON0
+ 4 /DDEN
+ 5 STROBE inverted
+ 6 enable printer interrupt
+ 7
+
+ */
+
+ floppy_image_device *floppy = NULL;
+
+ if (BIT(data, 1))
+ {
+ floppy = m_floppy0->get_device();
+ }
+ else if (BIT(data, 2))
+ {
+ floppy = m_floppy1->get_device();
+ }
+
+ m_fdc->set_floppy(floppy);
+
+ if (floppy)
+ {
+ floppy->ss_w(BIT(data, 0));
+ floppy->mon_w(BIT(data, 3));
+ }
+
+ m_fdc->dden_w(BIT(data, 4));
+
+ m_centronics->write_strobe(!BIT(data, 5));
+
+ m_fd6 = BIT(data, 6);
+ check_interrupt();
+ }
+ break;
+
+ case 2:
+ m_latch->write(data);
+ break;
+ }
+ }
+ }
+}
+
+void sandy_super_disk_t::check_interrupt()
+{
+ int extint = m_fd6 && m_busy;
+
+ m_slot->extintl_w(extint ? ASSERT_LINE : CLEAR_LINE);
}
diff --git a/src/emu/bus/ql/sandy_superdisk.h b/src/emu/bus/ql/sandy_superdisk.h
index 3ff1d0c6aab..32dcaad6b68 100644
--- a/src/emu/bus/ql/sandy_superdisk.h
+++ b/src/emu/bus/ql/sandy_superdisk.h
@@ -38,6 +38,8 @@ public:
virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const;
+ WRITE_LINE_MEMBER( busy_w );
+
DECLARE_FLOPPY_FORMATS( floppy_formats );
protected:
@@ -50,8 +52,17 @@ protected:
virtual void write(address_space &space, offs_t offset, UINT8 data);
private:
+ void check_interrupt();
+
+ required_device<wd1772_t> m_fdc;
+ required_device<floppy_connector> m_floppy0;
+ required_device<floppy_connector> m_floppy1;
+ required_device<centronics_device> m_centronics;
+ required_device<output_latch_device> m_latch;
required_memory_region m_rom;
- optional_shared_ptr<UINT8> m_ram;
+
+ int m_busy;
+ int m_fd6;
};