summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2019-07-08 02:54:29 +1000
committer Robbbert <Robbbert@users.noreply.github.com>2019-07-08 02:54:29 +1000
commit88a3b1c96b04ba9093d4dda12bff3edfdc9c805d (patch)
treec1ccb8b32a929346e4338f4fd42846c61053ddf7
parentaf1155ef0b65ded33270407a4ae63387922a0ed6 (diff)
(nw) proteus3 : cassette interface fixed
-rw-r--r--src/mame/drivers/proteus3.cpp66
1 files changed, 37 insertions, 29 deletions
diff --git a/src/mame/drivers/proteus3.cpp b/src/mame/drivers/proteus3.cpp
index ad8dfb096c6..cf6d73b2401 100644
--- a/src/mame/drivers/proteus3.cpp
+++ b/src/mame/drivers/proteus3.cpp
@@ -34,7 +34,6 @@
same company.
To Do:
- - Cassette (coded but too unreliable to be considered working)
- Add support for k7 cassette files.
- Need software
- Need missing PROM, so that all the CRTC controls can be emulated
@@ -113,9 +112,7 @@ private:
uint8_t m_flashcnt;
uint16_t m_curs_pos;
uint8_t m_cass_data[4];
- bool m_cassbit;
- bool m_cassold;
- uint8_t m_clockcnt;
+ bool m_cassbit, m_cassold, m_cassinbit;
virtual void machine_reset() override;
required_device<cpu_device> m_maincpu;
required_region_ptr<u8> m_p_videoram;
@@ -169,8 +166,8 @@ static INPUT_PORTS_START(proteus3)
PORT_CONFSETTING(mc14411_device::TIMER_F12, "2153.3")
PORT_CONFSETTING(mc14411_device::TIMER_F13, "1758.8")
PORT_CONFSETTING(mc14411_device::TIMER_F14, "1200")
- PORT_CONFSETTING(mc14411_device::TIMER_F15, "921.6")
- PORT_CONFSETTING(mc14411_device::TIMER_F16, "1.8432")
+ PORT_CONFSETTING(mc14411_device::TIMER_F15, "921600")
+ PORT_CONFSETTING(mc14411_device::TIMER_F16, "1843200")
INPUT_PORTS_END
void proteus3_state::kbd_put(u8 data)
@@ -198,42 +195,54 @@ void proteus3_state::write_acia_clocks(int id, int state)
/******************************************************************************
Cassette
******************************************************************************/
-TIMER_DEVICE_CALLBACK_MEMBER( proteus3_state::kansas_w )
-{
- m_cass_data[3]++;
- if (m_cassbit != m_cassold)
+TIMER_DEVICE_CALLBACK_MEMBER( proteus3_state::kansas_r )
+{
+ // no tape - set uart to idle
+ m_cass_data[1]++;
+ if (m_cass_data[1] > 32)
{
- m_cass_data[3] = 0;
- m_cassold = m_cassbit;
+ m_cass_data[1] = 32;
+ m_cassinbit = 1;
}
- if (m_cassbit)
- 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( proteus3_state::kansas_r )
-{
/* cassette - turn 1200/2400Hz to a bit */
- m_cass_data[1]++;
- uint8_t cass_ws = (m_cass->input() > +0.01) ? 1 : 0;
+ uint8_t cass_ws = (m_cass->input() > +0.04) ? 1 : 0;
if (cass_ws != m_cass_data[0])
{
m_cass_data[0] = cass_ws;
- m_acia1->write_rxd((m_cass_data[1] < 12) ? 1 : 0);
+ m_cassinbit = (m_cass_data[1] < 12) ? 1 : 0;
m_cass_data[1] = 0;
}
}
WRITE_LINE_MEMBER( proteus3_state::acia1_clock_w )
{
- m_clockcnt++;
- m_acia1->write_txc(BIT(m_clockcnt, 0)); // divide by 16 selected in the acia
- if ((m_clockcnt & 0x0f) == 0x04)
- m_acia1->write_rxc(BIT(m_clockcnt, 4)); // divide by 1 selected
+ // Save - 8N2 - /16 - 600baud
+ // Load - 8N2 - /1
+ u8 twobit = m_cass_data[3] & 15;
+ // incoming @9600Hz
+ if (state)
+ {
+ if (twobit == 0)
+ {
+ m_cassold = m_cassbit;
+ // synchronous rx
+ m_acia1->write_rxc(0);
+ m_acia1->write_rxd(m_cassinbit);
+ m_acia1->write_rxc(1);
+ }
+
+ if (m_cassold)
+ m_cass->output(BIT(m_cass_data[3], 1) ? +1.0 : -1.0); // 2400Hz
+ else
+ m_cass->output(BIT(m_cass_data[3], 2) ? +1.0 : -1.0); // 1200Hz
+
+ m_cass_data[3]++;
+ }
+
+ m_acia1->write_txc(state);
}
@@ -406,9 +415,8 @@ void proteus3_state::proteus3(machine_config &config)
SPEAKER(config, "mono").front_center();
CASSETTE(config, m_cass);
- m_cass->set_default_state(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED);
+ 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_w").configure_periodic(FUNC(proteus3_state::kansas_w), attotime::from_hz(4800));
TIMER(config, "kansas_r").configure_periodic(FUNC(proteus3_state::kansas_r), attotime::from_hz(40000));
// optional tty keyboard