From f27ee36f13f62165b7a23026d8728a2c71e09cf3 Mon Sep 17 00:00:00 2001 From: Joakim Larsson Edstrom Date: Tue, 11 Jul 2017 00:31:18 +0200 Subject: mc14411: new methods added for disabling all output timers and set line methods for RSA and RSB inputs --- src/devices/machine/mc14411.cpp | 40 +++++++++++++++++++++++++++++++++++++++- src/devices/machine/mc14411.h | 3 +++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/devices/machine/mc14411.cpp b/src/devices/machine/mc14411.cpp index c70041e1c6b..726964370ca 100644 --- a/src/devices/machine/mc14411.cpp +++ b/src/devices/machine/mc14411.cpp @@ -58,7 +58,7 @@ ***************************************************************************/ const int mc14411_device::s_counter_divider[16] = { - ////////// X64 /////// X16 /////// X4 //////// X1 //////// + ////////// X64 /////// X16 /////// X8 //////// X1 //////// 3, // F1: 614.4 kHz 153.6 kHz 76800 Hz 9600 Hz 4, // F2: 460.8 kHz 115.2 kHz 57600 Hz 7200 Hz 6, // F3: 307.2 kHz 76800 Hz 36400 Hz 4800 Hz @@ -164,6 +164,11 @@ void mc14411_device::timer_enable(timer_id i, bool enable) arm_timer(i); } +void mc14411_device::timer_disable_all() +{ + for (int i = TIMER_F1; i <= TIMER_F16; i++) + timer_enable((timer_id) i, false); +} //------------------------------------------------- // arm_timer - arm the timer based on selected @@ -207,6 +212,7 @@ void mc14411_device::device_reset() } } + //------------------------------------------------- // device_timer - handler timer events //------------------------------------------------- @@ -252,6 +258,38 @@ WRITE8_MEMBER(mc14411_device::rate_select_w) } +//------------------------------------------------ +// rsa_w - set RSA input line +//------------------------------------------------ + +WRITE_LINE_MEMBER(mc14411_device::rsa_w) +{ + LOGSETUP("%s %02x\n", FUNCNAME, state); + + if ((m_divider & RSA) != (state == ASSERT_LINE ? RSA : 0)) + { + m_divider = (m_divider & ~RSA) | (state == ASSERT_LINE ? RSA : 0); + notify_clock_changed(); + } +} + + +//------------------------------------------------ +// rsb_w - set RSB input line +//------------------------------------------------ + +WRITE_LINE_MEMBER(mc14411_device::rsb_w) +{ + LOGSETUP("%s %02x\n", FUNCNAME, state); + + if ((m_divider & RSB) != (state == ASSERT_LINE ? RSB : 0)) + { + m_divider = (m_divider & ~RSB) | (state == ASSERT_LINE ? RSB : 0); + notify_clock_changed(); + } +} + + //------------------------------------------------ // reset_w - software controlled reset //------------------------------------------------ diff --git a/src/devices/machine/mc14411.h b/src/devices/machine/mc14411.h index 95d0639adae..4130fa746c9 100644 --- a/src/devices/machine/mc14411.h +++ b/src/devices/machine/mc14411.h @@ -92,8 +92,11 @@ public: DECLARE_WRITE_LINE_MEMBER(reset_w); DECLARE_WRITE8_MEMBER(rate_select_w); + DECLARE_WRITE_LINE_MEMBER(rsa_w); + DECLARE_WRITE_LINE_MEMBER(rsb_w); void timer_enable(timer_id i, bool enable); + void timer_disable_all(); protected: mc14411_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); -- cgit v1.2.3 From 9423f5612619e1f8122f2b7efdd803ea71e40dc7 Mon Sep 17 00:00:00 2001 From: Joakim Larsson Edstrom Date: Tue, 11 Jul 2017 00:31:43 +0200 Subject: fccpu1: Added machine configuration for baud rates for all three serial ports using the mc14411 device --- src/mame/drivers/force68k.cpp | 167 ++++++++++++++++++++++++++++++------------ 1 file changed, 119 insertions(+), 48 deletions(-) diff --git a/src/mame/drivers/force68k.cpp b/src/mame/drivers/force68k.cpp index 70ea59fda45..0f776ad52ea 100644 --- a/src/mame/drivers/force68k.cpp +++ b/src/mame/drivers/force68k.cpp @@ -92,15 +92,14 @@ #include "bus/vme/vme_fcscsi.h" /* - * The baudrate on the Force68k CPU-1 to CPU-6 is generated by a - * Motorola 14411 bitrate generator, the CPU-6 documents matches the circuits - * that I could find on the CPU-1 board. Here how I calculated the clock for - * the factory settings. No need to add selectors until terminal.c supports - * configurable baudrates. Fortunality CPU-1 was shipped with 9600N8! + * The baudrate on the Force68k CPU-1 to CPU-6 is generated by a Motorola 14411 bitrate generator + * The CPU-6 documents matches the circuits that I could find on the CPU-1 board. * * From the documents: * - * 3 RS232C interfaces, strap selectable baud rate from 110-9600 or 600-19200 baud + * 3 RS232C interfaces, strap selectable baud rate from 110-9600 or 600-19200 baud (CPU-1B datasheet) + * or + * 3 RS232C interfaces, strap selectable baud rate from 60-9600 or 240-38400 baud (CPU-6 Users manual) * * Default Jumper Settings of B7: * -------------------------------- @@ -120,6 +119,8 @@ * However, the datasheet says baudrate is strapable for 110-9600 but the output is 153600 * so the system rom MUST setup the acia to divide by 16 to generate the correct baudrate. * + * There are multiple ways to achieve some of the baud rates and we have only seen a CPU-6 users manual so + * emulation mimics a CPU-6 board at the moment until further information has been gathered. */ //************************************************************************** @@ -145,9 +146,6 @@ #define FUNCNAME __PRETTY_FUNCTION__ #endif -#define BAUDGEN_CLOCK XTAL_1_8432MHz -#define ACIA_CLOCK (BAUDGEN_CLOCK / 12) - class force68k_state : public driver_device { public: @@ -165,6 +163,10 @@ public: , m_centronics_busy(0) , m_centronics_perror(0) , m_centronics_select(0) + , m_serial_brf(*this, "SERIAL_BRF") + , m_serial_p3(*this, "SERIAL_P3") + , m_serial_p4(*this, "SERIAL_P4") + , m_serial_p5(*this, "SERIAL_P5") , m_cart(*this, "exp_rom1") { } @@ -175,16 +177,26 @@ public: DECLARE_READ16_MEMBER (vme_a16_r); DECLARE_WRITE16_MEMBER (vme_a16_w); virtual void machine_start () override; - // clocks - DECLARE_WRITE_LINE_MEMBER (write_acia_clock); - DECLARE_WRITE_LINE_MEMBER (write_aciahost_clock); - DECLARE_WRITE_LINE_MEMBER (write_aciaterm_clock); - DECLARE_WRITE_LINE_MEMBER (write_aciaremt_clock); - // centronics printer interface + virtual void machine_reset () override; + + // Clocks + void write_acia_clocks(int id, int state); + DECLARE_WRITE_LINE_MEMBER (write_f1_clock){ write_acia_clocks(mc14411_device::TIMER_F1, state); } + DECLARE_WRITE_LINE_MEMBER (write_f3_clock){ write_acia_clocks(mc14411_device::TIMER_F3, state); } + DECLARE_WRITE_LINE_MEMBER (write_f5_clock){ write_acia_clocks(mc14411_device::TIMER_F5, state); } + DECLARE_WRITE_LINE_MEMBER (write_f7_clock){ write_acia_clocks(mc14411_device::TIMER_F7, state); } + DECLARE_WRITE_LINE_MEMBER (write_f8_clock){ write_acia_clocks(mc14411_device::TIMER_F8, state); } + DECLARE_WRITE_LINE_MEMBER (write_f9_clock){ write_acia_clocks(mc14411_device::TIMER_F9, state); } + DECLARE_WRITE_LINE_MEMBER (write_f11_clock){ write_acia_clocks(mc14411_device::TIMER_F11, state); } + DECLARE_WRITE_LINE_MEMBER (write_f13_clock){ write_acia_clocks(mc14411_device::TIMER_F13, state); } + DECLARE_WRITE_LINE_MEMBER (write_f15_clock){ write_acia_clocks(mc14411_device::TIMER_F15, state); } + + // Centronics printer interface DECLARE_WRITE_LINE_MEMBER (centronics_ack_w); DECLARE_WRITE_LINE_MEMBER (centronics_busy_w); DECLARE_WRITE_LINE_MEMBER (centronics_perror_w); DECLARE_WRITE_LINE_MEMBER (centronics_select_w); + // User EPROM/SRAM slot(s) image_init_result force68k_load_cart(device_image_interface &image, generic_slot_device *slot); DECLARE_DEVICE_IMAGE_LOAD_MEMBER (exp1_load) { return force68k_load_cart(image, m_cart); } @@ -205,6 +217,12 @@ private: int32_t m_centronics_perror; int32_t m_centronics_select; + // fake inputs for hardware configuration and things that need rewiring + required_ioport m_serial_brf; + required_ioport m_serial_p3; + required_ioport m_serial_p4; + required_ioport m_serial_p5; + // Pointer to System ROMs needed by bootvect_r uint16_t *m_sysrom; uint16_t *m_usrrom; @@ -235,6 +253,48 @@ ADDRESS_MAP_END /* Input ports */ static INPUT_PORTS_START (force68k) + + PORT_START("SERIAL_BRF") + PORT_CONFNAME(0x80 , 0x00 , "Baud Rate Factor") // RSA pin on MC14411 + PORT_CONFSETTING(0x00, "1x (Lo)") + PORT_CONFSETTING(0x80, "4x (Hi)") + + PORT_START("SERIAL_P3") + PORT_CONFNAME(0x0F , 0x00 , "P3 Host Baud Lo/Hi") // F1-Fx pins on MC14411 + PORT_CONFSETTING(mc14411_device::TIMER_F1, "9600/38400") // RSA=1x/16x + PORT_CONFSETTING(mc14411_device::TIMER_F3, "4800/19200") + PORT_CONFSETTING(mc14411_device::TIMER_F5, "2400/9600") + PORT_CONFSETTING(mc14411_device::TIMER_F7, "1200/4800") + PORT_CONFSETTING(mc14411_device::TIMER_F8, "600/2400") + PORT_CONFSETTING(mc14411_device::TIMER_F9, "300/1200") + PORT_CONFSETTING(mc14411_device::TIMER_F11, "150/600") + PORT_CONFSETTING(mc14411_device::TIMER_F13, "110/440") + PORT_CONFSETTING(mc14411_device::TIMER_F15, "60/240") + + PORT_START("SERIAL_P4") + PORT_CONFNAME(0x0F , 0x00 , "P4 Terminal Baud Lo/Hi") // F1-Fx pins on MC14411 + PORT_CONFSETTING(mc14411_device::TIMER_F1, "9600/38400") // RSA=1x/16x + PORT_CONFSETTING(mc14411_device::TIMER_F3, "4800/19200") + PORT_CONFSETTING(mc14411_device::TIMER_F5, "2400/9600") + PORT_CONFSETTING(mc14411_device::TIMER_F7, "1200/4800") + PORT_CONFSETTING(mc14411_device::TIMER_F8, "600/2400") + PORT_CONFSETTING(mc14411_device::TIMER_F9, "300/1200") + PORT_CONFSETTING(mc14411_device::TIMER_F11, "150/600") + PORT_CONFSETTING(mc14411_device::TIMER_F13, "110/440") + PORT_CONFSETTING(mc14411_device::TIMER_F15, "60/240") + + PORT_START("SERIAL_P5") + PORT_CONFNAME(0x0F , 0x00 , "P5 Remote Baud Lo/Hi") // F1-Fx pins on MC14411 + PORT_CONFSETTING(mc14411_device::TIMER_F1, "9600/38400") // RSA=1x/16x + PORT_CONFSETTING(mc14411_device::TIMER_F3, "4800/19200") + PORT_CONFSETTING(mc14411_device::TIMER_F5, "2400/9600") + PORT_CONFSETTING(mc14411_device::TIMER_F7, "1200/4800") + PORT_CONFSETTING(mc14411_device::TIMER_F8, "600/2400") + PORT_CONFSETTING(mc14411_device::TIMER_F9, "300/1200") + PORT_CONFSETTING(mc14411_device::TIMER_F11, "150/600") + PORT_CONFSETTING(mc14411_device::TIMER_F13, "110/440") + PORT_CONFSETTING(mc14411_device::TIMER_F15, "60/240") + INPUT_PORTS_END /* @@ -332,9 +392,22 @@ void force68k_state::machine_start () m_maincpu->space(AS_PROGRAM).install_read_handler(0xa0000, 0xbffff, read16_delegate(FUNC(force68k_state::read16_rom), this)); #endif } +} - // Set up the BRG divider. TODO: Make RSA a selectable DIP switch RSB is always set High - m_brg->rate_select_w( m_maincpu->space(AS_PROGRAM), 0, mc14411_device::RSB, 0xff); +/* Reset it */ +void force68k_state::machine_reset () +{ + LOG("%s\n", FUNCNAME); + + // Set up the BRG divider. RSA is a jumper setting and RSB is always set High + m_brg->rsa_w( m_serial_brf->read() == 0x80 ? ASSERT_LINE : CLEAR_LINE ); + m_brg->rsb_w( ASSERT_LINE); + + // Disable all configured timers, only enabling the used ones + m_brg->timer_disable_all(); + m_brg->timer_enable((mc14411_device::timer_id) m_serial_p3->read(), true); + m_brg->timer_enable((mc14411_device::timer_id) m_serial_p4->read(), true); + m_brg->timer_enable((mc14411_device::timer_id) m_serial_p5->read(), true); } /* A very ineffecient User cart emulation of two 8 bit sockets (odd and even) */ @@ -386,27 +459,25 @@ WRITE16_MEMBER (force68k_state::vme_a16_w){ } /* - * Serial port clock sources can all be driven by different outputs of the 14411 - * TODO: Add DIP switches so bitrate can be selected individually for all three ports + * Serial port clock sources can all be driven by different or the same output(s) of the MC14411 */ -WRITE_LINE_MEMBER (force68k_state::write_acia_clock){ - write_aciahost_clock(state); - write_aciaterm_clock(state); - write_aciaremt_clock(state); -} - -WRITE_LINE_MEMBER (force68k_state::write_aciahost_clock){ - m_aciahost->write_txc (state); - m_aciahost->write_rxc (state); -} -WRITE_LINE_MEMBER (force68k_state::write_aciaterm_clock){ - m_aciaterm->write_txc (state); - m_aciaterm->write_rxc (state); -} - -WRITE_LINE_MEMBER (force68k_state::write_aciaremt_clock){ - m_aciaremt->write_txc (state); - m_aciaremt->write_rxc (state); +void force68k_state::write_acia_clocks(int id, int state) +{ + if (id == m_serial_p3->read()) + { + m_aciahost->write_txc(state); + m_aciahost->write_rxc(state); + } + if (id == m_serial_p4->read()) + { + m_aciaterm->write_txc(state); + m_aciaterm->write_rxc(state); + } + if (id == m_serial_p5->read()) + { + m_aciaremt->write_txc(state); + m_aciaremt->write_rxc(state); + } } /* @@ -484,9 +555,6 @@ static MACHINE_CONFIG_START (fccpu1) MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("aciahost", acia6850_device, write_rxd)) MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("aciahost", acia6850_device, write_cts)) -// MCFG_DEVICE_ADD ("aciahost_clock", CLOCK, ACIA_CLOCK) -// MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (force68k_state, write_aciahost_clock)) - /* P4/Terminal Port config */ MCFG_DEVICE_ADD ("aciaterm", ACIA6850, 0) @@ -497,17 +565,20 @@ static MACHINE_CONFIG_START (fccpu1) MCFG_RS232_RXD_HANDLER (DEVWRITELINE ("aciaterm", acia6850_device, write_rxd)) MCFG_RS232_CTS_HANDLER (DEVWRITELINE ("aciaterm", acia6850_device, write_cts)) -// MCFG_DEVICE_ADD ("aciaterm_clock", CLOCK, ACIA_CLOCK) -// MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (force68k_state, write_aciaterm_clock)) - /* P5/Remote Port config */ MCFG_DEVICE_ADD ("aciaremt", ACIA6850, 0) -// MCFG_DEVICE_ADD ("aciaremt_clock", CLOCK, ACIA_CLOCK) -// MCFG_CLOCK_SIGNAL_HANDLER (WRITELINE (force68k_state, write_aciaremt_clock)) - + /* Bit Rate Generator */ MCFG_MC14411_ADD ("brg", XTAL_1_8432MHz) - MCFG_MC14411_F1_CB(WRITELINE (force68k_state, write_acia_clock)) + MCFG_MC14411_F1_CB(WRITELINE (force68k_state, write_f1_clock)) + MCFG_MC14411_F3_CB(WRITELINE (force68k_state, write_f3_clock)) + MCFG_MC14411_F5_CB(WRITELINE (force68k_state, write_f5_clock)) + MCFG_MC14411_F7_CB(WRITELINE (force68k_state, write_f7_clock)) + MCFG_MC14411_F8_CB(WRITELINE (force68k_state, write_f8_clock)) + MCFG_MC14411_F9_CB(WRITELINE (force68k_state, write_f9_clock)) + MCFG_MC14411_F11_CB(WRITELINE (force68k_state, write_f11_clock)) + MCFG_MC14411_F13_CB(WRITELINE (force68k_state, write_f13_clock)) + MCFG_MC14411_F15_CB(WRITELINE (force68k_state, write_f15_clock)) /* RTC Real Time Clock device */ MCFG_DEVICE_ADD ("rtc", MM58167, XTAL_32_768kHz) @@ -517,7 +588,7 @@ static MACHINE_CONFIG_START (fccpu1) MCFG_PIT68230_PA_OUTPUT_CB (DEVWRITE8 ("cent_data_out", output_latch_device, write)) MCFG_PIT68230_H2_CB (DEVWRITELINE ("centronics", centronics_device, write_strobe)) - // centronics + // Centronics MCFG_CENTRONICS_ADD ("centronics", centronics_devices, "printer") MCFG_CENTRONICS_ACK_HANDLER (WRITELINE (force68k_state, centronics_ack_w)) MCFG_CENTRONICS_BUSY_HANDLER (WRITELINE (force68k_state, centronics_busy_w)) -- cgit v1.2.3