summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-05-28 00:25:03 -0400
committer AJR <ajrhacker@users.noreply.github.com>2019-05-28 00:28:06 -0400
commit9863c37e286cef5924cf22980276f64aa42bed2b (patch)
treefab953e4bfa29a751047ef491069cf1b56334df8
parentc37ef28fa1e4579008f582a3279f6bd388baaf6d (diff)
ampro: Various additions (nw)
- Simplify handlers - Add parallel printer port - Add second serial port - Add SCSI interface - Add various line connections (several commented out because jumpers are not installed by default) wd_fdc: Add fake output callback for floppy ready line (nw)
-rw-r--r--src/devices/machine/wd_fdc.cpp4
-rw-r--r--src/devices/machine/wd_fdc.h3
-rw-r--r--src/mame/drivers/ampro.cpp135
3 files changed, 111 insertions, 31 deletions
diff --git a/src/devices/machine/wd_fdc.cpp b/src/devices/machine/wd_fdc.cpp
index fefc7c2c0a1..711740a6f98 100644
--- a/src/devices/machine/wd_fdc.cpp
+++ b/src/devices/machine/wd_fdc.cpp
@@ -85,6 +85,7 @@ wd_fdc_device_base::wd_fdc_device_base(const machine_config &mconfig, device_typ
drq_cb(*this),
hld_cb(*this),
enp_cb(*this),
+ ready_cb(*this), // actually output by the drive, not by the FDC
enmf_cb(*this)
{
force_ready = false;
@@ -107,6 +108,7 @@ void wd_fdc_device_base::device_start()
drq_cb.resolve();
hld_cb.resolve();
enp_cb.resolve();
+ ready_cb.resolve();
enmf_cb.resolve();
if (!has_enmf && !enmf_cb.isnull())
@@ -1277,6 +1279,8 @@ void wd_fdc_device_base::spinup()
void wd_fdc_device_base::ready_callback(floppy_image_device *floppy, int state)
{
+ ready_cb(state);
+
// why is this even possible?
if (!floppy)
return;
diff --git a/src/devices/machine/wd_fdc.h b/src/devices/machine/wd_fdc.h
index b7244870e2b..a14c868f75f 100644
--- a/src/devices/machine/wd_fdc.h
+++ b/src/devices/machine/wd_fdc.h
@@ -53,6 +53,7 @@ public:
auto drq_wr_callback() { return drq_cb.bind(); }
auto hld_wr_callback() { return hld_cb.bind(); }
auto enp_wr_callback() { return enp_cb.bind(); }
+ auto ready_wr_callback() { return ready_cb.bind(); }
auto enmf_rd_callback() { return enmf_cb.bind(); }
void soft_reset();
@@ -287,7 +288,7 @@ private:
live_info cur_live, checkpoint_live;
- devcb_write_line intrq_cb, drq_cb, hld_cb, enp_cb;
+ devcb_write_line intrq_cb, drq_cb, hld_cb, enp_cb, ready_cb;
devcb_read_line enmf_cb;
uint8_t format_last_byte;
diff --git a/src/mame/drivers/ampro.cpp b/src/mame/drivers/ampro.cpp
index b5c7cbce501..b3092ba2b81 100644
--- a/src/mame/drivers/ampro.cpp
+++ b/src/mame/drivers/ampro.cpp
@@ -15,16 +15,17 @@ power supply and serial terminal.
The later versions included a SCSI chip (NCR5380) enabling the use
of a hard drive of up to 88MB.
-ToDo:
-- (maybe) add scsi interface
-- Add printer
-
****************************************************************************/
#include "emu.h"
+#include "bus/centronics/ctronics.h"
#include "bus/rs232/rs232.h"
#include "cpu/z80/z80.h"
#include "imagedev/floppy.h"
+#include "machine/ncr5380n.h"
+#include "machine/nscsi_cd.h"
+#include "machine/nscsi_hd.h"
+#include "machine/output_latch.h"
#include "machine/z80daisy.h"
#include "machine/z80ctc.h"
#include "machine/z80dart.h"
@@ -42,6 +43,8 @@ public:
, m_ctc(*this, "ctc")
, m_fdc(*this, "fdc")
, m_floppy0(*this, "fdc:0")
+ , m_ncr(*this, "scsi:7:ncr")
+ , m_printer(*this, "printer")
{ }
void ampro(machine_config &config);
@@ -53,9 +56,13 @@ protected:
private:
TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick);
- DECLARE_WRITE8_MEMBER(port00_w);
- DECLARE_READ8_MEMBER(io_r);
- DECLARE_WRITE8_MEMBER(io_w);
+ void port00_w(uint8_t data);
+ void set_strobe(uint8_t data);
+ void clear_strobe(uint8_t data);
+ uint8_t ctc_r(offs_t offset);
+ uint8_t dart_r(offs_t offset);
+ void ctc_w(offs_t offset, uint8_t data);
+ void dart_w(offs_t offset, uint8_t data);
void ampro_io(address_map &map);
void ampro_mem(address_map &map);
@@ -65,6 +72,8 @@ private:
required_device<z80ctc_device> m_ctc;
required_device<wd1772_device> m_fdc;
required_device<floppy_connector> m_floppy0;
+ required_device<ncr5380n_device> m_ncr;
+ required_device<centronics_device> m_printer;
};
/*
@@ -74,7 +83,7 @@ d5 /DDEN
d6 Banking 0=rom
d7 FDC master clock 0=8MHz 1=16MHz (for 20cm disks, not emulated)
*/
-WRITE8_MEMBER( ampro_state::port00_w )
+void ampro_state::port00_w(uint8_t data)
{
membank("bankr0")->set_entry(BIT(data, 6));
m_fdc->dden_w(BIT(data, 5));
@@ -85,20 +94,34 @@ WRITE8_MEMBER( ampro_state::port00_w )
floppy->ss_w(BIT(data, 4));
}
-READ8_MEMBER( ampro_state::io_r )
+void ampro_state::set_strobe(uint8_t data)
+{
+ m_printer->write_strobe(0);
+}
+
+void ampro_state::clear_strobe(uint8_t data)
+{
+ m_printer->write_strobe(1);
+}
+
+uint8_t ampro_state::ctc_r(offs_t offset)
+{
+ return m_ctc->read(offset>>4);
+}
+
+uint8_t ampro_state::dart_r(offs_t offset)
{
- if (offset < 0x40)
- return m_ctc->read(offset>>4);
- else
- return m_dart->ba_cd_r(offset>>2);
+ return m_dart->ba_cd_r(offset>>2);
}
-WRITE8_MEMBER( ampro_state::io_w )
+void ampro_state::ctc_w(offs_t offset, uint8_t data)
{
- if (offset < 0x40)
- m_ctc->write(offset>>4, data);
- else
- m_dart->ba_cd_w(offset>>2, data);
+ m_ctc->write(offset>>4, data);
+}
+
+void ampro_state::dart_w(offs_t offset, uint8_t data)
+{
+ m_dart->ba_cd_w(offset>>2, data);
}
void ampro_state::ampro_mem(address_map &map)
@@ -113,12 +136,14 @@ void ampro_state::ampro_io(address_map &map)
map.unmap_value_high();
map.global_mask(0xff);
map(0x00, 0x00).w(FUNC(ampro_state::port00_w)); // system
- //AM_RANGE(0x01, 0x01) AM_WRITE(port01_w) // printer data
- //AM_RANGE(0x02, 0x03) AM_WRITE(port02_w) // printer strobe
- //AM_RANGE(0x20, 0x27) AM_READWRITE() // scsi chip
- //AM_RANGE(0x28, 0x28) AM_WRITE(port28_w) // scsi control
- //AM_RANGE(0x29, 0x29) AM_READ(port29_r) // ID port
- map(0x40, 0x8f).rw(FUNC(ampro_state::io_r), FUNC(ampro_state::io_w));
+ map(0x01, 0x01).w("pio", FUNC(output_latch_device::bus_w)); // printer data
+ map(0x02, 0x02).w(FUNC(ampro_state::set_strobe)); // printer strobe
+ map(0x03, 0x03).w(FUNC(ampro_state::clear_strobe)); // printer strobe
+ map(0x20, 0x27).rw(m_ncr, FUNC(ncr5380n_device::read), FUNC(ncr5380n_device::write)); // scsi chip
+ map(0x28, 0x28).rw(m_ncr, FUNC(ncr5380n_device::dma_r), FUNC(ncr5380n_device::dma_w)); // scsi control
+ map(0x29, 0x29).portr("ID"); // ID port
+ map(0x40, 0x7f).rw(FUNC(ampro_state::ctc_r), FUNC(ampro_state::ctc_w));
+ map(0x80, 0x8f).rw(FUNC(ampro_state::dart_r), FUNC(ampro_state::dart_w));
map(0xc0, 0xc3).w(m_fdc, FUNC(wd1772_device::write));
map(0xc4, 0xc7).r(m_fdc, FUNC(wd1772_device::read));
}
@@ -135,14 +160,37 @@ static void ampro_floppies(device_slot_interface &device)
device.option_add("525dd", FLOPPY_525_DD);
}
+static void scsi_devices(device_slot_interface &device)
+{
+ device.option_add("harddisk", NSCSI_HARDDISK);
+ device.option_add_internal("ncr", NCR5380N);
+}
+
/* Input ports */
static INPUT_PORTS_START( ampro )
+ PORT_START("ID")
+ PORT_DIPUNUSED_DIPLOC(0x80, 0x80, "J9:1") // actually pin pair 1-2
+ PORT_DIPUNUSED_DIPLOC(0x40, 0x40, "J9:2") // actually pin pair 3-4
+ PORT_DIPUNUSED_DIPLOC(0x20, 0x20, "J9:3") // actually pin pair 5-6
+ PORT_DIPUNUSED_DIPLOC(0x10, 0x10, "J9:4") // actually pin pair 7-8
+ PORT_DIPUNUSED_DIPLOC(0x08, 0x08, "J9:5") // actually pin pair 9-10
+ PORT_DIPNAME(0x07, 0x07, "SCSI ID") PORT_DIPLOCATION("J9:8,7,6") // actually pin pairs 15-16, 13-14, 11-12
+ PORT_DIPSETTING(0x00, "0")
+ PORT_DIPSETTING(0x01, "1")
+ PORT_DIPSETTING(0x02, "2")
+ PORT_DIPSETTING(0x03, "3")
+ PORT_DIPSETTING(0x04, "4")
+ PORT_DIPSETTING(0x05, "5")
+ PORT_DIPSETTING(0x06, "6")
+ PORT_DIPSETTING(0x07, "7")
INPUT_PORTS_END
void ampro_state::machine_reset()
{
- membank("bankr0")->set_entry(0); // point at rom
membank("bankw0")->set_entry(0); // always write to ram
+
+ port00_w(0);
+ clear_strobe(0);
}
void ampro_state::init_ampro()
@@ -172,17 +220,44 @@ void ampro_state::ampro(machine_config &config)
m_ctc->zc_callback<1>().set(m_dart, FUNC(z80dart_device::rxtxcb_w)); // SIO Ch B
Z80DART(config, m_dart, 16_MHz_XTAL / 4);
- m_dart->out_txda_callback().set("rs232", FUNC(rs232_port_device::write_txd));
- m_dart->out_dtra_callback().set("rs232", FUNC(rs232_port_device::write_dtr));
- m_dart->out_rtsa_callback().set("rs232", FUNC(rs232_port_device::write_rts));
+ m_dart->out_txda_callback().set("rs232a", FUNC(rs232_port_device::write_txd));
+ m_dart->out_rtsa_callback().set("rs232a", FUNC(rs232_port_device::write_rts));
+ m_dart->out_txdb_callback().set("rs232b", FUNC(rs232_port_device::write_txd));
+ m_dart->out_rtsb_callback().set("rs232b", FUNC(rs232_port_device::write_rts));
m_dart->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
- rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal"));
- rs232.rxd_handler().set(m_dart, FUNC(z80dart_device::rxa_w));
+ rs232_port_device &rs232a(RS232_PORT(config, "rs232a", default_rs232_devices, "terminal"));
+ rs232a.rxd_handler().set(m_dart, FUNC(z80dart_device::rxa_w));
+ rs232a.cts_handler().set(m_dart, FUNC(z80dart_device::ctsa_w));
+
+ rs232_port_device &rs232b(RS232_PORT(config, "rs232b", default_rs232_devices, nullptr));
+ rs232b.rxd_handler().set(m_dart, FUNC(z80dart_device::rxb_w));
+ rs232b.cts_handler().set(m_dart, FUNC(z80dart_device::ctsb_w));
+
+ output_latch_device &pio(OUTPUT_LATCH(config, "pio"));
+ CENTRONICS(config, m_printer, centronics_devices, nullptr);
+ m_printer->busy_handler().set(m_dart, FUNC(z80dart_device::rib_w));
+ m_printer->set_output_latch(pio);
WD1772(config, m_fdc, 16_MHz_XTAL / 2);
+ //m_fdc->intrq_wr_callback().set(m_ctc, FUNC(z80ctc_device::trg3)); // only if JMP2-3 shorted
+ //m_fdc->drq_wr_callback().set(m_dart, FUNC(z80dart_device::ria_w)); // only if JMP7 shorted
+ m_fdc->ready_wr_callback().set(m_dart, FUNC(z80dart_device::dcdb_w)); // actually from the drive, and not used by the FDC at all
FLOPPY_CONNECTOR(config, "fdc:0", ampro_floppies, "525dd", floppy_image_device::default_floppy_formats).enable_sound(true);
SOFTWARE_LIST(config, "flop_list").set_original("ampro");
+
+ NSCSI_BUS(config, "scsi");
+ NSCSI_CONNECTOR(config, "scsi:0", scsi_devices, nullptr);
+ NSCSI_CONNECTOR(config, "scsi:1", scsi_devices, nullptr);
+ NSCSI_CONNECTOR(config, "scsi:2", scsi_devices, nullptr);
+ NSCSI_CONNECTOR(config, "scsi:3", scsi_devices, nullptr);
+ NSCSI_CONNECTOR(config, "scsi:4", scsi_devices, nullptr);
+ NSCSI_CONNECTOR(config, "scsi:5", scsi_devices, nullptr);
+ NSCSI_CONNECTOR(config, "scsi:6", scsi_devices, nullptr);
+ NSCSI_CONNECTOR(config, "scsi:7", scsi_devices, "ncr", true).set_option_machine_config("ncr", [this] (device_t *device) {
+ //downcast<ncr5380n_device &>(*device).irq_handler().set(m_ctc, FUNC(z80ctc_device::trg2)); // only if JMP3 shorted
+ //downcast<ncr5380n_device &>(*device).drq_handler().set(m_dart, FUNC(z80dart_device::dcda_w)); // only if JMP8 shorted
+ });
}
/* ROM definition */