From e8823c2ab89da2ad75db1058b39e8d4d42a9d778 Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 10 Dec 2022 18:24:40 -0500 Subject: thomson.cpp: Extension bus cleanup - Make CC 90-232 serial/parallel interface an extension device - Eliminate spurious custom Centronics interface from MO5NR (CC 90-232 is used with this model instead) - Make RF 57-932 serial interface an extension device - Make MD 90-120 modem interface an extension device (emulation still needs work) - Make Midipak an extension device and completely rewrite emulation - Make MEA8000-based speech interface an extension device - Configure 1 MHz E clock for extension bus - Add FIRQ & IRQ outputs from extension bus - Expand extension I/O address range from $x7D0-$x7DF to $x7C0-$x7FF - Clean up various bits of driver code --- scripts/src/bus.lua | 10 + src/devices/bus/thomson/cc90_232.cpp | 135 ++++++++++++ src/devices/bus/thomson/cc90_232.h | 48 +++++ src/devices/bus/thomson/cd90_015.cpp | 8 +- src/devices/bus/thomson/cd90_015.h | 2 +- src/devices/bus/thomson/cd90_351.cpp | 20 +- src/devices/bus/thomson/cd90_640.cpp | 6 +- src/devices/bus/thomson/cd90_640.h | 2 +- src/devices/bus/thomson/cq90_028.cpp | 10 +- src/devices/bus/thomson/cq90_028.h | 2 +- src/devices/bus/thomson/extension.cpp | 24 ++- src/devices/bus/thomson/extension.h | 23 +- src/devices/bus/thomson/md90_120.cpp | 94 +++++++++ src/devices/bus/thomson/md90_120.h | 38 ++++ src/devices/bus/thomson/midipak.cpp | 61 ++++++ src/devices/bus/thomson/midipak.h | 25 +++ src/devices/bus/thomson/nanoreseau.cpp | 4 +- src/devices/bus/thomson/rf57_932.cpp | 55 +++++ src/devices/bus/thomson/rf57_932.h | 25 +++ src/devices/bus/thomson/speech.cpp | 43 ++++ src/devices/bus/thomson/speech.h | 25 +++ src/mame/thomson/thomson.cpp | 122 ++--------- src/mame/thomson/thomson.h | 90 +------- src/mame/thomson/thomson_m.cpp | 376 ++------------------------------- src/mame/thomson/thomson_v.cpp | 6 + 25 files changed, 677 insertions(+), 577 deletions(-) create mode 100644 src/devices/bus/thomson/cc90_232.cpp create mode 100644 src/devices/bus/thomson/cc90_232.h create mode 100644 src/devices/bus/thomson/md90_120.cpp create mode 100644 src/devices/bus/thomson/md90_120.h create mode 100644 src/devices/bus/thomson/midipak.cpp create mode 100644 src/devices/bus/thomson/midipak.h create mode 100644 src/devices/bus/thomson/rf57_932.cpp create mode 100644 src/devices/bus/thomson/rf57_932.h create mode 100644 src/devices/bus/thomson/speech.cpp create mode 100644 src/devices/bus/thomson/speech.h diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua index 57fee72cdde..5d47117da39 100644 --- a/scripts/src/bus.lua +++ b/scripts/src/bus.lua @@ -5017,6 +5017,8 @@ if (BUSES["THOMSON"]~=null) then files { MAME_DIR .. "src/devices/bus/thomson/extension.cpp", MAME_DIR .. "src/devices/bus/thomson/extension.h", + MAME_DIR .. "src/devices/bus/thomson/cc90_232.cpp", + MAME_DIR .. "src/devices/bus/thomson/cc90_232.h", MAME_DIR .. "src/devices/bus/thomson/cd90_015.cpp", MAME_DIR .. "src/devices/bus/thomson/cd90_015.h", MAME_DIR .. "src/devices/bus/thomson/cq90_028.cpp", @@ -5025,8 +5027,16 @@ if (BUSES["THOMSON"]~=null) then MAME_DIR .. "src/devices/bus/thomson/cd90_351.h", MAME_DIR .. "src/devices/bus/thomson/cd90_640.cpp", MAME_DIR .. "src/devices/bus/thomson/cd90_640.h", + MAME_DIR .. "src/devices/bus/thomson/md90_120.cpp", + MAME_DIR .. "src/devices/bus/thomson/md90_120.h", + MAME_DIR .. "src/devices/bus/thomson/midipak.cpp", + MAME_DIR .. "src/devices/bus/thomson/midipak.h", MAME_DIR .. "src/devices/bus/thomson/nanoreseau.cpp", MAME_DIR .. "src/devices/bus/thomson/nanoreseau.h", + MAME_DIR .. "src/devices/bus/thomson/rf57_932.cpp", + MAME_DIR .. "src/devices/bus/thomson/rf57_932.h", + MAME_DIR .. "src/devices/bus/thomson/speech.cpp", + MAME_DIR .. "src/devices/bus/thomson/speech.h", } end diff --git a/src/devices/bus/thomson/cc90_232.cpp b/src/devices/bus/thomson/cc90_232.cpp new file mode 100644 index 00000000000..6ec74ceba11 --- /dev/null +++ b/src/devices/bus/thomson/cc90_232.cpp @@ -0,0 +1,135 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine + +#include "emu.h" +#include "cc90_232.h" + +#include "bus/centronics/ctronics.h" +#include "machine/input_merger.h" +#include "machine/output_latch.h" + +#define VERBOSE 0 +#include "logmacro.h" + +/* ------------ CC 90-232 I/O extension ------------ */ + +/* Features: + - 6821 PIA + - serial RS232: bit-banging? + - parallel CENTRONICS: a printer (-prin) is emulated + - usable on TO7(/70), MO5(E), MO5NR + (TO8, TO9, MO6 normally use their built-in parallel printer interfaces instead) + + Note: it seems impossible to connect both a serial & a parallel device + because the Data Transmit Ready bit is shared in an incompatible way! +*/ + +// device type definition +DEFINE_DEVICE_TYPE(CC90_232, cc90_232_device, "cc90_232", "Thomson CC 90-232 Communication Interface") + +//------------------------------------------------- +// cc90_232_device - constructor +//------------------------------------------------- + +cc90_232_device::cc90_232_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, CC90_232, tag, owner, clock), + thomson_extension_interface(mconfig, *this), + m_pia_io(*this, "pia"), + m_rs232(*this, "rs232"), + m_last_low(0) +{ +} + +void cc90_232_device::rom_map(address_map &map) +{ +} + +void cc90_232_device::io_map(address_map &map) +{ + map(0x20, 0x23).rw(m_pia_io, FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); +} + +void cc90_232_device::device_add_mconfig(machine_config &config) +{ + PIA6821(config, m_pia_io); + m_pia_io->readpa_handler().set(FUNC(cc90_232_device::porta_in)); + m_pia_io->writepa_handler().set(FUNC(cc90_232_device::porta_out)); + m_pia_io->writepb_handler().set("cent_data_out", FUNC(output_latch_device::write)); + m_pia_io->cb2_handler().set("centronics", FUNC(centronics_device::write_strobe)); + m_pia_io->irqa_handler().set("piairq", FUNC(input_merger_device::in_w<0>)); + m_pia_io->irqb_handler().set("piairq", FUNC(input_merger_device::in_w<1>)); + + INPUT_MERGER_ANY_HIGH(config, "piairq").output_handler().set(FUNC(cc90_232_device::firq_w)); + + RS232_PORT(config, m_rs232, default_rs232_devices, nullptr); + m_rs232->rxd_handler().set(FUNC(cc90_232_device::write_rxd)); + m_rs232->cts_handler().set(FUNC(cc90_232_device::write_cts)); + m_rs232->dsr_handler().set(FUNC(cc90_232_device::write_dsr)); + + centronics_device ¢ronics(CENTRONICS(config, "centronics", centronics_devices, "printer")); + centronics.ack_handler().set(m_pia_io, FUNC(pia6821_device::cb1_w)); + centronics.busy_handler().set(FUNC(cc90_232_device::write_centronics_busy)); + + output_latch_device ¢_data_out(OUTPUT_LATCH(config, "cent_data_out")); + centronics.set_output_latch(cent_data_out); +} + + +void cc90_232_device::device_start() +{ + m_rs232->write_dtr(0); +} + +void cc90_232_device::porta_out(uint8_t data) +{ + int txd = (data >> 0) & 1; + int rts = (data >> 1) & 1; + + LOG( "%s %f porta_out: txd=%i, rts=%i\n", machine().describe_context(), machine().time().as_double(), txd, rts ); + + m_rs232->write_txd(txd); + m_rs232->write_rts(rts); +} + + + +WRITE_LINE_MEMBER(cc90_232_device::write_rxd ) +{ + m_rxd = state; +} + +WRITE_LINE_MEMBER(cc90_232_device::write_dsr ) +{ + if (!state) m_last_low = 0; + + m_dsr = state; +} + +WRITE_LINE_MEMBER(cc90_232_device::write_cts ) +{ + m_pia_io->ca1_w(state); + m_cts = state; +} + +WRITE_LINE_MEMBER(cc90_232_device::write_centronics_busy ) +{ + if (!state) m_last_low = 1; + + m_centronics_busy = state; +} + + +uint8_t cc90_232_device::porta_in() +{ + LOG( "%s %f porta_in: select=%i cts=%i, dsr=%i, rd=%i\n", machine().describe_context(), machine().time().as_double(), m_centronics_busy, m_cts, m_dsr, m_rxd ); + + /// HACK: without high impedance we can't tell whether a device is driving a line high or if it's being pulled up. + /// so assume the last device to drive it low is active. + int dsr; + if (m_last_low == 0) + dsr = m_dsr; + else + dsr = !m_centronics_busy; + + return (0x1f /* not required when converted to write_pa */) | (m_cts << 5) | (dsr << 6) | (m_rxd << 7); +} diff --git a/src/devices/bus/thomson/cc90_232.h b/src/devices/bus/thomson/cc90_232.h new file mode 100644 index 00000000000..c17981bedb4 --- /dev/null +++ b/src/devices/bus/thomson/cc90_232.h @@ -0,0 +1,48 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine + +#ifndef MAME_BUS_THOMSON_CC90_232_H +#define MAME_BUS_THOMSON_CC90_232_H + +#include "extension.h" +#include "bus/rs232/rs232.h" +#include "machine/6821pia.h" + +class cc90_232_device : public device_t, public thomson_extension_interface +{ +public: + cc90_232_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + virtual void rom_map(address_map &map) override; + virtual void io_map(address_map &map) override; + +protected: + virtual void device_add_mconfig(machine_config &config) override; + virtual void device_start() override; + +private: + // read data register + uint8_t porta_in(); + + // write data register + void porta_out(uint8_t data); + + DECLARE_WRITE_LINE_MEMBER(write_rxd); + DECLARE_WRITE_LINE_MEMBER(write_cts); + DECLARE_WRITE_LINE_MEMBER(write_dsr); + DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); + + required_device m_pia_io; + required_device m_rs232; + + int m_last_low = 0; + int m_centronics_busy = 0; + int m_rxd = 0; + int m_cts = 0; + int m_dsr = 0; +}; + +// device type declaration +DECLARE_DEVICE_TYPE(CC90_232, cc90_232_device) + +#endif // MAME_BUS_THOMSON_CC90_232_H diff --git a/src/devices/bus/thomson/cd90_015.cpp b/src/devices/bus/thomson/cd90_015.cpp index 6f9b2822647..6a4871e478c 100644 --- a/src/devices/bus/thomson/cd90_015.cpp +++ b/src/devices/bus/thomson/cd90_015.cpp @@ -9,7 +9,7 @@ #include "cd90_015.h" #include "formats/thom_dsk.h" -DEFINE_DEVICE_TYPE(CD90_015, cd90_015_device, "cd90_015", "Thomson CD90-015 floppy drive selectler") +DEFINE_DEVICE_TYPE(CD90_015, cd90_015_device, "cd90_015", "Thomson CD 90-015 floppy drive selectler") cd90_015_device::cd90_015_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, CD90_015, tag, owner, clock), @@ -32,8 +32,8 @@ void cd90_015_device::rom_map(address_map &map) void cd90_015_device::io_map(address_map &map) { - map(0, 7).m(m_fdc, FUNC(mc6843_device::map)); - map(8, 9).rw(FUNC(cd90_015_device::motor_r), FUNC(cd90_015_device::select_w)); + map(0x10, 0x17).m(m_fdc, FUNC(mc6843_device::map)); + map(0x18, 0x19).rw(FUNC(cd90_015_device::motor_r), FUNC(cd90_015_device::select_w)); } const tiny_rom_entry *cd90_015_device::device_rom_region() const @@ -53,7 +53,7 @@ void cd90_015_device::floppy_formats(format_registration &fr) void cd90_015_device::device_add_mconfig(machine_config &config) { - MC6843(config, m_fdc, 16_MHz_XTAL / 32); // Comes from the main board + MC6843(config, m_fdc, DERIVED_CLOCK(1, 2)); // Comes from the main board m_fdc->force_ready(); FLOPPY_CONNECTOR(config, m_floppy[0], floppy_drives, "dd90_015", floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, m_floppy[1], floppy_drives, nullptr, floppy_formats).enable_sound(true); diff --git a/src/devices/bus/thomson/cd90_015.h b/src/devices/bus/thomson/cd90_015.h index b2a4069e8cc..9af21d04a4c 100644 --- a/src/devices/bus/thomson/cd90_015.h +++ b/src/devices/bus/thomson/cd90_015.h @@ -15,7 +15,7 @@ class cd90_015_device : public device_t, public thomson_extension_interface { public: - cd90_015_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + cd90_015_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~cd90_015_device() = default; virtual void rom_map(address_map &map) override; diff --git a/src/devices/bus/thomson/cd90_351.cpp b/src/devices/bus/thomson/cd90_351.cpp index 44962c00115..d4a610c1f3f 100644 --- a/src/devices/bus/thomson/cd90_351.cpp +++ b/src/devices/bus/thomson/cd90_351.cpp @@ -12,7 +12,7 @@ #include "cd90_351.h" #include "formats/thom_dsk.h" -DEFINE_DEVICE_TYPE(CD90_351, cd90_351_device, "cd90_351", "Thomson CD90-351 floppy drive controller") +DEFINE_DEVICE_TYPE(CD90_351, cd90_351_device, "cd90_351", "Thomson CD 90-351 Diskette Controller") cd90_351_device::cd90_351_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, CD90_351, tag, owner, 16000000), @@ -41,15 +41,15 @@ void cd90_351_device::rom_map(address_map &map) void cd90_351_device::io_map(address_map &map) { - map(0, 0).rw(FUNC(cd90_351_device::stat0_r), FUNC(cd90_351_device::cmd0_w)); - map(1, 1).rw(FUNC(cd90_351_device::stat1_r), FUNC(cd90_351_device::cmd1_w)); - map(2, 2).w(FUNC(cd90_351_device::cmd2_w)); - map(3, 3).rw(FUNC(cd90_351_device::rdata_r), FUNC(cd90_351_device::wdata_w)); - map(4, 4).w(FUNC(cd90_351_device::wclk_w)); - map(5, 5).w(FUNC(cd90_351_device::wsect_w)); - map(6, 6).w(FUNC(cd90_351_device::wtrck_w)); - map(7, 7).w(FUNC(cd90_351_device::wcell_w)); - map(8, 8).w(FUNC(cd90_351_device::bank_w)); + map(0x10, 0x10).rw(FUNC(cd90_351_device::stat0_r), FUNC(cd90_351_device::cmd0_w)); + map(0x11, 0x11).rw(FUNC(cd90_351_device::stat1_r), FUNC(cd90_351_device::cmd1_w)); + map(0x12, 0x12).w(FUNC(cd90_351_device::cmd2_w)); + map(0x13, 0x13).rw(FUNC(cd90_351_device::rdata_r), FUNC(cd90_351_device::wdata_w)); + map(0x14, 0x14).w(FUNC(cd90_351_device::wclk_w)); + map(0x15, 0x15).w(FUNC(cd90_351_device::wsect_w)); + map(0x16, 0x16).w(FUNC(cd90_351_device::wtrck_w)); + map(0x17, 0x17).w(FUNC(cd90_351_device::wcell_w)); + map(0x18, 0x18).w(FUNC(cd90_351_device::bank_w)); } const tiny_rom_entry *cd90_351_device::device_rom_region() const diff --git a/src/devices/bus/thomson/cd90_640.cpp b/src/devices/bus/thomson/cd90_640.cpp index 4cae4efb97a..86453d795be 100644 --- a/src/devices/bus/thomson/cd90_640.cpp +++ b/src/devices/bus/thomson/cd90_640.cpp @@ -9,7 +9,7 @@ #include "cd90_640.h" #include "formats/thom_dsk.h" -DEFINE_DEVICE_TYPE(CD90_640, cd90_640_device, "cd90_640", "Thomson CD90-640 floppy drive controller") +DEFINE_DEVICE_TYPE(CD90_640, cd90_640_device, "cd90_640", "Thomson CD 90-640 floppy drive controller") cd90_640_device::cd90_640_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, CD90_640, tag, owner, clock), @@ -32,8 +32,8 @@ void cd90_640_device::rom_map(address_map &map) void cd90_640_device::io_map(address_map &map) { - map(0, 3).rw(m_fdc, FUNC(wd1770_device::read), FUNC(wd1770_device::write)); - map(8, 8).rw(FUNC(cd90_640_device::control_r), FUNC(cd90_640_device::control_w)); + map(0x10, 0x13).rw(m_fdc, FUNC(wd1770_device::read), FUNC(wd1770_device::write)); + map(0x18, 0x18).rw(FUNC(cd90_640_device::control_r), FUNC(cd90_640_device::control_w)); } const tiny_rom_entry *cd90_640_device::device_rom_region() const diff --git a/src/devices/bus/thomson/cd90_640.h b/src/devices/bus/thomson/cd90_640.h index 5598a71546d..184ca9a59e6 100644 --- a/src/devices/bus/thomson/cd90_640.h +++ b/src/devices/bus/thomson/cd90_640.h @@ -15,7 +15,7 @@ class cd90_640_device : public device_t, public thomson_extension_interface { public: - cd90_640_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + cd90_640_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~cd90_640_device() = default; virtual void rom_map(address_map &map) override; diff --git a/src/devices/bus/thomson/cq90_028.cpp b/src/devices/bus/thomson/cq90_028.cpp index fd14c5302f7..8d0ce518b19 100644 --- a/src/devices/bus/thomson/cq90_028.cpp +++ b/src/devices/bus/thomson/cq90_028.cpp @@ -11,7 +11,7 @@ #include "emu.h" #include "cq90_028.h" -DEFINE_DEVICE_TYPE(CQ90_028, cq90_028_device, "cq90_028", "Thomson CQ90-028 QDD controller") +DEFINE_DEVICE_TYPE(CQ90_028, cq90_028_device, "cq90_028", "Thomson CQ 90-028 QDD controller") cq90_028_device::cq90_028_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, CQ90_028, tag, owner, clock), @@ -33,9 +33,9 @@ void cq90_028_device::rom_map(address_map &map) void cq90_028_device::io_map(address_map &map) { - map(0x0, 0x1).rw(m_serial, FUNC(mc6852_device::read), FUNC(mc6852_device::write)); - map(0x8, 0x8).rw(FUNC(cq90_028_device::status_r), FUNC(cq90_028_device::drive_w)); - map(0xc, 0xc).w(FUNC(cq90_028_device::motor_w)); + map(0x10, 0x11).rw(m_serial, FUNC(mc6852_device::read), FUNC(mc6852_device::write)); + map(0x18, 0x18).rw(FUNC(cq90_028_device::status_r), FUNC(cq90_028_device::drive_w)); + map(0x1c, 0x1c).w(FUNC(cq90_028_device::motor_w)); } const tiny_rom_entry *cq90_028_device::device_rom_region() const @@ -45,7 +45,7 @@ const tiny_rom_entry *cq90_028_device::device_rom_region() const void cq90_028_device::device_add_mconfig(machine_config &config) { - MC6852(config, m_serial, 16_MHz_XTAL / 16); // Comes from the main board + MC6852(config, m_serial, DERIVED_CLOCK(1, 1)); // Comes from the main board // Base tx/rx clock is 101564Hz // There's probably a pll in the gate array } diff --git a/src/devices/bus/thomson/cq90_028.h b/src/devices/bus/thomson/cq90_028.h index d0a44448e38..a31a022405d 100644 --- a/src/devices/bus/thomson/cq90_028.h +++ b/src/devices/bus/thomson/cq90_028.h @@ -14,7 +14,7 @@ class cq90_028_device : public device_t, public thomson_extension_interface { public: - cq90_028_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + cq90_028_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~cq90_028_device() = default; static constexpr feature_type unemulated_features() { return feature::DISK; } diff --git a/src/devices/bus/thomson/extension.cpp b/src/devices/bus/thomson/extension.cpp index 12462b9898a..57c0729faec 100644 --- a/src/devices/bus/thomson/extension.cpp +++ b/src/devices/bus/thomson/extension.cpp @@ -11,7 +11,9 @@ DEFINE_DEVICE_TYPE(THOMSON_EXTENSION, thomson_extension_device, "thomson_extensi thomson_extension_device::thomson_extension_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, THOMSON_EXTENSION, tag, owner, clock), - device_single_card_slot_interface(mconfig, *this) + device_single_card_slot_interface(mconfig, *this), + m_firq_callback(*this), + m_irq_callback(*this) { } @@ -29,12 +31,30 @@ void thomson_extension_device::io_map(address_space_installer &space, offs_t sta space.install_device(start, end, *dev, &thomson_extension_interface::io_map); } +void thomson_extension_device::device_resolve_objects() +{ + m_firq_callback.resolve_safe(); + m_irq_callback.resolve_safe(); +} + void thomson_extension_device::device_start() { } thomson_extension_interface::thomson_extension_interface(const machine_config &mconfig, device_t &device) : - device_interface(device, "extension") + device_interface(device, "extension"), + m_ext(dynamic_cast(device.owner())) +{ +} + +WRITE_LINE_MEMBER(thomson_extension_interface::firq_w) { + if(m_ext) + m_ext->m_firq_callback(state); } +WRITE_LINE_MEMBER(thomson_extension_interface::irq_w) +{ + if(m_ext) + m_ext->m_irq_callback(state); +} diff --git a/src/devices/bus/thomson/extension.h b/src/devices/bus/thomson/extension.h index bbe9db92915..6fed74af0c6 100644 --- a/src/devices/bus/thomson/extension.h +++ b/src/devices/bus/thomson/extension.h @@ -6,6 +6,8 @@ #ifndef MAME_BUS_THOMSON_EXTENSION_H #define MAME_BUS_THOMSON_EXTENSION_H +class thomson_extension_device; + class thomson_extension_interface : public device_interface { public: @@ -15,23 +17,38 @@ public: // 0x7c0 window at e000 on TO* and a000 on MO* virtual void rom_map(address_map &map) = 0; - // 0x10 window at e7d0 on TO* and a7e0 on MO* + // 0x40 window at e7c0 on TO* and a7c0 on MO* virtual void io_map(address_map &map) = 0; -}; +protected: + DECLARE_WRITE_LINE_MEMBER(firq_w); + DECLARE_WRITE_LINE_MEMBER(irq_w); + +private: + thomson_extension_device *const m_ext; +}; class thomson_extension_device : public device_t, public device_single_card_slot_interface { + friend class thomson_extension_interface; + public: - thomson_extension_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); + thomson_extension_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~thomson_extension_device() = default; + auto firq_callback() { return m_firq_callback.bind(); } + auto irq_callback() { return m_irq_callback.bind(); } + void rom_map(address_space_installer &space, offs_t start, offs_t end); void io_map(address_space_installer &space, offs_t start, offs_t end); protected: + virtual void device_resolve_objects() override; virtual void device_start() override; + + devcb_write_line m_firq_callback; + devcb_write_line m_irq_callback; }; DECLARE_DEVICE_TYPE(THOMSON_EXTENSION, thomson_extension_device) diff --git a/src/devices/bus/thomson/md90_120.cpp b/src/devices/bus/thomson/md90_120.cpp new file mode 100644 index 00000000000..2c185342620 --- /dev/null +++ b/src/devices/bus/thomson/md90_120.cpp @@ -0,0 +1,94 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine + +#include "emu.h" +#include "md90_120.h" + +#include "machine/6821pia.h" +#include "machine/clock.h" + +#define VERBOSE 0 +#include "logmacro.h" + +/* ------------ MD 90-120 MODEM extension (not functional) ------------ */ + +/* Features: + - 6850 ACIA + - 6821 PIA + - asymetric 1200/ 75 bauds (reversable) + + TODO! + */ + +// device type definition +DEFINE_DEVICE_TYPE(MD90_120, md90_120_device, "md90_120", "Thomson MD 90-120 Modem") + +//------------------------------------------------- +// md90_120_device - constructor +//------------------------------------------------- + +md90_120_device::md90_120_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, MD90_120, tag, owner, clock), + thomson_extension_interface(mconfig, *this), + m_acia(*this, "acia") +{ +} + +void md90_120_device::rom_map(address_map &map) +{ +} + +void md90_120_device::io_map(address_map &map) +{ + map(0x38, 0x3b).rw("pia", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); + map(0x3e, 0x3f).rw(m_acia, FUNC(acia6850_device::read), FUNC(acia6850_device::write)); +} + +void md90_120_device::device_add_mconfig(machine_config &config) +{ + PIA6821(config, "pia"); + + ACIA6850(config, m_acia); + m_acia->txd_handler().set(FUNC(md90_120_device::modem_tx_w)); + m_acia->irq_handler().set(FUNC(md90_120_device::modem_cb)); + + clock_device &acia_clock(CLOCK(config, "acia_clock", 1200)); /* 1200 bauds, might be divided by 16 */ + acia_clock.signal_handler().set(FUNC(md90_120_device::write_acia_clock)); +} + + +WRITE_LINE_MEMBER( md90_120_device::modem_cb ) +{ + LOG( "modem_cb: called %i\n", state ); +} + + + +WRITE_LINE_MEMBER( md90_120_device::modem_tx_w ) +{ + m_modem_tx = state; +} + + +WRITE_LINE_MEMBER( md90_120_device::write_acia_clock ) +{ + m_acia->write_txc(state); + m_acia->write_rxc(state); +} + +void md90_120_device::device_reset() +{ + m_acia->write_rxd(0); + m_modem_tx = 0; + /* pia_reset() is called in machine_reset */ + /* acia_6850 has no reset (?) */ +} + + + +void md90_120_device::device_start() +{ + LOG ( " MODEM not implemented!\n" ); + save_item(NAME(m_modem_tx)); +} + diff --git a/src/devices/bus/thomson/md90_120.h b/src/devices/bus/thomson/md90_120.h new file mode 100644 index 00000000000..5d022faf7ff --- /dev/null +++ b/src/devices/bus/thomson/md90_120.h @@ -0,0 +1,38 @@ +// license:BSD-3-Clause +// copyright-holders:Antoine Mine + +#ifndef MAME_BUS_THOMSON_MD90_120_H +#define MAME_BUS_THOMSON_MD90_120_H + +#include "extension.h" +#include "machine/6850acia.h" + +class md90_120_device : public device_t, public thomson_extension_interface +{ +public: + md90_120_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + static constexpr feature_type unemulated_features() { return feature::COMMS; } + + virtual void rom_map(address_map &map) override; + virtual void io_map(address_map &map) override; + +protected: + virtual void device_add_mconfig(machine_config &config) override; + virtual void device_start() override; + virtual void device_reset() override; + +private: + DECLARE_WRITE_LINE_MEMBER( modem_cb ); + DECLARE_WRITE_LINE_MEMBER( modem_tx_w); + DECLARE_WRITE_LINE_MEMBER( write_acia_clock ); + + required_device m_acia; + + uint8_t m_modem_tx = 0; +}; + +// device type declaration +DECLARE_DEVICE_TYPE(MD90_120, md90_120_device) + +#endif // MAME_BUS_THOMSON_MD90_120_H diff --git a/src/devices/bus/thomson/midipak.cpp b/src/devices/bus/thomson/midipak.cpp new file mode 100644 index 00000000000..ad1ec4198c7 --- /dev/null +++ b/src/devices/bus/thomson/midipak.cpp @@ -0,0 +1,61 @@ +// license:BSD-3-Clause +// copyright-holders:AJR +/*************************************************************************** + + Logimus Midipak + + This MIDI extension interface basically consists of a EF68B50P plus + some glue logic. An onboard jumper (JP1) can connect the 6850's IRQ + output to either IRQ or FIRQ; currently only the IRQ connection is + supported. + +***************************************************************************/ + +#include "emu.h" +#include "midipak.h" + +#include "bus/midi/midi.h" +#include "machine/6850acia.h" +#include "machine/clock.h" + +// device type definition +DEFINE_DEVICE_TYPE(LOGIMUS_MIDIPAK, logimus_midipak_device, "logimus_midipak", "Logimus Midipak") + +//------------------------------------------------- +// logimus_midipak_device - constructor +//------------------------------------------------- + +logimus_midipak_device::logimus_midipak_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, LOGIMUS_MIDIPAK, tag, owner, clock) + , thomson_extension_interface(mconfig, *this) +{ +} + +void logimus_midipak_device::rom_map(address_map &map) +{ +} + +void logimus_midipak_device::io_map(address_map &map) +{ + map(0x32, 0x33).rw("acia", FUNC(acia6850_device::read), FUNC(acia6850_device::write)); +} + +void logimus_midipak_device::device_add_mconfig(machine_config &config) +{ + acia6850_device &acia(ACIA6850(config, "acia")); + acia.txd_handler().set("mdout", FUNC(midi_port_device::write_txd)); + acia.irq_handler().set(FUNC(logimus_midipak_device::irq_w)); + acia.write_cts(0); + acia.write_dcd(0); + + clock_device &midiclock(CLOCK(config, "midiclock", DERIVED_CLOCK(1, 1))); + midiclock.signal_handler().set("acia", FUNC(acia6850_device::write_rxc)); + midiclock.signal_handler().append("acia", FUNC(acia6850_device::write_txc)); + + MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set("acia", FUNC(acia6850_device::write_rxd)); + MIDI_PORT(config, "mdout", midiout_slot, "midiout"); +} + +void logimus_midipak_device::device_start() +{ +} diff --git a/src/devices/bus/thomson/midipak.h b/src/devices/bus/thomson/midipak.h new file mode 100644 index 00000000000..b6a1135cd3f --- /dev/null +++ b/src/devices/bus/thomson/midipak.h @@ -0,0 +1,25 @@ +// license:BSD-3-Clause +// copyright-holders:AJR + +#ifndef MAME_BUS_THOMSON_MIDIPAK_H +#define MAME_BUS_THOMSON_MIDIPAK_H + +#include "extension.h" + +class logimus_midipak_device : public device_t, public thomson_extension_interface +{ +public: + logimus_midipak_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void rom_map(address_map &map) override; + virtual void io_map(address_map &map) override; + +protected: + virtual void device_add_mconfig(machine_config &config) override; + virtual void device_start() override; +}; + +// device type declaration +DECLARE_DEVICE_TYPE(LOGIMUS_MIDIPAK, logimus_midipak_device) + +#endif // MAME_BUS_THOMSON_MIDIPAK_H diff --git a/src/devices/bus/thomson/nanoreseau.cpp b/src/devices/bus/thomson/nanoreseau.cpp index 418d9ce59e5..4275fe4fb59 100644 --- a/src/devices/bus/thomson/nanoreseau.cpp +++ b/src/devices/bus/thomson/nanoreseau.cpp @@ -85,9 +85,9 @@ void nanoreseau_device::rom_map(address_map &map) void nanoreseau_device::io_map(address_map &map) { - map(0, 3).rw(m_mc6854, FUNC(mc6854_device::read), FUNC(mc6854_device::write)); + map(0x10, 0x13).rw(m_mc6854, FUNC(mc6854_device::read), FUNC(mc6854_device::write)); if (!m_no_id) - map(8, 8).r(FUNC(nanoreseau_device::id_r)); + map(0x18, 0x18).r(FUNC(nanoreseau_device::id_r)); } const tiny_rom_entry *nanoreseau_to_device::device_rom_region() const diff --git a/src/devices/bus/thomson/rf57_932.cpp b/src/devices/bus/thomson/rf57_932.cpp new file mode 100644 index 00000000000..aae78237a4e --- /dev/null +++ b/src/devices/bus/thomson/rf57_932.cpp @@ -0,0 +1,55 @@ +// license:BSD-3-Clause +// copyright-holders:AJR +/*************************************************************************** + + Thomson RF 57-932 RS-232-C extension interface + +***************************************************************************/ + +#include "emu.h" +#include "rf57_932.h" + +#include "bus/rs232/rs232.h" +#include "machine/mos6551.h" + +// device type definition +DEFINE_DEVICE_TYPE(RF57_932, rf57_932_device, "rf57_932", "Thomson RF 57-932 RS-232-C Interface") + +//------------------------------------------------- +// rf57_932_device - constructor +//------------------------------------------------- + +rf57_932_device::rf57_932_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : device_t(mconfig, RF57_932, tag, owner, clock) + , thomson_extension_interface(mconfig, *this) +{ +} + +void rf57_932_device::rom_map(address_map &map) +{ +} + +void rf57_932_device::io_map(address_map &map) +{ + map(0x28, 0x2b).rw("acia", FUNC(mos6551_device::read), FUNC(mos6551_device::write)); +} + +void rf57_932_device::device_add_mconfig(machine_config &config) +{ + mos6551_device &acia(MOS6551(config, "acia", DERIVED_CLOCK(1, 1))); + acia.set_xtal(1.8432_MHz_XTAL); + acia.txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + acia.rts_handler().set("rs232", FUNC(rs232_port_device::write_rts)); + acia.irq_handler().set(FUNC(rf57_932_device::irq_w)); + acia.write_dcd(0); + + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, nullptr)); + rs232.rxd_handler().set("acia", FUNC(mos6551_device::write_rxd)); + rs232.dsr_handler().set("acia", FUNC(mos6551_device::write_dsr)); + rs232.cts_handler().set("acia", FUNC(mos6551_device::write_cts)); + rs232.rxc_handler().set("acia", FUNC(mos6551_device::write_rxc)); +} + +void rf57_932_device::device_start() +{ +} diff --git a/src/devices/bus/thomson/rf57_932.h b/src/devices/bus/thomson/rf57_932.h new file mode 100644 index 00000000000..9023403f528 --- /dev/null +++ b/src/devices/bus/thomson/rf57_932.h @@ -0,0 +1,25 @@ +// license:BSD-3-Clause +// copyright-holders:AJR + +#ifndef MAME_BUS_THOMSON_RF57_932_H +#define MAME_BUS_THOMSON_RF57_932_H + +#include "extension.h" + +class rf57_932_device : public device_t, public thomson_extension_interface +{ +public: + rf57_932_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void rom_map(address_map &map) override; + virtual void io_map(address_map &map) override; + +protected: + virtual void device_add_mconfig(machine_config &config) override; + virtual void device_start() override; +}; + +// device type declaration +DECLARE_DEVICE_TYPE(RF57_932, rf57_932_device) + +#endif // MAME_BUS_THOMSON_RF57_932_H diff --git a/src/devices/bus/thomson/speech.cpp b/src/devices/bus/thomson/speech.cpp new file mode 100644 index 00000000000..2266e1dd793 --- /dev/null +++ b/src/devices/bus/thomson/speech.cpp @@ -0,0 +1,43 @@ +// license:BSD-3-Clause +// copyright-holders:AJR + +#include "emu.h" +#include "speech.h" + +#include "sound/mea8000.h" +#include "speaker.h" + +// device type definition +DEFINE_DEVICE_TYPE(THOMSON_SPEECH, thomson_speech_device, "thomson_speech", "Cedic-Nathan Speech Synthesizer") + +//------------------------------------------------- +// thomson_speech_device - constructor +//------------------------------------------------- + +thomson_speech_device::thomson_speech_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, THOMSON_SPEECH, tag, owner, clock) + , thomson_extension_interface(mconfig, *this) +{ +} + +void thomson_speech_device::rom_map(address_map &map) +{ +} + +void thomson_speech_device::io_map(address_map &map) +{ + map(0x3e, 0x3f).rw("mea8000", FUNC(mea8000_device::read), FUNC(mea8000_device::write)); +} + +void thomson_speech_device::device_add_mconfig(machine_config &config) +{ + mea8000_device &mea8000(MEA8000(config, "mea8000", 4_MHz_XTAL)); + mea8000.add_route(ALL_OUTPUTS, "mono", 1.0); + + // FIXME: actually drives main speaker through the sound line on the bus + SPEAKER(config, "speaker").front_center(); +} + +void thomson_speech_device::device_start() +{ +} diff --git a/src/devices/bus/thomson/speech.h b/src/devices/bus/thomson/speech.h new file mode 100644 index 00000000000..c4e6f227edf --- /dev/null +++ b/src/devices/bus/thomson/speech.h @@ -0,0 +1,25 @@ +// license:BSD-3-Clause +// copyright-holders:AJR + +#ifndef MAME_BUS_THOMSON_SPEECH_H +#define MAME_BUS_THOMSON_SPEECH_H + +#include "extension.h" + +class thomson_speech_device : public device_t, public thomson_extension_interface +{ +public: + thomson_speech_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual void rom_map(address_map &map) override; + virtual void io_map(address_map &map) override; + +protected: + virtual void device_add_mconfig(machine_config &config) override; + virtual void device_start() override; +}; + +// device type declaration +DECLARE_DEVICE_TYPE(THOMSON_SPEECH, thomson_speech_device) + +#endif // MAME_BUS_THOMSON_SPEECH_H diff --git a/src/mame/thomson/thomson.cpp b/src/mame/thomson/thomson.cpp index 0bd3d83b58b..3e8f9214a7c 100644 --- a/src/mame/thomson/thomson.cpp +++ b/src/mame/thomson/thomson.cpp @@ -80,13 +80,16 @@ #include "thomson.h" #include "bus/centronics/ctronics.h" -#include "bus/rs232/rs232.h" +#include "bus/thomson/cc90_232.h" #include "bus/thomson/cd90_015.h" #include "bus/thomson/cq90_028.h" #include "bus/thomson/cd90_351.h" #include "bus/thomson/cd90_640.h" +#include "bus/thomson/md90_120.h" +#include "bus/thomson/midipak.h" #include "bus/thomson/nanoreseau.h" -#include "machine/6821pia.h" +#include "bus/thomson/rf57_932.h" +#include "bus/thomson/speech.h" #include "machine/clock.h" #include "machine/ram.h" #include "machine/wd_fdc.h" @@ -96,6 +99,8 @@ #include "formats/basicdsk.h" #include "formats/cd90_640_dsk.h" +#include "formats/thom_cas.h" +#include "formats/thom_dsk.h" #include "utf8.h" @@ -324,11 +329,6 @@ void thomson_state::to7_map(address_map &map) map(0xe7c0, 0xe7c7).rw(m_mc6846, FUNC(mc6846_device::read), FUNC(mc6846_device::write)); map(0xe7c8, 0xe7cb).rw("pia_0", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); map(0xe7cc, 0xe7cf).rw("pia_1", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); - map(0xe7e0, 0xe7e3).rw("to7_io:pia_2", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); - map(0xe7e8, 0xe7eb).rw("acia", FUNC(mos6551_device::read), FUNC(mos6551_device::write)); - map(0xe7f2, 0xe7f3).rw(FUNC(thomson_state::to7_midi_r), FUNC(thomson_state::to7_midi_w)); - map(0xe7f8, 0xe7fb).rw("pia_3", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); - map(0xe7fe, 0xe7ff).rw(FUNC(thomson_state::to7_modem_mea8000_r), FUNC(thomson_state::to7_modem_mea8000_w)); map(0xe800, 0xffff).rom(); /* system bios */ /* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ @@ -393,15 +393,6 @@ static INPUT_PORTS_START ( to7_vconfig ) INPUT_PORTS_END -static INPUT_PORTS_START ( to7_mconfig ) - PORT_START ( "mconfig" ) - - PORT_CONFNAME ( 0x01, 0x01, "E7FE-F port" ) - PORT_CONFSETTING ( 0x00, "Modem (unemulated)" ) - PORT_CONFSETTING ( 0x01, "Speech" ) - -INPUT_PORTS_END - static INPUT_PORTS_START ( to7_keyboard ) PORT_START ( "keyboard.0" ) KEY ( 0, "Shift", LSHIFT ) PORT_CODE ( KEYCODE_RSHIFT ) PORT_CHAR(UCHAR_SHIFT_1) @@ -482,7 +473,6 @@ static INPUT_PORTS_START ( to7 ) PORT_INCLUDE ( to7_keyboard ) PORT_INCLUDE ( to7_config ) PORT_INCLUDE ( to7_vconfig ) - PORT_INCLUDE ( to7_mconfig ) INPUT_PORTS_END static INPUT_PORTS_START ( t9000 ) @@ -520,9 +510,6 @@ void thomson_state::to7_base(machine_config &config, bool is_mo) DAC_1BIT(config, "buzzer", 0).add_route(ALL_OUTPUTS, "speaker", 0.5); DAC_6BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.5); // 6-bit game extension R-2R DAC (R=10K) -/* speech synthesis */ - MEA8000(config, m_mea8000, 3840000).add_route(ALL_OUTPUTS, "speaker", 1.0); - /* cassette */ CASSETTE(config, m_cassette); m_cassette->set_formats(to7_cassette_formats); @@ -530,11 +517,18 @@ void thomson_state::to7_base(machine_config &config, bool is_mo) m_cassette->set_interface("to_cass"); /* extension port */ - THOMSON_EXTENSION(config, m_extension); + THOMSON_EXTENSION(config, m_extension, 16_MHz_XTAL / 16); + m_extension->firq_callback().set("mainfirq", FUNC(input_merger_device::in_w<3>)); + m_extension->irq_callback().set("mainirq", FUNC(input_merger_device::in_w<3>)); + m_extension->option_add("cc90_232", CC90_232); m_extension->option_add("cd90_015", CD90_015); m_extension->option_add("cq90_028", CQ90_028); m_extension->option_add("cd90_351", CD90_351); m_extension->option_add("cd90_640", CD90_640); + m_extension->option_add("md90_120", MD90_120); + m_extension->option_add("midipak", LOGIMUS_MIDIPAK); + m_extension->option_add("rf57_932", RF57_932); + m_extension->option_add("speech", THOMSON_SPEECH); if(is_mo) m_extension->option_add("nanoreseau", NANORESEAU_MO); else @@ -547,7 +541,7 @@ void thomson_state::to7_base(machine_config &config, bool is_mo) m_pia_sys->writepb_handler().set(FUNC(thomson_state::to7_sys_portb_out)); m_pia_sys->ca2_handler().set(FUNC(thomson_state::to7_set_cassette_motor)); m_pia_sys->cb2_handler().set(FUNC(thomson_state::to7_sys_cb2_out)); - m_pia_sys->irqa_handler().set("mainfirq", FUNC(input_merger_device::in_w<1>)); + m_pia_sys->irqa_handler().set("mainfirq", FUNC(input_merger_device::in_w<0>)); m_pia_sys->irqb_handler().set("mainfirq", FUNC(input_merger_device::in_w<1>)); PIA6821(config, m_pia_game, 0); @@ -556,34 +550,7 @@ void thomson_state::to7_base(machine_config &config, bool is_mo) m_pia_game->writepb_handler().set(FUNC(thomson_state::to7_game_portb_out)); m_pia_game->cb2_handler().set(FUNC(thomson_state::to7_game_cb2_out)); m_pia_game->irqa_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); - m_pia_game->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); - -/* TODO: CONVERT THIS TO A SLOT DEVICE (RF 57-932) */ - mos6551_device &acia(MOS6551(config, "acia", 0)); - acia.set_xtal(1.8432_MHz_XTAL); - acia.txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); - - /// 2400 7N2 - rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, nullptr)); - rs232.rxd_handler().set("acia", FUNC(mos6551_device::write_rxd)); - rs232.dcd_handler().set("acia", FUNC(mos6551_device::write_dcd)); - rs232.dsr_handler().set("acia", FUNC(mos6551_device::write_dsr)); - rs232.cts_handler().set("acia", FUNC(mos6551_device::write_cts)); - - -/* TODO: CONVERT THIS TO A SLOT DEVICE (CC 90-232) */ - TO7_IO_LINE(config, "to7_io", 0); - - -/* TODO: CONVERT THIS TO A SLOT DEVICE (MD 90-120) */ - PIA6821(config, THOM_PIA_MODEM, 0); - - ACIA6850(config, m_acia, 0); - m_acia->txd_handler().set(FUNC(thomson_state::to7_modem_tx_w)); - m_acia->irq_handler().set(FUNC(thomson_state::to7_modem_cb)); - - clock_device &acia_clock(CLOCK(config, "acia_clock", 1200)); /* 1200 bauds, might be divided by 16 */ - acia_clock.signal_handler().set(FUNC(thomson_state::write_acia_clock)); + m_pia_game->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<2>)); /* cartridge */ GENERIC_CARTSLOT(config, "cartslot", generic_plain_slot, "to_cart", "m7,rom").set_device_load(FUNC(thomson_state::to7_cartridge)); @@ -681,12 +648,7 @@ void thomson_state::to770_map(address_map &map) map(0xe7c0, 0xe7c7).rw(m_mc6846, FUNC(mc6846_device::read), FUNC(mc6846_device::write)); map(0xe7c8, 0xe7cb).rw("pia_0", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); map(0xe7cc, 0xe7cf).rw("pia_1", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); - map(0xe7e0, 0xe7e3).rw("to7_io:pia_2", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); map(0xe7e4, 0xe7e7).rw(FUNC(thomson_state::to770_gatearray_r), FUNC(thomson_state::to770_gatearray_w)); - map(0xe7e8, 0xe7eb).rw("acia", FUNC(mos6551_device::read), FUNC(mos6551_device::write)); - map(0xe7f2, 0xe7f3).rw(FUNC(thomson_state::to7_midi_r), FUNC(thomson_state::to7_midi_w)); - map(0xe7f8, 0xe7fb).rw("pia_3", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); - map(0xe7fe, 0xe7ff).rw(FUNC(thomson_state::to7_modem_mea8000_r), FUNC(thomson_state::to7_modem_mea8000_w)); map(0xe800, 0xffff).rom(); /* system bios */ /* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ @@ -877,11 +839,7 @@ void mo5_state::mo5_map(address_map &map) map(0xa7c0, 0xa7c3).rw("pia_0", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); map(0xa7cb, 0xa7cb).w(FUNC(mo5_state::mo5_ext_w)); map(0xa7cc, 0xa7cf).rw("pia_1", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); - map(0xa7e0, 0xa7e3).rw("to7_io:pia_2", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); map(0xa7e4, 0xa7e7).rw(FUNC(mo5_state::mo5_gatearray_r), FUNC(mo5_state::mo5_gatearray_w)); - map(0xa7e8, 0xa7eb).rw("acia", FUNC(mos6551_device::read), FUNC(mos6551_device::write)); - map(0xa7f2, 0xa7f3).rw(FUNC(mo5_state::to7_midi_r), FUNC(mo5_state::to7_midi_w)); - map(0xa7fe, 0xa7ff).rw(m_mea8000, FUNC(mea8000_device::read), FUNC(mea8000_device::write)); map(0xb000, 0xefff).bankr(THOM_CART_BANK).w(FUNC(mo5_state::mo5_cartridge_w)); map(0xf000, 0xffff).rom(); /* system bios */ @@ -986,7 +944,7 @@ void mo5_state::mo5(machine_config &config) m_pia_sys->writepb_handler().set("buzzer", FUNC(dac_bit_interface::data_w)); m_pia_sys->ca2_handler().set(FUNC(mo5_state::mo5_set_cassette_motor)); m_pia_sys->cb2_handler().set_nop(); - m_pia_sys->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); // WARNING: differs from TO7 ! + m_pia_sys->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<0>)); // WARNING: differs from TO7 ! GENERIC_CARTSLOT(config.replace(), "cartslot", generic_plain_slot, "mo_cart", "m5,rom").set_device_load(FUNC(mo5_state::mo5_cartridge)); @@ -1100,11 +1058,7 @@ void to9_state::to9_map(address_map &map) map(0xe7da, 0xe7dd).rw(FUNC(to9_state::to9_vreg_r), FUNC(to9_state::to9_vreg_w)); map(0xe7de, 0xe7df).rw(FUNC(to9_state::to9_kbd_r), FUNC(to9_state::to9_kbd_w)); map(0xe7e4, 0xe7e7).rw(FUNC(to9_state::to9_gatearray_r), FUNC(to9_state::to9_gatearray_w)); - map(0xe7e8, 0xe7eb).rw("acia", FUNC(mos6551_device::read), FUNC(mos6551_device::write)); /* map(0xe7f0, 0xe7f7).rw(FUNC(to9_state::to9_ieee_r), FUNC(to9_state::to9_ieee_w )); */ - map(0xe7f2, 0xe7f3).rw(FUNC(to9_state::to7_midi_r), FUNC(to9_state::to7_midi_w)); - map(0xe7f8, 0xe7fb).rw("pia_3", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); - map(0xe7fe, 0xe7ff).rw(FUNC(to9_state::to7_modem_mea8000_r), FUNC(to9_state::to7_modem_mea8000_w)); map(0xe800, 0xffff).rom(); /* system bios */ /* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ @@ -1266,7 +1220,6 @@ static INPUT_PORTS_START ( to9 ) PORT_INCLUDE ( to9_keyboard ) PORT_INCLUDE ( to7_config ) PORT_INCLUDE ( to7_vconfig ) - PORT_INCLUDE ( to7_mconfig ) INPUT_PORTS_END /* ------------ driver ------------ */ @@ -1377,11 +1330,7 @@ void to9_state::to8_map(address_map &map) map(0xe7cc, 0xe7cf).rw("pia_1", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); map(0xe7da, 0xe7dd).rw(FUNC(to9_state::to8_vreg_r), FUNC(to9_state::to8_vreg_w)); map(0xe7e4, 0xe7e7).rw(FUNC(to9_state::to8_gatearray_r), FUNC(to9_state::to8_gatearray_w)); - map(0xe7e8, 0xe7eb).rw("acia", FUNC(mos6551_device::read), FUNC(mos6551_device::write)); /* map(0xe7f0, 0xe7f7).rw(FUNC(to9_state::to9_ieee_r), FUNC(to9_state::to9_ieee_w )); */ - map(0xe7f2, 0xe7f3).rw(FUNC(to9_state::to7_midi_r), FUNC(to9_state::to7_midi_w)); - map(0xe7f8, 0xe7fb).rw("pia_3", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); - map(0xe7fe, 0xe7ff).rw(FUNC(to9_state::to7_modem_mea8000_r), FUNC(to9_state::to7_modem_mea8000_w)); map(0xe800, 0xffff).bankr(TO8_BIOS_BANK); /* 2 * 6 KB */ /* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ @@ -1477,7 +1426,6 @@ static INPUT_PORTS_START ( to8 ) PORT_INCLUDE ( to9_keyboard ) PORT_INCLUDE ( to8_config ) PORT_INCLUDE ( to7_vconfig ) - PORT_INCLUDE ( to7_mconfig ) INPUT_PORTS_END @@ -1583,11 +1531,7 @@ void to9_state::to9p_map(address_map &map) map(0xe7da, 0xe7dd).rw(FUNC(to9_state::to8_vreg_r), FUNC(to9_state::to8_vreg_w)); map(0xe7de, 0xe7df).rw(FUNC(to9_state::to9_kbd_r), FUNC(to9_state::to9_kbd_w)); map(0xe7e4, 0xe7e7).rw(FUNC(to9_state::to8_gatearray_r), FUNC(to9_state::to8_gatearray_w)); - map(0xe7e8, 0xe7eb).rw("acia", FUNC(mos6551_device::read), FUNC(mos6551_device::write)); /* map(0xe7f0, 0xe7f7).rw(FUNC(to9_state::to9_ieee_r), FUNC(to9_state::to9_ieee_w )); */ - map(0xe7f2, 0xe7f3).rw(FUNC(to9_state::to7_midi_r), FUNC(to9_state::to7_midi_w)); - map(0xe7f8, 0xe7fb).rw("pia_3", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); - map(0xe7fe, 0xe7ff).rw(FUNC(to9_state::to7_modem_mea8000_r), FUNC(to9_state::to7_modem_mea8000_w)); map(0xe800, 0xffff).bankr(TO8_BIOS_BANK); /* 2 * 6 KB */ /* 0x10000 - 0x1ffff: 64 KB external ROM cartridge */ @@ -1640,7 +1584,6 @@ static INPUT_PORTS_START ( to9p ) PORT_INCLUDE ( to9_keyboard ) PORT_INCLUDE ( to7_config ) PORT_INCLUDE ( to7_vconfig ) - PORT_INCLUDE ( to7_mconfig ) INPUT_PORTS_END /* ------------ driver ------------ */ @@ -1752,10 +1695,7 @@ void mo6_state::mo6_map(address_map &map) map(0xa7cc, 0xa7cf).rw("pia_1", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); map(0xa7da, 0xa7dd).rw(FUNC(mo6_state::mo6_vreg_r), FUNC(mo6_state::mo6_vreg_w)); map(0xa7e4, 0xa7e7).rw(FUNC(mo6_state::mo6_gatearray_r), FUNC(mo6_state::mo6_gatearray_w)); - map(0xa7e8, 0xa7eb).rw("acia", FUNC(mos6551_device::read), FUNC(mos6551_device::write)); /* map(0xa7f0, 0xa7f7).rw(FUNC(mo6_state::to9_ieee_r), FUNC(homson_state::to9_ieee_w));*/ - map(0xa7f2, 0xa7f3).rw(FUNC(mo6_state::to7_midi_r), FUNC(mo6_state::to7_midi_w)); - map(0xa7fe, 0xa7ff).rw(m_mea8000, FUNC(mea8000_device::read), FUNC(mea8000_device::write)); map(0xb000, 0xbfff).bankr(MO6_CART_LO).w(FUNC(mo6_state::mo6_cartridge_w)); map(0xc000, 0xefff).bankr(MO6_CART_HI).w(FUNC(mo6_state::mo6_cartridge_w)); map(0xf000, 0xffff).bankr(TO8_BIOS_BANK); @@ -2001,7 +1941,7 @@ void mo6_state::mo6(machine_config &config) m_pia_sys->writepb_handler().set("buzzer", FUNC(dac_bit_interface::data_w)); m_pia_sys->ca2_handler().set(FUNC(mo6_state::mo5_set_cassette_motor)); m_pia_sys->cb2_handler().set(FUNC(mo6_state::mo6_sys_cb2_out)); - m_pia_sys->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); // differs from TO + m_pia_sys->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<0>)); // differs from TO m_pia_game->writepa_handler().set(FUNC(mo6_state::mo6_game_porta_out)); m_pia_game->cb2_handler().set(FUNC(mo6_state::mo6_game_cb2_out)); @@ -2076,7 +2016,7 @@ Here are the differences between the MO6 and MO5NR: * devices: - AZERTY keyboard has only 58 keys, and no caps-lock led - - CENTRONICS printer handled differently + - CENTRONICS printer interface not built in (requires CC 90-232 extension) - MO5-compatible network (probably identical to NR 07-005 extension) - extern floppy controller & drive possible, masks the network @@ -2096,15 +2036,8 @@ void mo5nr_state::mo5nr_map(address_map &map) map(0xa7cc, 0xa7cf).rw("pia_1", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); m_extension_view[1](0xa7d8, 0xa7d9).r(FUNC(mo5nr_state::id_r)); map(0xa7da, 0xa7dd).rw(FUNC(mo5nr_state::mo6_vreg_r), FUNC(mo5nr_state::mo6_vreg_w)); - map(0xa7e1, 0xa7e1).r("cent_data_in", FUNC(input_buffer_device::read)); - map(0xa7e1, 0xa7e1).w(m_cent_data_out, FUNC(output_latch_device::write)); - map(0xa7e3, 0xa7e3).rw(FUNC(mo5nr_state::mo5nr_prn_r), FUNC(mo5nr_state::mo5nr_prn_w)); map(0xa7e4, 0xa7e7).rw(FUNC(mo5nr_state::mo6_gatearray_r), FUNC(mo5nr_state::mo6_gatearray_w)); - map(0xa7e8, 0xa7eb).rw("acia", FUNC(mos6551_device::read), FUNC(mos6551_device::write)); /* map(0xa7f0, 0xa7f7).rw(FUNC(mo5nr_state::to9_ieee_r), FUNC(homson_state::to9_ieee_w));*/ - map(0xa7f2, 0xa7f3).rw(FUNC(mo5nr_state::to7_midi_r), FUNC(mo5nr_state::to7_midi_w)); - map(0xa7f8, 0xa7fb).rw("pia_3", FUNC(pia6821_device::read_alt), FUNC(pia6821_device::write_alt)); - map(0xa7fe, 0xa7ff).rw(m_mea8000, FUNC(mea8000_device::read), FUNC(mea8000_device::write)); map(0xb000, 0xbfff).bankr(MO6_CART_LO).w(FUNC(mo5nr_state::mo6_cartridge_w)); map(0xc000, 0xefff).bankr(MO6_CART_HI).w(FUNC(mo5nr_state::mo6_cartridge_w)); map(0xf000, 0xffff).bankr(TO8_BIOS_BANK); @@ -2302,23 +2235,14 @@ void mo5nr_state::mo5nr(machine_config &config) m_pia_sys->writepb_handler().set("buzzer", FUNC(dac_bit_interface::data_w)); m_pia_sys->ca2_handler().set(FUNC(mo5nr_state::mo5_set_cassette_motor)); m_pia_sys->cb2_handler().set(FUNC(mo5nr_state::mo6_sys_cb2_out)); - m_pia_sys->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<1>)); // differs from TO - - m_pia_game->writepa_handler().set(FUNC(mo5nr_state::mo6_game_porta_out)); - - CENTRONICS(config, m_centronics, centronics_devices, "printer"); - m_centronics->set_data_input_buffer("cent_data_in"); - m_centronics->busy_handler().set(FUNC(mo5nr_state::write_centronics_busy)); - - INPUT_BUFFER(config, "cent_data_in"); - - OUTPUT_LATCH(config, m_cent_data_out); - m_centronics->set_output_latch(*m_cent_data_out); + m_pia_sys->irqb_handler().set("mainirq", FUNC(input_merger_device::in_w<0>)); // differs from TO GENERIC_CARTSLOT(config.replace(), "cartslot", generic_plain_slot, "mo_cart", "m5,rom").set_device_load(FUNC(mo5nr_state::mo5_cartridge)); NANORESEAU_MO(config, m_nanoreseau, 0, true); + m_extension->option_remove("nanoreseau"); + /* internal ram */ m_ram->set_default_size("128K"); diff --git a/src/mame/thomson/thomson.h b/src/mame/thomson/thomson.h index a949ada1547..670f951dbb3 100644 --- a/src/mame/thomson/thomson.h +++ b/src/mame/thomson/thomson.h @@ -14,26 +14,18 @@ #pragma once #include "cpu/m6809/m6809.h" -#include "formats/thom_cas.h" -#include "formats/thom_dsk.h" #include "imagedev/cassette.h" #include "machine/6821pia.h" -#include "machine/6850acia.h" #include "machine/input_merger.h" -#include "machine/mc6843.h" #include "machine/mc6846.h" -#include "machine/mc6846.h" -#include "machine/mos6551.h" #include "machine/ram.h" #include "sound/dac.h" -#include "sound/mea8000.h" #include "bus/thomson/extension.h" #include "bus/thomson/nanoreseau.h" #include "bus/centronics/ctronics.h" #include "bus/generic/slot.h" #include "bus/generic/carts.h" -#include "bus/rs232/rs232.h" #include "emupal.h" #include "screen.h" @@ -42,13 +34,6 @@ /* 6821 PIAs */ #define THOM_PIA_SYS "pia_0" /* system PIA */ #define THOM_PIA_GAME "pia_1" /* music & game PIA (joypad + sound) */ -#define THOM_PIA_IO "pia_2" /* CC 90-232 I/O extension (parallel & RS-232) */ -#define THOM_PIA_MODEM "pia_3" /* MD 90-120 MODEM extension */ - -/* sound ports */ -#define THOM_SOUND_BUZ 0 /* 1-bit buzzer */ -#define THOM_SOUND_GAME 1 /* 6-bit game port DAC */ -#define THOM_SOUND_SPEECH 2 /* speech synthesis */ /* bank-switching */ #define THOM_CART_BANK "bank2" /* cartridge ROM */ @@ -77,12 +62,6 @@ Emulated screen can have smaller borders. */ -/* maximum number of video pages: - 1 for TO7 generation (including MO5) - 4 for TO8 generation (including TO9, MO6) - */ -#define THOM_NB_PAGES 4 - /* page 0 is banked */ #define THOM_VRAM_BANK "bank1" @@ -104,15 +83,10 @@ public: m_maincpu(*this, "maincpu"), m_cassette(*this, "cassette"), m_dac(*this, "dac"), - m_centronics(*this, "centronics"), - m_cent_data_out(*this, "cent_data_out"), m_pia_sys(*this, THOM_PIA_SYS), m_pia_game(*this, THOM_PIA_GAME), - m_acia(*this, "acia6850"), - m_mea8000(*this, "mea8000"), m_ram(*this, RAM_TAG), m_mc6846(*this, "mc6846"), - m_mc6843(*this, "mc6843"), m_screen(*this, "screen"), m_mainirq(*this, "mainirq"), m_mainfirq(*this, "mainfirq"), @@ -127,7 +101,6 @@ public: m_io_lightpen_button(*this, "lightpen_button"), m_io_config(*this, "config"), m_io_vconfig(*this, "vconfig"), - m_io_mconfig(*this, "mconfig"), m_io_keyboard(*this, "keyboard.%u", 0), m_vrambank(*this, THOM_VRAM_BANK), m_cartbank(*this, THOM_CART_BANK), @@ -196,18 +169,11 @@ protected: void to7_sys_portb_out(uint8_t data); uint8_t to7_sys_porta_in(); uint8_t to7_sys_portb_in(); - DECLARE_WRITE_LINE_MEMBER( to7_modem_cb ); - DECLARE_WRITE_LINE_MEMBER( to7_modem_tx_w); - DECLARE_WRITE_LINE_MEMBER( write_acia_clock ); - uint8_t to7_modem_mea8000_r(offs_t offset); - void to7_modem_mea8000_w(offs_t offset, uint8_t data); uint8_t to7_game_porta_in(); uint8_t to7_game_portb_in(); void to7_game_portb_out(uint8_t data); DECLARE_WRITE_LINE_MEMBER( to7_game_cb2_out ); TIMER_CALLBACK_MEMBER( to7_game_update_cb ); - uint8_t to7_midi_r(); - void to7_midi_w(uint8_t data); DECLARE_MACHINE_RESET( to7 ); DECLARE_MACHINE_START( to7 ); DECLARE_WRITE_LINE_MEMBER( to770_sys_cb2_out ); @@ -241,24 +207,16 @@ protected: TIMER_CALLBACK_MEMBER( ans ); void thom_palette(palette_device &palette); - int m_centronics_busy = 0; - int m_centronics_perror = 0; - void to7_map(address_map &map); void to770_map(address_map &map); required_device m_maincpu; required_device m_cassette; required_device m_dac; - optional_device m_centronics; - optional_device m_cent_data_out; required_device m_pia_sys; required_device m_pia_game; - required_device m_acia; - required_device m_mea8000; required_device m_ram; optional_device m_mc6846; - optional_device m_mc6843; required_device m_screen; required_device m_mainirq; required_device m_mainfirq; @@ -273,7 +231,6 @@ protected: required_ioport m_io_lightpen_button; required_ioport m_io_config; required_ioport m_io_vconfig; - optional_ioport m_io_mconfig; required_ioport_array<10> m_io_keyboard; required_memory_bank m_vrambank; optional_memory_bank m_cartbank; @@ -295,7 +252,6 @@ protected: uint8_t m_thom_cart_bank = 0; /* current bank */ uint8_t m_to7_lightpen_step = 0; uint8_t m_to7_lightpen = 0; - uint8_t m_to7_modem_tx = 0; /* calls to7_game_update_cb periodically */ emu_timer* m_to7_game_timer = nullptr; uint8_t m_to7_game_sound = 0; @@ -359,14 +315,10 @@ protected: void thom_irq_reset(); void to7_update_cart_bank(); void to7_set_init( int init ); - void to7_modem_reset(); - void to7_modem_init(); uint8_t to7_get_mouse_signal(); void to7_game_sound_update(); void to7_game_init(); void to7_game_reset(); - void to7_midi_reset(); - void to7_midi_init(); void to770_update_ram_bank(); TIMER_CALLBACK_MEMBER( mo5_periodic_cb ); @@ -432,6 +384,8 @@ class to9_state : public thomson_state public: to9_state(const machine_config &mconfig, device_type type, const char *tag) : thomson_state(mconfig, type, tag), + m_centronics(*this, "centronics"), + m_cent_data_out(*this, "cent_data_out"), m_syslobank(*this, TO8_SYS_LO), m_syshibank(*this, TO8_SYS_HI), m_datalobank(*this, TO8_DATA_LO), @@ -446,12 +400,17 @@ public: void to9p(machine_config &config); protected: + optional_device m_centronics; + optional_device m_cent_data_out; + required_memory_bank m_syslobank; optional_memory_bank m_syshibank; optional_memory_bank m_datalobank; optional_memory_bank m_datahibank; optional_memory_bank m_biosbank; + int m_centronics_busy = 0; + uint8_t m_to8_kbd_ack = 0; /* 1 = cpu inits / accepts transfers */ uint16_t m_to8_kbd_data = 0; /* data to transmit */ uint16_t m_to8_kbd_step = 0; /* transmission automaton state */ @@ -640,8 +599,6 @@ protected: uint8_t mo5nr_net_r(offs_t offset); void mo5nr_net_w(offs_t offset, uint8_t data); - uint8_t mo5nr_prn_r(); - void mo5nr_prn_w(uint8_t data); uint8_t mo5nr_sys_portb_in(); void mo5nr_sys_porta_out(uint8_t data); }; @@ -695,38 +652,5 @@ protected: #define THOM_VMODE_NB 16 -class to7_io_line_device : public device_t -{ -public: - // construction/destruction - to7_io_line_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - -protected: - // device-level overrides - virtual void device_start() override; - virtual void device_add_mconfig(machine_config &config) override; - -private: - required_device m_pia_io; - required_device m_rs232; - int m_last_low = 0; - int m_centronics_busy = 0; - int m_rxd = 0; - int m_cts = 0; - int m_dsr = 0; - - /* read data register */ - uint8_t porta_in(); - - /* write data register */ - void porta_out(uint8_t data); - - DECLARE_WRITE_LINE_MEMBER(write_rxd); - DECLARE_WRITE_LINE_MEMBER(write_cts); - DECLARE_WRITE_LINE_MEMBER(write_dsr); - DECLARE_WRITE_LINE_MEMBER(write_centronics_busy); -}; - -DECLARE_DEVICE_TYPE(TO7_IO_LINE, to7_io_line_device) #endif // MAME_INCLUDES_THOMSON_H diff --git a/src/mame/thomson/thomson_m.cpp b/src/mame/thomson/thomson_m.cpp index 0e1f93729a8..c65cf29c522 100644 --- a/src/mame/thomson/thomson_m.cpp +++ b/src/mame/thomson/thomson_m.cpp @@ -14,23 +14,17 @@ #include "machine/ram.h" #define VERBOSE 0 -#define VERBOSE_IRQ 0 #define VERBOSE_KBD 0 /* TO8 / TO9 / TO9+ keyboard */ #define VERBOSE_BANK 0 #define VERBOSE_VIDEO 0 /* video & lightpen */ -#define VERBOSE_IO 0 /* serial & parallel I/O */ -#define VERBOSE_MIDI 0 #define PRINT(x) osd_printf_info x #define LOG(x) do { if (VERBOSE) logerror x; } while (0) #define VLOG(x) do { if (VERBOSE > 1) logerror x; } while (0) -#define LOG_IRQ(x) do { if (VERBOSE_IRQ) logerror x; } while (0) #define LOG_KBD(x) do { if (VERBOSE_KBD) logerror x; } while (0) #define LOG_BANK(x) do { if (VERBOSE_BANK) logerror x; } while (0) #define LOG_VIDEO(x) do { if (VERBOSE_VIDEO) logerror x; } while (0) -#define LOG_IO(x) do { if (VERBOSE_IO) logerror x; } while (0) -#define LOG_MIDI(x) do { if (VERBOSE_MIDI) logerror x; } while (0) /* This set to 1 handle the .k7 files without passing through .wav */ /* It must be set accordingly in formats/thom_cas.c */ @@ -231,18 +225,6 @@ void thomson_state::thom_irq_reset() -/* - current IRQ usage: - - line 0 => 6846 interrupt - line 1 => 6821 interrupts (shared for all 6821) - line 2 => TO8 lightpen interrupt (from gate-array) - line 3 => TO9 keyboard interrupt (from 6850 ACIA) - line 4 => MIDI interrupt (from 6850 ACIA) -*/ - - - /* ------------ 6850 defines ------------ */ #define ACIA_6850_RDRF 0x01 /* Receive data register full */ @@ -482,226 +464,6 @@ uint8_t thomson_state::to7_sys_portb_in() -/* ------------ CC 90-232 I/O extension ------------ */ - -/* Features: - - 6821 PIA - - serial RS232: bit-banging? - - parallel CENTRONICS: a printer (-prin) is emulated - - usable on TO7(/70), MO5(E) only; not on TO9 and higher - - Note: it seems impossible to connect both a serial & a parallel device - because the Data Transmit Ready bit is shared in an incompatible way! -*/ - -DEFINE_DEVICE_TYPE(TO7_IO_LINE, to7_io_line_device, "to7_io_line", "TO7 Serial source") - -//------------------------------------------------- -// to7_io_line_device - constructor -//------------------------------------------------- - -to7_io_line_device::to7_io_line_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, TO7_IO_LINE, tag, owner, clock), - m_pia_io(*this, THOM_PIA_IO), - m_rs232(*this, "rs232"), - m_last_low(0) -{ -} - -void to7_io_line_device::device_add_mconfig(machine_config &config) -{ - /// THIS PIO is part of CC 90-232 expansion - PIA6821(config, m_pia_io, 0); - m_pia_io->readpa_handler().set(FUNC(to7_io_line_device::porta_in)); - m_pia_io->writepa_handler().set(FUNC(to7_io_line_device::porta_out)); - m_pia_io->writepb_handler().set("cent_data_out", FUNC(output_latch_device::write)); - m_pia_io->cb2_handler().set("centronics", FUNC(centronics_device::write_strobe)); - m_pia_io->irqa_handler().set("^mainfirq", FUNC(input_merger_device::in_w<1>)); - m_pia_io->irqb_handler().set("^mainfirq", FUNC(input_merger_device::in_w<1>)); - - RS232_PORT(config, m_rs232, default_rs232_devices, nullptr); - m_rs232->rxd_handler().set(FUNC(to7_io_line_device::write_rxd)); - m_rs232->cts_handler().set(FUNC(to7_io_line_device::write_cts)); - m_rs232->dsr_handler().set(FUNC(to7_io_line_device::write_dsr)); - - centronics_device ¢ronics(CENTRONICS(config, "centronics", centronics_devices, "printer")); - centronics.ack_handler().set(m_pia_io, FUNC(pia6821_device::cb1_w)); - centronics.busy_handler().set(FUNC(to7_io_line_device::write_centronics_busy)); - - output_latch_device ¢_data_out(OUTPUT_LATCH(config, "cent_data_out")); - centronics.set_output_latch(cent_data_out); -} - - -void to7_io_line_device::device_start() -{ - m_rs232->write_dtr(0); -} - -void to7_io_line_device::porta_out(uint8_t data) -{ - int txd = (data >> 0) & 1; - int rts = (data >> 1) & 1; - - LOG_IO(( "%s %f to7_io_porta_out: txd=%i, rts=%i\n", machine().describe_context(), machine().time().as_double(), txd, rts )); - - m_rs232->write_txd(txd); - m_rs232->write_rts(rts); -} - - - -WRITE_LINE_MEMBER(to7_io_line_device::write_rxd ) -{ - m_rxd = state; -} - -WRITE_LINE_MEMBER(to7_io_line_device::write_dsr ) -{ - if (!state) m_last_low = 0; - - m_dsr = state; -} - -WRITE_LINE_MEMBER(to7_io_line_device::write_cts ) -{ - m_pia_io->ca1_w(state); - m_cts = state; -} - -WRITE_LINE_MEMBER(to7_io_line_device::write_centronics_busy ) -{ - if (!state) m_last_low = 1; - - m_centronics_busy = state; -} - - -uint8_t to7_io_line_device::porta_in() -{ - LOG_IO(( "%s %f to7_io_porta_in: select=%i cts=%i, dsr=%i, rd=%i\n", machine().describe_context(), machine().time().as_double(), m_centronics_busy, m_cts, m_dsr, m_rxd )); - - /// HACK: without high impedance we can't tell whether a device is driving a line high or if it's being pulled up. - /// so assume the last device to drive it low is active. - int dsr; - if (m_last_low == 0) - dsr = m_dsr; - else - dsr = !m_centronics_busy; - - return (0x1f /* not required when converted to write_pa */) | (m_cts << 5) | (dsr << 6) | (m_rxd << 7); -} - - - -/* ------------ RF 57-932 RS232 extension ------------ */ - -/* Features: - - SY 6551 ACIA. - - higher transfer rates than the CC 90-232 - - usable on all computer, including TO9 and higher - */ - - - -/* ------------ MD 90-120 MODEM extension (not functional) ------------ */ - -/* Features: - - 6850 ACIA - - 6821 PIA - - asymetric 1200/ 75 bauds (reversable) - - TODO! - */ - - -WRITE_LINE_MEMBER( thomson_state::to7_modem_cb ) -{ - LOG(( "to7_modem_cb: called %i\n", state )); -} - - - -WRITE_LINE_MEMBER( thomson_state::to7_modem_tx_w ) -{ - m_to7_modem_tx = state; -} - - -WRITE_LINE_MEMBER( thomson_state::write_acia_clock ) -{ - m_acia->write_txc(state); - m_acia->write_rxc(state); -} - -void thomson_state::to7_modem_reset() -{ - LOG (( "to7_modem_reset called\n" )); - m_acia->write_rxd(0); - m_to7_modem_tx = 0; - /* pia_reset() is called in machine_reset */ - /* acia_6850 has no reset (?) */ -} - - - -void thomson_state::to7_modem_init() -{ - LOG (( "to7_modem_init: MODEM not implemented!\n" )); - save_item(NAME(m_to7_modem_tx)); -} - - - -/* ------------ dispatch MODEM / speech extension ------------ */ - -uint8_t thomson_state::to7_modem_mea8000_r(offs_t offset) -{ - if ( machine().side_effects_disabled() ) - { - return 0; - } - - if ( m_io_mconfig->read() & 1 ) - { - return m_mea8000->read(offset); - } - else - { - switch (offset) - { - case 0: - case 1: - return m_acia->read(offset & 1); - - default: - return 0; - } - } -} - - - -void thomson_state::to7_modem_mea8000_w(offs_t offset, uint8_t data) -{ - if ( m_io_mconfig->read() & 1 ) - { - m_mea8000->write(offset, data); - } - else - { - switch (offset) - { - case 0: - case 1: - m_acia->write(offset & 1, data); - break; - } - } -} - - - /* ------------ SX 90-018 (model 2) music & game extension ------------ */ /* features: @@ -886,61 +648,6 @@ void thomson_state::to7_game_reset() -/* ------------ MIDI extension ------------ */ - -/* IMPORTANT NOTE: - The following is experimental and not compiled in by default. - It relies on the existence of an hypothetical "character device" API able - to transmit bytes between the MAME driver and the outside world - (using, e.g., character device special files on some UNIX). -*/ - -/* Features an EF 6850 ACIA - - MIDI protocol is a serial asynchronous protocol - Each 8-bit byte is transmitted as: - - 1 start bit - - 8 data bits - - 1 stop bits - 320 us per transmitted byte => 31250 baud - - Emulation is based on the Motorola 6850 documentation, not EF 6850. - - We do not emulate the seral line but pass bytes directly between the - 6850 registers and the MIDI device. -*/ - - -uint8_t thomson_state::to7_midi_r() -{ - if(!machine().side_effects_disabled()) - logerror( "to7_midi_r: not implemented\n" ); - return 0; -} - - - -void thomson_state::to7_midi_w(uint8_t data) -{ - logerror( "to7_midi_w: not implemented\n" ); -} - - - -void thomson_state::to7_midi_reset() -{ - logerror( "to7_midi_reset: not implemented\n" ); -} - - - -void thomson_state::to7_midi_init() -{ - logerror( "to7_midi_init: not implemented\n" ); -} - - - /* ------------ init / reset ------------ */ @@ -952,11 +659,9 @@ MACHINE_RESET_MEMBER( thomson_state, to7 ) /* subsystems */ thom_irq_reset(); to7_game_reset(); - to7_modem_reset(); - to7_midi_reset(); m_extension->rom_map(m_maincpu->space(AS_PROGRAM), 0xe000, 0xe7bf); - m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7d0, 0xe7df); + m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7c0, 0xe7ff); /* video */ thom_set_video_mode( THOM_VMODE_TO770 ); @@ -987,11 +692,9 @@ MACHINE_START_MEMBER( thomson_state, to7 ) /* subsystems */ to7_game_init(); - to7_modem_init(); - to7_midi_init(); m_extension->rom_map(m_maincpu->space(AS_PROGRAM), 0xe000, 0xe7bf); - m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7d0, 0xe7df); + m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7c0, 0xe7ff); /* memory */ m_thom_cart_bank = 0; @@ -1178,11 +881,9 @@ MACHINE_RESET_MEMBER( thomson_state, to770 ) /* subsystems */ thom_irq_reset(); to7_game_reset(); - to7_modem_reset(); - to7_midi_reset(); m_extension->rom_map(m_maincpu->space(AS_PROGRAM), 0xe000, 0xe7bf); - m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7d0, 0xe7df); + m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7c0, 0xe7ff); /* video */ thom_set_video_mode( THOM_VMODE_TO770 ); @@ -1215,11 +916,9 @@ MACHINE_START_MEMBER( thomson_state, to770 ) /* subsystems */ to7_game_init(); - to7_modem_init(); - to7_midi_init(); m_extension->rom_map(m_maincpu->space(AS_PROGRAM), 0xe000, 0xe7bf); - m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7d0, 0xe7df); + m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7c0, 0xe7ff); /* memory */ m_thom_cart_bank = 0; @@ -1561,8 +1260,6 @@ MACHINE_RESET_MEMBER( mo5_state, mo5 ) /* subsystems */ thom_irq_reset(); to7_game_reset(); - to7_modem_reset(); - to7_midi_reset(); mo5_init_timer(); /* video */ @@ -1595,12 +1292,10 @@ MACHINE_START_MEMBER( mo5_state, mo5 ) /* subsystems */ to7_game_init(); - to7_modem_init(); - to7_midi_init(); m_mo5_periodic_timer = timer_alloc(FUNC(mo5_state::mo5_periodic_cb), this); m_extension->rom_map(m_maincpu->space(AS_PROGRAM), 0xa000, 0xa7bf); - m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xa7d0, 0xa7df); + m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xa7c0, 0xa7ff); /* memory */ m_thom_cart_bank = 0; @@ -2504,11 +2199,9 @@ MACHINE_RESET_MEMBER( to9_state, to9 ) thom_irq_reset(); to7_game_reset(); to9_kbd_reset(); - to7_modem_reset(); - to7_midi_reset(); m_extension->rom_map(m_maincpu->space(AS_PROGRAM), 0xe000, 0xe7bf); - m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7d0, 0xe7df); + m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7c0, 0xe7ff); /* video */ thom_set_video_mode( THOM_VMODE_TO9 ); @@ -2543,11 +2236,9 @@ MACHINE_START_MEMBER( to9_state, to9 ) to7_game_init(); to9_kbd_init(); to9_palette_init(); - to7_modem_init(); - to7_midi_init(); m_extension->rom_map(m_maincpu->space(AS_PROGRAM), 0xe000, 0xe7bf); - m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7d0, 0xe7df); + m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7c0, 0xe7ff); /* memory */ m_thom_vram = ram; @@ -2588,7 +2279,7 @@ MACHINE_START_MEMBER( to9_state, to9 ) PIA ports. Note: if we conform to the (scarce) documentation the CPU tend to lock - waitting for keyboard input. + waiting for keyboard input. The protocol documentation is pretty scarce and does not account for these behaviors! The emulation code contains many hacks (delays, timeouts, spurious @@ -3421,8 +3112,6 @@ MACHINE_RESET_MEMBER( to9_state, to8 ) thom_irq_reset(); to7_game_reset(); to8_kbd_reset(); - to7_modem_reset(); - to7_midi_reset(); /* gate-array */ m_to7_lightpen = 0; @@ -3469,11 +3158,9 @@ MACHINE_START_MEMBER( to9_state, to8 ) to7_game_init(); to8_kbd_init(); to9_palette_init(); - to7_modem_init(); - to7_midi_init(); m_extension->rom_map(m_maincpu->space(AS_PROGRAM), 0xe000, 0xe7bf); - m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7d0, 0xe7df); + m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7c0, 0xe7ff); /* memory */ m_thom_cart_bank = 0; @@ -3570,8 +3257,6 @@ MACHINE_RESET_MEMBER( to9_state, to9p ) thom_irq_reset(); to7_game_reset(); to9_kbd_reset(); - to7_modem_reset(); - to7_midi_reset(); /* gate-array */ m_to7_lightpen = 0; @@ -3617,11 +3302,9 @@ MACHINE_START_MEMBER( to9_state, to9p ) to7_game_init(); to9_kbd_init(); to9_palette_init(); - to7_modem_init(); - to7_midi_init(); m_extension->rom_map(m_maincpu->space(AS_PROGRAM), 0xe000, 0xe7bf); - m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7d0, 0xe7df); + m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xe7c0, 0xe7ff); /* memory */ m_thom_cart_bank = 0; @@ -4257,8 +3940,6 @@ MACHINE_RESET_MEMBER( mo6_state, mo6 ) /* subsystems */ thom_irq_reset(); mo6_game_reset(); - to7_modem_reset(); - to7_midi_reset(); mo5_init_timer(); /* gate-array */ @@ -4301,12 +3982,10 @@ MACHINE_START_MEMBER( mo6_state, mo6 ) /* subsystems */ mo6_game_init(); to9_palette_init(); - to7_modem_init(); - to7_midi_init(); m_mo5_periodic_timer = timer_alloc(FUNC(mo6_state::mo5_periodic_cb), this); m_extension->rom_map(m_maincpu->space(AS_PROGRAM), 0xa000, 0xa7bf); - m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xa7d0, 0xa7df); + m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xa7c0, 0xa7ff); /* memory */ m_thom_cart_bank = 0; @@ -4360,31 +4039,6 @@ MACHINE_START_MEMBER( mo6_state, mo6 ) -/* ------------ printer ------------ */ - -/* Unlike the TO8, TO9, TO9+, MO6, the printer has its own ports and does not - go through the 6821 PIA. -*/ - - -uint8_t mo5nr_state::mo5nr_prn_r() -{ - uint8_t result = 0; - - result |= m_centronics_busy << 7; - - return result; -} - - -void mo5nr_state::mo5nr_prn_w(uint8_t data) -{ - /* TODO: understand other bits */ - m_centronics->write_strobe(BIT(data, 3)); -} - - - /* ------------ system PIA 6821 ------------ */ @@ -4459,8 +4113,6 @@ MACHINE_RESET_MEMBER( mo5nr_state, mo5nr ) /* subsystems */ thom_irq_reset(); mo5nr_game_reset(); - to7_modem_reset(); - to7_midi_reset(); mo5_init_timer(); /* gate-array */ @@ -4503,14 +4155,12 @@ MACHINE_START_MEMBER( mo5nr_state, mo5nr ) /* subsystems */ mo5nr_game_init(); to9_palette_init(); - to7_modem_init(); - to7_midi_init(); m_mo5_periodic_timer = timer_alloc(FUNC(mo5nr_state::mo5_periodic_cb), this); m_extension->rom_map(m_extension_view[0], 0xa000, 0xa7bf); - m_extension->io_map (m_extension_view[0], 0xa7d0, 0xa7df); + m_extension->io_map (m_extension_view[0], 0xa7c0, 0xa7ff); m_extension_view[1].install_device(0xa000, 0xa7bf, *m_nanoreseau, &nanoreseau_device::rom_map ); - m_extension_view[1].install_device(0xa7d0, 0xa7df, *m_nanoreseau, &nanoreseau_device::io_map ); + m_extension_view[1].install_device(0xa7c0, 0xa7ff, *m_nanoreseau, &nanoreseau_device::io_map ); /* memory */ m_thom_cart_bank = 0; diff --git a/src/mame/thomson/thomson_v.cpp b/src/mame/thomson/thomson_v.cpp index b385282ce27..8911557db69 100644 --- a/src/mame/thomson/thomson_v.cpp +++ b/src/mame/thomson/thomson_v.cpp @@ -27,6 +27,12 @@ #define THOM_GPL_PER_LINE 40 +/* maximum number of video pages: + 1 for TO7 generation (including MO5) + 4 for TO8 generation (including TO9, MO6) + */ +#define THOM_NB_PAGES 4 + /****************** dynamic screen size *****************/ -- cgit v1.2.3