From 82404081d6447ac0895a4fd0e83c6af7734acc0e Mon Sep 17 00:00:00 2001 From: Robbbert Date: Wed, 17 Jul 2019 21:43:26 +1000 Subject: (nw) pipbug: added cassette load facility for the existing software. --- src/mame/drivers/pipbug.cpp | 113 ++++++++++++++++++++++++++++++++------------ 1 file changed, 82 insertions(+), 31 deletions(-) diff --git a/src/mame/drivers/pipbug.cpp b/src/mame/drivers/pipbug.cpp index 510c367f760..57d63a6350b 100644 --- a/src/mame/drivers/pipbug.cpp +++ b/src/mame/drivers/pipbug.cpp @@ -2,67 +2,81 @@ // copyright-holders:Robbbert /*************************************************************************** - PIPBUG +PIPBUG - 08/04/2010 Skeleton driver. - 16/05/2012 Connected to serial terminal.. working +2010-04-08 Skeleton driver. +2012-05-16 Connected to serial terminal.. working +2019-07-17 Added cassette onto L command - All input must be in uppercase. +All input must be in UPPER case. - Commands: - A - See and alter memory - B - Set breakpoint (2 permitted) - C - Clear breakpoint - D - Dump memory to paper tape - G - Go to address, run - L - Load memory from paper tape - S - See and alter registers +Commands: +A - See and alter memory +B - Set breakpoint (2 permitted) +C - Clear breakpoint +D - Dump memory to paper tape +G - Go to address, run +L - Load memory from paper tape +S - See and alter registers - PIPBUG isn't a computer; it is a the name of the bios used - in a number of small 2650-based computers from 1976 to 1978. - Examples include Baby 2650, Eurocard 2650, etc., plus Signetics - own PC1001, PC1500, and KT9500 systems. PIPBUG was written by Signetics. +PIPBUG isn't a computer; it is a the name of the bios used +in a number of small 2650-based computers from 1976 to 1978. +Examples include Baby 2650, Eurocard 2650, etc., plus Signetics +own PC1001, PC1500, and KT9500 systems. PIPBUG was written by Signetics. - The sole means of communication is via a serial terminal. - PIPBUG uses the SENSE and FLAG pins as serial lines, thus - there is no need for a UART. The baud rate is 110. +The sole means of communication is via a serial terminal. +PIPBUG uses the SENSE and FLAG pins as serial lines, thus +there is no need for a UART. The baud rate is 110. - The Baby 2650 (featured in Electronics Australia magazine in - March 1977) has 256 bytes of RAM. +The Baby 2650 (featured in Electronics Australia magazine in +March 1977) has 256 bytes of RAM. - The terminal is expected to have a papertape device attached, and - use it to save and load programs. PIPBUG still thinks it is talking - to the terminal, when in fact the data is flowing to the papertape - reader and punch. +The terminal is expected to have a papertape device attached, and +use it to save and load programs. PIPBUG still thinks it is talking +to the terminal, when in fact the data is flowing to the papertape +reader and punch. + +Cassette: +There is software available at 110 baud, using 1200/2400 Hz. This has +been hooked up to the otherwise-useless L command. Baud rate = 110. +After load completes, G440 to run. ****************************************************************************/ #include "emu.h" #include "bus/rs232/rs232.h" #include "cpu/s2650/s2650.h" +#include "imagedev/cassette.h" #include "machine/terminal.h" #include "imagedev/snapquik.h" +#include "machine/timer.h" +#include "speaker.h" class pipbug_state : public driver_device { public: pipbug_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_rs232(*this, "rs232"), - m_maincpu(*this, "maincpu") - { - } + : driver_device(mconfig, type, tag) + , m_rs232(*this, "rs232") + , m_maincpu(*this, "maincpu") + , m_cass(*this, "cassette") + { } void pipbug(machine_config &config); private: DECLARE_WRITE8_MEMBER(pipbug_ctrl_w); + DECLARE_READ_LINE_MEMBER(serial_r); + TIMER_DEVICE_CALLBACK_MEMBER(kansas_r); required_device m_rs232; required_device m_maincpu; + required_device m_cass; DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb); void pipbug_data(address_map &map); void pipbug_mem(address_map &map); + u8 m_cass_data[4]; + bool m_cassold, m_cassinbit; }; WRITE8_MEMBER( pipbug_state::pipbug_ctrl_w ) @@ -70,6 +84,35 @@ WRITE8_MEMBER( pipbug_state::pipbug_ctrl_w ) // 0x80 is written here - not connected in the baby 2650 } +TIMER_DEVICE_CALLBACK_MEMBER( pipbug_state::kansas_r ) +{ + // no tape - set to idle + m_cass_data[1]++; + if (m_cass_data[1] > 32) + { + m_cass_data[1] = 32; + m_cassinbit = 1; + } + + if ((m_cass->get_state() & CASSETTE_MASK_UISTATE) != CASSETTE_PLAY) + return; + + /* cassette - turn 1200/2400Hz to a bit */ + bool cass_ws = (m_cass->input() > +0.04) ? 1 : 0; + + if (cass_ws != m_cassold) + { + m_cassold = cass_ws; + m_cassinbit = (m_cass_data[1] < 12) ? 1 : 0; + m_cass_data[1] = 0; + } +} + +READ_LINE_MEMBER( pipbug_state::serial_r ) +{ + return m_rs232->rxd_r() & m_cassinbit; +} + void pipbug_state::pipbug_mem(address_map &map) { map.unmap_value_high(); @@ -167,14 +210,22 @@ void pipbug_state::pipbug(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &pipbug_state::pipbug_mem); m_maincpu->set_addrmap(AS_DATA, &pipbug_state::pipbug_data); m_maincpu->flag_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + m_maincpu->sense_handler().set(FUNC(pipbug_state::serial_r)); /* video hardware */ RS232_PORT(config, m_rs232, default_rs232_devices, "terminal"); - m_rs232->rxd_handler().set_inputline(m_maincpu, S2650_SENSE_LINE); m_rs232->set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal)); /* quickload */ QUICKLOAD(config, "quickload", "pgm", attotime::from_seconds(1)).set_load_callback(FUNC(pipbug_state::quickload_cb), this); + + SPEAKER(config, "mono").front_center(); + + /* Cassette */ + CASSETTE(config, m_cass); + m_cass->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED); + m_cass->add_route(ALL_OUTPUTS, "mono", 0.05); + TIMER(config, "kansas_r").configure_periodic(FUNC(pipbug_state::kansas_r), attotime::from_hz(40000)); } -- cgit v1.2.3