diff --git a/src/mame/drivers/cd2650.cpp b/src/mame/drivers/cd2650.cpp index 38c84b29046..2744717902a 100644 --- a/src/mame/drivers/cd2650.cpp +++ b/src/mame/drivers/cd2650.cpp @@ -28,19 +28,19 @@ scratch ram. All other ram is optional. Commands (must be in uppercase): A Examine memory; press C to alter memory -B Set breakpoint? -C View breakpoint? -D Dump to tape +B Set breakpoint +C Clear unused breakpoint +D Dump to cassette (must save each block separately, then an empty block) E Execute -I ? -L Load -R ? -V Verify? +I Inspect Registers after breakpoint +L Load from cassette +R Turn on cassette motor +V Verify cassette vs memory Press Esc to exit most commands. TODO -- Lots, probably. The computer is a complete mystery. No manuals are known to exist. -- Cassette doesn't work. +- Cassette doesn't work. Saving is ok because the data can be loaded onto + the Super-80, but this system has great difficulty loading its own programs. ****************************************************************************/ @@ -55,6 +55,7 @@ TODO #include "imagedev/snapquik.h" #include "machine/74259.h" #include "machine/keyboard.h" +#include "machine/timer.h" #include "sound/beep.h" #include "sound/wave.h" #include "emupal.h" @@ -70,23 +71,27 @@ public: , m_p_videoram(*this, "videoram") , m_p_chargen(*this, "chargen") , m_cass(*this, "cassette") - { - } + { } + void cd2650(machine_config &config); + +private: + void cd2650_data(address_map &map); + void cd2650_io(address_map &map); + void cd2650_mem(address_map &map); DECLARE_READ8_MEMBER(keyin_r); void kbd_put(u8 data); DECLARE_WRITE_LINE_MEMBER(tape_deck_on_w); DECLARE_READ_LINE_MEMBER(cass_r); DECLARE_WRITE_LINE_MEMBER(cass_w); + TIMER_DEVICE_CALLBACK_MEMBER(kansas_w); + TIMER_DEVICE_CALLBACK_MEMBER(kansas_r); DECLARE_QUICKLOAD_LOAD_MEMBER(cd2650); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - void cd2650(machine_config &config); - void cd2650_data(address_map &map); - void cd2650_io(address_map &map); - void cd2650_mem(address_map &map); -private: uint8_t m_term_data; + bool m_flag; + bool m_cassold; + uint8_t m_cass_data[4]; virtual void machine_reset() override; required_device m_maincpu; required_shared_ptr m_p_videoram; @@ -95,20 +100,49 @@ private: }; +TIMER_DEVICE_CALLBACK_MEMBER(cd2650_state::kansas_w) +{ + m_cass_data[3]++; + + if (m_flag != m_cassold) + { + m_cass_data[3] = 0; + m_cassold = m_flag; + } + + if (m_flag) + m_cass->output(BIT(m_cass_data[3], 0) ? -1.0 : +1.0); // 2400Hz + else + m_cass->output(BIT(m_cass_data[3], 1) ? -1.0 : +1.0); // 1200Hz +} + +TIMER_DEVICE_CALLBACK_MEMBER(cd2650_state::kansas_r) +{ + /* cassette - turn 1200/2400Hz to a bit */ + m_cass_data[1]++; + uint8_t cass_ws = (m_cass->input() > +0.03) ? 1 : 0; + + if (cass_ws != m_cass_data[0]) + { + m_cass_data[0] = cass_ws; + m_cass_data[2] = ((m_cass_data[1] < 12) ? 1 : 0); + m_cass_data[1] = 0; + } +} + WRITE_LINE_MEMBER(cd2650_state::tape_deck_on_w) { - // output polarity not verified - logerror("Cassette tape deck turned %s\n", state ? "on" : "off"); + m_cass->change_state(state ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, CASSETTE_MASK_MOTOR); } WRITE_LINE_MEMBER(cd2650_state::cass_w) { - m_cass->output(state ? -1.0 : +1.0); + m_flag = state; } READ_LINE_MEMBER(cd2650_state::cass_r) { - return (m_cass->input() > 0.03) ? 1 : 0; + return m_cass_data[2]; } READ8_MEMBER(cd2650_state::keyin_r) @@ -319,13 +353,16 @@ void cd2650_state::cd2650(machine_config &config) /* Sound */ SPEAKER(config, "mono").front_center(); - WAVE(config, "wave", m_cass).add_route(ALL_OUTPUTS, "mono", 0.25); + WAVE(config, "wave", m_cass).add_route(ALL_OUTPUTS, "mono", 0.15); BEEP(config, "beeper", 950).add_route(ALL_OUTPUTS, "mono", 0.50); // guess /* Devices */ generic_keyboard_device &keyboard(GENERIC_KEYBOARD(config, "keyboard", 0)); keyboard.set_keyboard_callback(FUNC(cd2650_state::kbd_put)); CASSETTE(config, m_cass); + m_cass->set_default_state(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED); + TIMER(config, "kansas_w").configure_periodic(FUNC(cd2650_state::kansas_w), attotime::from_hz(4800)); + TIMER(config, "kansas_r").configure_periodic(FUNC(cd2650_state::kansas_r), attotime::from_hz(40000)); } /* ROM definition */