diff --git a/Changes.txt b/Changes.txt index 9db31b627..61b036ebc 100644 --- a/Changes.txt +++ b/Changes.txt @@ -33,6 +33,10 @@ Basically, you are now able to put many files that Stella uses inside one ZIP file, and distribute just that file. + * Extended AtariVox support to handle flow control, so that long phrases + are no longer corrupted/cut off. Note that some USB-serial adaptors + don't support this mode, so there may still be issues with those. + * Added option to select the audio device. * Added option to display detected settings info when a ROM is loaded. diff --git a/src/emucore/AtariVox.cxx b/src/emucore/AtariVox.cxx index fd75024e4..731232456 100644 --- a/src/emucore/AtariVox.cxx +++ b/src/emucore/AtariVox.cxx @@ -28,7 +28,13 @@ AtariVox::AtariVox(Jack jack, const Event& event, const System& system, { mySerialPort = MediaFactory::createSerialPort(); if(mySerialPort->openPort(portname)) - myAboutString = " (using serial port \'" + portname + "\')"; + { + myCTSFlip = !mySerialPort->isCTS(); + if(myCTSFlip) + myAboutString = " (serial port \'" + portname + "\', inverted CTS)"; + else + myAboutString = " (serial port \'" + portname + "\')"; + } else myAboutString = " (invalid serial port \'" + portname + "\')"; @@ -50,12 +56,10 @@ bool AtariVox::read(DigitalPin pin) switch(pin) { // Pin 2: SpeakJet READY - // CTS (Clear To Send) is connected inverted - // So CTS = 0 means the buffer is full, which pulls pin 2 high + // CTS (Clear To Send) is sent directly to pin 2 + // We also deal with the case where devices send CTS inverted case DigitalPin::Two: - { - return setPin(pin, !mySerialPort->isCTS()); - } + return setPin(pin, mySerialPort->isCTS() ^ myCTSFlip); default: return SaveKey::read(pin); diff --git a/src/emucore/AtariVox.hxx b/src/emucore/AtariVox.hxx index 3251234ed..132b2c377 100644 --- a/src/emucore/AtariVox.hxx +++ b/src/emucore/AtariVox.hxx @@ -117,6 +117,11 @@ class AtariVox : public SaveKey // "close enough". uInt64 myLastDataWriteCycle{0}; + // Some USB-Serial adaptors either don't support CTS, or send the signal + // as inverted; we detect that when opening the port, and flip the signal + // when necessary + bool myCTSFlip{false}; + // Holds information concerning serial port usage string myAboutString;