2006-06-09 02:45:11 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2015-01-01 03:49:32 +00:00
|
|
|
// Copyright (c) 1995-2015 by Bradford W. Mott, Stephen Anthony
|
2010-04-10 21:37:23 +00:00
|
|
|
// and the Stella Team
|
2006-06-09 02:45:11 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2006-06-09 02:45:11 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2009-05-13 13:55:40 +00:00
|
|
|
// $Id$
|
2006-06-09 02:45:11 +00:00
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#ifndef ATARIVOX_HXX
|
|
|
|
#define ATARIVOX_HXX
|
|
|
|
|
2008-04-13 23:43:14 +00:00
|
|
|
class SerialPort;
|
|
|
|
class MT24LC256;
|
2008-03-31 00:59:30 +00:00
|
|
|
|
2006-06-09 02:45:11 +00:00
|
|
|
#include "Control.hxx"
|
|
|
|
|
|
|
|
/**
|
2006-06-11 07:13:29 +00:00
|
|
|
Richard Hutchinson's AtariVox "controller": A speech synthesizer and
|
2006-06-09 02:45:11 +00:00
|
|
|
storage device.
|
|
|
|
|
2006-06-11 07:13:29 +00:00
|
|
|
This code owes a great debt to Alex Herbert's AtariVox documentation and
|
|
|
|
driver code.
|
|
|
|
|
2006-06-09 02:45:11 +00:00
|
|
|
@author B. Watson
|
2009-05-13 13:55:40 +00:00
|
|
|
@version $Id$
|
2006-06-09 02:45:11 +00:00
|
|
|
*/
|
|
|
|
class AtariVox : public Controller
|
|
|
|
{
|
2014-06-29 23:25:53 +00:00
|
|
|
friend class AtariVoxWidget;
|
|
|
|
|
2006-06-09 02:45:11 +00:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Create a new AtariVox controller plugged into the specified jack
|
|
|
|
|
2008-04-13 23:43:14 +00:00
|
|
|
@param jack The jack the controller is plugged into
|
|
|
|
@param event The event object to use for events
|
|
|
|
@param system The system using this controller
|
|
|
|
@param port The serial port object
|
|
|
|
@param portname Name of the port used for reading and writing
|
|
|
|
@param eepromfile The file containing the EEPROM data
|
2006-06-09 02:45:11 +00:00
|
|
|
*/
|
2008-04-13 23:43:14 +00:00
|
|
|
AtariVox(Jack jack, const Event& event, const System& system,
|
|
|
|
const SerialPort& port, const string& portname,
|
|
|
|
const string& eepromfile);
|
2006-06-09 02:45:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor
|
|
|
|
*/
|
|
|
|
virtual ~AtariVox();
|
|
|
|
|
|
|
|
public:
|
2012-10-24 10:10:32 +00:00
|
|
|
using Controller::read;
|
|
|
|
|
2008-04-13 23:43:14 +00:00
|
|
|
/**
|
|
|
|
Read the value of the specified digital pin for this controller.
|
|
|
|
|
|
|
|
@param pin The pin of the controller jack to read
|
|
|
|
@return The state of the pin
|
|
|
|
*/
|
2011-05-24 16:04:48 +00:00
|
|
|
bool read(DigitalPin pin);
|
2008-04-13 23:43:14 +00:00
|
|
|
|
2006-06-09 02:45:11 +00:00
|
|
|
/**
|
|
|
|
Write the given value to the specified digital pin for this
|
|
|
|
controller. Writing is only allowed to the pins associated
|
|
|
|
with the PIA. Therefore you cannot write to pin six.
|
|
|
|
|
|
|
|
@param pin The pin of the controller jack to write to
|
|
|
|
@param value The value to write to the pin
|
|
|
|
*/
|
2011-05-24 16:04:48 +00:00
|
|
|
void write(DigitalPin pin, bool value);
|
2006-06-09 02:45:11 +00:00
|
|
|
|
2008-03-29 19:15:57 +00:00
|
|
|
/**
|
|
|
|
Update the entire digital and analog pin state according to the
|
|
|
|
events currently set.
|
|
|
|
*/
|
2011-05-24 16:04:48 +00:00
|
|
|
void update() { }
|
2008-03-29 19:15:57 +00:00
|
|
|
|
2008-05-19 02:53:58 +00:00
|
|
|
/**
|
|
|
|
Notification method invoked by the system right before the
|
|
|
|
system resets its cycle counter to zero. It may be necessary
|
|
|
|
to override this method for devices that remember cycle counts.
|
|
|
|
*/
|
2011-05-24 16:04:48 +00:00
|
|
|
void systemCyclesReset();
|
2008-05-19 02:53:58 +00:00
|
|
|
|
2012-01-08 18:23:51 +00:00
|
|
|
string about() const;
|
2008-04-11 17:56:35 +00:00
|
|
|
|
2006-06-11 07:13:29 +00:00
|
|
|
private:
|
2007-02-22 02:15:46 +00:00
|
|
|
void clockDataIn(bool value);
|
|
|
|
void shiftIn(bool value);
|
2006-06-11 07:13:29 +00:00
|
|
|
|
|
|
|
private:
|
2008-03-31 00:59:30 +00:00
|
|
|
// Instance of an real serial port on the system
|
|
|
|
// Assuming there's a real AtariVox attached, we can send SpeakJet
|
|
|
|
// bytes directly to it
|
2009-01-26 21:08:07 +00:00
|
|
|
SerialPort& mySerialPort;
|
2008-03-31 00:59:30 +00:00
|
|
|
|
2008-04-13 23:43:14 +00:00
|
|
|
// The EEPROM used in the AtariVox
|
2014-11-03 17:16:43 +00:00
|
|
|
unique_ptr<MT24LC256> myEEPROM;
|
2008-04-13 23:43:14 +00:00
|
|
|
|
2007-02-22 02:15:46 +00:00
|
|
|
// How many bits have been shifted into the shift register?
|
|
|
|
uInt8 myShiftCount;
|
2006-06-11 07:13:29 +00:00
|
|
|
|
2007-02-22 02:15:46 +00:00
|
|
|
// Shift register. Data comes in serially:
|
|
|
|
// 1 start bit, always 0
|
|
|
|
// 8 data bits, LSB first
|
|
|
|
// 1 stop bit, always 1
|
|
|
|
uInt16 myShiftRegister;
|
2006-06-09 02:45:11 +00:00
|
|
|
|
2006-06-11 07:13:29 +00:00
|
|
|
// When did the last data write start, in CPU cycles?
|
2007-02-22 02:15:46 +00:00
|
|
|
// The real SpeakJet chip reads data at 19200 bits/sec. Alex's
|
|
|
|
// driver code sends data at 62 CPU cycles per bit, which is
|
|
|
|
// "close enough".
|
2006-06-11 07:13:29 +00:00
|
|
|
uInt32 myLastDataWriteCycle;
|
2008-04-11 17:56:35 +00:00
|
|
|
|
|
|
|
// Holds information concerning serial port usage
|
|
|
|
string myAboutString;
|
2006-06-09 02:45:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|