mirror of
https://github.com/holub/mame
synced 2025-04-25 17:56:43 +03:00
omti8621: Reimplement floppy interface without PC_FDC_AT (nw)
This commit is contained in:
parent
2aca0ad9e7
commit
0121841abf
@ -249,12 +249,12 @@ void omti8621_device::device_add_mconfig(machine_config &config)
|
||||
OMTI_DISK(config, OMTI_DISK0_TAG, 0);
|
||||
OMTI_DISK(config, OMTI_DISK1_TAG, 0);
|
||||
|
||||
pc_fdc_at_device &pc_fdc_at(PC_FDC_AT(config, m_fdc, 0));
|
||||
pc_fdc_at.intrq_wr_callback().set(FUNC(omti8621_device::fdc_irq_w));
|
||||
pc_fdc_at.drq_wr_callback().set(FUNC(omti8621_device::fdc_drq_w));
|
||||
FLOPPY_CONNECTOR(config, OMTI_FDC_TAG":0", pc_hd_floppies, "525hd", omti8621_device::floppy_formats);
|
||||
UPD765A(config, m_fdc, 48_MHz_XTAL / 6, false, false); // clocked through FDC9239BT
|
||||
m_fdc->intrq_wr_callback().set(FUNC(omti8621_device::fdc_irq_w));
|
||||
m_fdc->drq_wr_callback().set(FUNC(omti8621_device::fdc_drq_w));
|
||||
FLOPPY_CONNECTOR(config, m_floppy[0], pc_hd_floppies, "525hd", omti8621_device::floppy_formats);
|
||||
// Apollo workstations never have more then 1 floppy drive
|
||||
// FLOPPY_CONNECTOR(config, OMTI_FDC_TAG":1", pc_hd_floppies, "525hd", omti8621_device::floppy_formats);
|
||||
// FLOPPY_CONNECTOR(config, m_floppy[1], pc_hd_floppies, nullptr, omti8621_device::floppy_formats);
|
||||
}
|
||||
|
||||
const tiny_rom_entry *omti8621_device::device_rom_region() const
|
||||
@ -315,11 +315,11 @@ void omti8621_device::device_reset()
|
||||
// and the onboard AT FDC ports
|
||||
if (m_iobase->read() & 8)
|
||||
{
|
||||
m_isa->install_device(0x0370, 0x0377, *m_fdc, &pc_fdc_interface::map);
|
||||
m_isa->install_device(0x0370, 0x0377, *this, &omti8621_device::fdc_map);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_isa->install_device(0x03f0, 0x03f7, *m_fdc, &pc_fdc_interface::map);
|
||||
m_isa->install_device(0x03f0, 0x03f7, *this, &omti8621_device::fdc_map);
|
||||
}
|
||||
|
||||
m_isa->set_dma_channel(2, this, true);
|
||||
@ -362,6 +362,10 @@ void omti8621_device::device_reset()
|
||||
diskaddr_format_bad_track = 0;
|
||||
alternate_track_address[0] = 0;
|
||||
alternate_track_address[1] = 0;
|
||||
|
||||
fd_moten_w(0);
|
||||
fd_rate_w(0);
|
||||
fd_extra_w(0);
|
||||
}
|
||||
|
||||
DEFINE_DEVICE_TYPE(ISA16_OMTI8621, omti8621_pc_device, "omti8621isa", "OMTI 8621 ESDI/floppy controller (ISA)")
|
||||
@ -387,10 +391,11 @@ omti8621_device::omti8621_device(
|
||||
: device_t(mconfig, type, tag, owner, clock)
|
||||
, device_isa16_card_interface(mconfig, *this)
|
||||
, m_fdc(*this, OMTI_FDC_TAG)
|
||||
, m_floppy(*this, OMTI_FDC_TAG":%u", 0U)
|
||||
, m_iobase(*this, "IO_BASE")
|
||||
, m_biosopts(*this, "BIOS_OPTS")
|
||||
, jumper(0), omti_state(0), status_port(0), config_port(0), mask_port(0), command_length(0), command_index(0), command_status(0), data_buffer(nullptr)
|
||||
, data_length(0), data_index(0), diskaddr_ecc_error(0), diskaddr_format_bad_track(0), m_timer(nullptr), m_installed(false)
|
||||
, data_length(0), data_index(0), diskaddr_ecc_error(0), diskaddr_format_bad_track(0), m_timer(nullptr), m_moten(0), m_installed(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -1268,12 +1273,14 @@ void omti8621_device::set_jumper(uint16_t disk_type)
|
||||
// FDC uses the standard IRQ 6 / DMA 2, doesn't appear to be configurable
|
||||
WRITE_LINE_MEMBER( omti8621_device::fdc_irq_w )
|
||||
{
|
||||
m_isa->irq6_w(state ? ASSERT_LINE : CLEAR_LINE);
|
||||
if (BIT(m_moten, 3))
|
||||
m_isa->irq6_w(state ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( omti8621_device::fdc_drq_w )
|
||||
{
|
||||
m_isa->drq2_w(state ? ASSERT_LINE : CLEAR_LINE);
|
||||
if (BIT(m_moten, 3))
|
||||
m_isa->drq2_w(state ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
uint8_t omti8621_device::dack_r(int line)
|
||||
@ -1296,6 +1303,70 @@ void omti8621_device::eop_w(int state)
|
||||
m_fdc->tc_w(state == ASSERT_LINE);
|
||||
}
|
||||
|
||||
void omti8621_device::fdc_map(address_map &map)
|
||||
{
|
||||
map(2, 2).w(FUNC(omti8621_device::fd_moten_w));
|
||||
map(4, 5).m(m_fdc, FUNC(upd765a_device::map));
|
||||
map(6, 6).w(FUNC(omti8621_device::fd_extra_w));
|
||||
map(7, 7).rw(FUNC(omti8621_device::fd_disk_chg_r), FUNC(omti8621_device::fd_rate_w));
|
||||
}
|
||||
|
||||
void omti8621_device::fd_moten_w(uint8_t data)
|
||||
{
|
||||
if (BIT(data, 3) && !BIT(m_moten, 3))
|
||||
{
|
||||
m_isa->irq6_w(m_fdc->get_irq() ? ASSERT_LINE : CLEAR_LINE);
|
||||
m_isa->drq2_w(m_fdc->get_drq() ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
else if (!BIT(data, 3) && BIT(m_moten, 3))
|
||||
{
|
||||
m_isa->irq6_w(CLEAR_LINE);
|
||||
m_isa->drq2_w(CLEAR_LINE);
|
||||
}
|
||||
|
||||
m_moten = data;
|
||||
|
||||
if (!BIT(data, 2))
|
||||
m_fdc->soft_reset();
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
floppy_image_device *floppy = m_floppy[i].found() ? m_floppy[i]->get_device() : nullptr;
|
||||
if (floppy != nullptr)
|
||||
floppy->mon_w(BIT(~data, i + 4));
|
||||
|
||||
if (i == (data & 0x01))
|
||||
m_fdc->set_floppy(BIT(~data, i + 4) ? floppy : nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void omti8621_device::fd_rate_w(uint8_t data)
|
||||
{
|
||||
// Bit 1 = FD_MINI (TODO)
|
||||
// Bit 0 = FD_RATE (TODO)
|
||||
}
|
||||
|
||||
void omti8621_device::fd_extra_w(uint8_t data)
|
||||
{
|
||||
// Bit 7 = FD_EXTRA-2 (NC)
|
||||
// Bit 6 = FD_EXTRA-1 (NC)
|
||||
// Bit 5 = FD_PIN_6 (TODO)
|
||||
// Bit 4 = FD_IUSE_HLD (TODO)
|
||||
// Bit 3 = FD_DEN_SEL (TODO)
|
||||
// Bit 2 = FD_PRE-2 (TODO)
|
||||
// Bit 1 = FD_PRE-1 (TODO)
|
||||
// Bit 0 = FD_PRE-0 (TODO)
|
||||
}
|
||||
|
||||
uint8_t omti8621_device::fd_disk_chg_r()
|
||||
{
|
||||
floppy_image_device *floppy = m_floppy[m_moten & 0x01].found() ? m_floppy[m_moten & 0x01]->get_device() : nullptr;
|
||||
if (floppy == nullptr || floppy->dskchg_r())
|
||||
return 0x00;
|
||||
else
|
||||
return 0x80;
|
||||
}
|
||||
|
||||
//##########################################################################
|
||||
|
||||
// device type definition
|
||||
|
@ -16,7 +16,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "isa.h"
|
||||
#include "machine/pc_fdc.h"
|
||||
#include "machine/upd765.h"
|
||||
#include "imagedev/floppy.h"
|
||||
|
||||
/***************************************************************************
|
||||
@ -61,7 +61,8 @@ protected:
|
||||
|
||||
void set_interrupt(enum line_state line_state);
|
||||
|
||||
required_device<pc_fdc_interface> m_fdc;
|
||||
required_device<upd765a_device> m_fdc;
|
||||
optional_device_array<floppy_connector, 2> m_floppy;
|
||||
required_ioport m_iobase;
|
||||
required_ioport m_biosopts;
|
||||
|
||||
@ -74,6 +75,13 @@ private:
|
||||
DECLARE_WRITE_LINE_MEMBER( fdc_drq_w );
|
||||
DECLARE_FLOPPY_FORMATS( floppy_formats );
|
||||
|
||||
void fd_moten_w(uint8_t data);
|
||||
void fd_rate_w(uint8_t data);
|
||||
void fd_extra_w(uint8_t data);
|
||||
uint8_t fd_disk_chg_r();
|
||||
|
||||
void fdc_map(address_map &map);
|
||||
|
||||
uint16_t jumper;
|
||||
|
||||
uint8_t omti_state;
|
||||
@ -105,6 +113,8 @@ private:
|
||||
|
||||
emu_timer *m_timer;
|
||||
|
||||
uint8_t m_moten;
|
||||
|
||||
bool m_installed;
|
||||
|
||||
void clear_sense_data();
|
||||
|
Loading…
Reference in New Issue
Block a user