From 27dc5a60e2c8d1837c00f0aca1f0bb0d5fb065a9 Mon Sep 17 00:00:00 2001 From: stephena Date: Mon, 31 Mar 2008 00:59:30 +0000 Subject: [PATCH] Moved AtariVox support from experimental to full-fledged controller. Made SpeakJet emulation be optional, because it's still a WIP and we'll soon be able to have AVox support without it. Added SerialPort infrastructure, which will implement serial port access in a general way. Those ports which don't wish to do so can simply not implement a SerialPortXXX class; in that case a null SerialPort is used. Still TODO is actually implement the serial port functionality for UNIX, and add similar classes for OSX and Win32. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1454 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/configure | 26 +++++------ stella/src/common/SoundSDL.cxx | 8 +++- stella/src/emucore/AtariVox.cxx | 25 ++++++---- stella/src/emucore/AtariVox.hxx | 26 ++++++----- stella/src/emucore/Console.cxx | 10 ++-- stella/src/emucore/Console.hxx | 13 ++---- stella/src/emucore/M6532.cxx | 15 +++--- stella/src/emucore/OSystem.cxx | 27 ++++++++++- stella/src/emucore/OSystem.hxx | 29 ++++++++---- stella/src/emucore/SerialPort.hxx | 74 ++++++++++++++++++++++++++++++ stella/src/emucore/SpeakJet.cxx | 6 ++- stella/src/emucore/SpeakJet.hxx | 6 +-- stella/src/unix/SerialPortUNIX.cxx | 55 ++++++++++++++++++++++ stella/src/unix/SerialPortUNIX.hxx | 71 ++++++++++++++++++++++++++++ stella/src/unix/module.mk | 1 + 15 files changed, 319 insertions(+), 73 deletions(-) create mode 100644 stella/src/emucore/SerialPort.hxx create mode 100644 stella/src/unix/SerialPortUNIX.cxx create mode 100644 stella/src/unix/SerialPortUNIX.hxx diff --git a/stella/configure b/stella/configure index e79f62b2d..4ca5698f8 100755 --- a/stella/configure +++ b/stella/configure @@ -27,7 +27,7 @@ _build_joystick=yes _build_cheats=yes _build_static=no _build_profile=no -_build_atarivox=no +_build_speakjet=no # more defaults _ranlib=ranlib @@ -192,8 +192,8 @@ Optional Features: --disable-joystick --enable-cheats enable/disable cheatcode support [enabled] --disable-cheats - --enable-atarivox enable/disable AtariVox support [disabled] - --disable-atarivox + --enable-speakjet enable/disable SpeakJet emulation [disabled] + --disable-speakjet --enable-shared build shared binary [enabled] --enable-static build static binary (if possible) [disabled] --disable-static @@ -232,8 +232,8 @@ for ac_option in $@; do --disable-joystick) _build_joystick=no ;; --enable-cheats) _build_cheats=yes ;; --disable-cheats) _build_cheats=no ;; - --enable-atarivox) _build_atarivox=yes ;; - --disable-atarivox) _build_atarivox=no ;; + --enable-speakjet) _build_speakjet=yes ;; + --disable-speakjet) _build_speakjet=no ;; --enable-shared) _build_static=no ;; --enable-static) _build_static=yes ;; --disable-static) _build_static=no ;; @@ -612,11 +612,11 @@ else echo fi -if test "$_build_atarivox" = yes ; then - echo_n " AtariVox support enabled (not yet working)" +if test "$_build_speakjet" = yes ; then + echo_n " SpeakJet emulation enabled (not yet working)" echo else - echo_n " AtariVox support disabled (not yet working)" + echo_n " SpeakJet emulation disabled (not yet working)" echo fi @@ -651,7 +651,7 @@ DBG="$SRC/debugger" DBGGUI="$SRC/debugger/gui" YACC="$SRC/yacc" CHEAT="$SRC/cheat" -ATARIVOX="$SRC/emucore/rsynth" +SPEAKJET="$SRC/emucore/rsynth" INCLUDES="-I$CORE -I$CORE/m6502/src -I$CORE/m6502/src/bspf/src -I$COMMON -I$GUI" @@ -725,10 +725,10 @@ if test "$_build_cheats" = yes ; then INCLUDES="$INCLUDES -I$CHEAT" fi -if test "$_build_atarivox" = yes ; then - DEFINES="$DEFINES -DATARIVOX_SUPPORT" - MODULES="$MODULES $ATARIVOX" - INCLUDES="$INCLUDES -I$ATARIVOX" +if test "$_build_speakjet" = yes ; then + DEFINES="$DEFINES -DSPEAKJET_EMULATION" + MODULES="$MODULES $SPEAKJET" + INCLUDES="$INCLUDES -I$SPEAKJET" fi if test "$_build_profile" = no ; then diff --git a/stella/src/common/SoundSDL.cxx b/stella/src/common/SoundSDL.cxx index 9d0dec5b8..ab91fcb1c 100644 --- a/stella/src/common/SoundSDL.cxx +++ b/stella/src/common/SoundSDL.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: SoundSDL.cxx,v 1.41 2008-03-29 19:15:57 stephena Exp $ +// $Id: SoundSDL.cxx,v 1.42 2008-03-31 00:59:30 stephena Exp $ //============================================================================ #ifdef SOUND_SUPPORT @@ -33,6 +33,9 @@ #include "Console.hxx" #include "AtariVox.hxx" +#ifdef SPEAKJET_EMULATION + #include "SpeakJet.hxx" +#endif #include "SoundSDL.hxx" @@ -408,7 +411,8 @@ void SoundSDL::callback(void* udata, uInt8* stream, int len) { SoundSDL* sound = (SoundSDL*)udata; sound->processFragment(stream, (Int32)len); -#ifdef ATARIVOX_SUPPORT + +#ifdef SPEAKJET_EMULATION // cerr << "SoundSDL::callback(): len==" << len << endl; // See if we need sound from the AtariVox diff --git a/stella/src/emucore/AtariVox.cxx b/stella/src/emucore/AtariVox.cxx index 09c84632b..aa4727104 100644 --- a/stella/src/emucore/AtariVox.cxx +++ b/stella/src/emucore/AtariVox.cxx @@ -13,28 +13,31 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: AtariVox.cxx,v 1.7 2008-03-29 19:15:57 stephena Exp $ +// $Id: AtariVox.cxx,v 1.8 2008-03-31 00:59:30 stephena Exp $ //============================================================================ -#ifdef ATARIVOX_SUPPORT +#ifdef SPEAKJET_EMULATION + #include "SpeakJet.hxx" +#endif -#include "Event.hxx" -#include "AtariVox.hxx" -#include "SpeakJet.hxx" +#include "SerialPort.hxx" #include "System.hxx" +#include "AtariVox.hxx" #define DEBUG_ATARIVOX 0 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -AtariVox::AtariVox(Jack jack, const Event& event) +AtariVox::AtariVox(Jack jack, const Event& event, const SerialPort& port) : Controller(jack, event, Controller::AtariVox), - mySpeakJet(0), + mySerialPort((SerialPort*)&port), myPinState(0), myShiftCount(0), myShiftRegister(0), myLastDataWriteCycle(0) { +#ifdef SPEAKJET_EMULATION mySpeakJet = new SpeakJet(); +#endif myDigitalPinState[One] = myDigitalPinState[Two] = myDigitalPinState[Three] = myDigitalPinState[Four] = true; @@ -45,7 +48,9 @@ AtariVox::AtariVox(Jack jack, const Event& event) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AtariVox::~AtariVox() { +#ifdef SPEAKJET_EMULATION delete mySpeakJet; +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -167,11 +172,11 @@ void AtariVox::shiftIn(bool value) else { uInt8 data = ((myShiftRegister >> 1) & 0xff); - cerr << "AtariVox: output byte " << ((int)(data)) << endl; +#ifdef SPEAKJET_EMULATION mySpeakJet->write(data); +#endif + mySerialPort->write(data); } myShiftRegister = 0; } } - -#endif diff --git a/stella/src/emucore/AtariVox.hxx b/stella/src/emucore/AtariVox.hxx index 65ce24082..ad5cd6b74 100644 --- a/stella/src/emucore/AtariVox.hxx +++ b/stella/src/emucore/AtariVox.hxx @@ -1,4 +1,3 @@ - //============================================================================ // // SSSS tt lll lll @@ -14,16 +13,16 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: AtariVox.hxx,v 1.9 2008-03-29 19:15:57 stephena Exp $ +// $Id: AtariVox.hxx,v 1.10 2008-03-31 00:59:30 stephena Exp $ //============================================================================ -#ifdef ATARIVOX_SUPPORT - #ifndef ATARIVOX_HXX #define ATARIVOX_HXX +class SpeakJet; + #include "Control.hxx" -#include "SpeakJet.hxx" +#include "SerialPort.hxx" /** Richard Hutchinson's AtariVox "controller": A speech synthesizer and @@ -33,7 +32,7 @@ driver code. @author B. Watson - @version $Id: AtariVox.hxx,v 1.9 2008-03-29 19:15:57 stephena Exp $ + @version $Id: AtariVox.hxx,v 1.10 2008-03-31 00:59:30 stephena Exp $ */ class AtariVox : public Controller { @@ -44,7 +43,7 @@ class AtariVox : public Controller @param jack The jack the controller is plugged into @param event The event object to use for events */ - AtariVox(Jack jack, const Event& event); + AtariVox(Jack jack, const Event& event, const SerialPort& port); /** Destructor @@ -68,7 +67,9 @@ class AtariVox : public Controller */ virtual void update(); +#ifdef SPEAKJET_EMULATION SpeakJet* getSpeakJet() { return mySpeakJet; } +#endif private: void clockDataIn(bool value); @@ -80,10 +81,15 @@ class AtariVox : public Controller // property... or it may turn out to be unnecessary. enum { TIMING_SLOP = 0 }; + // Instance of an real serial port on the system + // Assuming there's a real AtariVox attached, we can send SpeakJet + // bytes directly to it + SerialPort* mySerialPort; + +#ifdef SPEAKJET_EMULATION // Instance of SpeakJet which will actually do the talking for us. - // In the future, we'll support both real and emulated SpeakJet - // chips; for now we only emulate it. SpeakJet *mySpeakJet; +#endif // State of the output pins uInt8 myPinState; @@ -105,5 +111,3 @@ class AtariVox : public Controller }; #endif - -#endif // ATARIVOX_SUPPORT diff --git a/stella/src/emucore/Console.cxx b/stella/src/emucore/Console.cxx index 83d5fb034..b0988ccc7 100644 --- a/stella/src/emucore/Console.cxx +++ b/stella/src/emucore/Console.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Console.cxx,v 1.134 2008-03-29 19:15:57 stephena Exp $ +// $Id: Console.cxx,v 1.135 2008-03-31 00:59:30 stephena Exp $ //============================================================================ #include @@ -63,7 +63,7 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props) : myOSystem(osystem), myProperties(props), - vox(0), + myAVox(0), myDisplayFormat("NTSC"), myFramerate(60), myUserPaletteDefined(false) @@ -147,13 +147,11 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props) { myControllers[rightPort] = new TrackBall22(Controller::Right, *myEvent); } -#ifdef ATARIVOX_SUPPORT else if(right == "ATARIVOX") { -cerr << "atarivox added as right controller\n"; - myControllers[rightPort] = vox = new AtariVox(Controller::Right, *myEvent); + myControllers[rightPort] = myAVox = + new AtariVox(Controller::Right, *myEvent, myOSystem->serialPort()); } -#endif else { myControllers[rightPort] = new Joystick(Controller::Right, *myEvent); diff --git a/stella/src/emucore/Console.hxx b/stella/src/emucore/Console.hxx index 1b7f25f12..0dff71d88 100644 --- a/stella/src/emucore/Console.hxx +++ b/stella/src/emucore/Console.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Console.hxx,v 1.64 2008-02-06 13:45:21 stephena Exp $ +// $Id: Console.hxx,v 1.65 2008-03-31 00:59:30 stephena Exp $ //============================================================================ #ifndef CONSOLE_HXX @@ -39,7 +39,7 @@ class System; This class represents the entire game console. @author Bradford W. Mott - @version $Id: Console.hxx,v 1.64 2008-02-06 13:45:21 stephena Exp $ + @version $Id: Console.hxx,v 1.65 2008-03-31 00:59:30 stephena Exp $ */ class Console : public Serializable { @@ -242,9 +242,8 @@ class Console : public Serializable void togglePFBit() const { toggleTIABit(TIA::PF, "PF"); } void enableBits(bool enable) const; -#ifdef ATARIVOX_SUPPORT - AtariVox *atariVox() { return vox; } -#endif + // TODO - make the core code work without needing to access this + AtariVox* atariVox() { return myAVox; } private: void toggleTIABit(TIA::TIABit bit, const string& bitname, bool show = true) const; @@ -296,9 +295,7 @@ class Console : public Serializable // A RIOT of my own! (...with apologies to The Clash...) M6532 *myRiot; -#ifdef ATARIVOX_SUPPORT - AtariVox *vox; -#endif + AtariVox* myAVox; // The currently defined display format (NTSC/PAL/SECAM) string myDisplayFormat; diff --git a/stella/src/emucore/M6532.cxx b/stella/src/emucore/M6532.cxx index 62a061ba3..27f3eddd8 100644 --- a/stella/src/emucore/M6532.cxx +++ b/stella/src/emucore/M6532.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: M6532.cxx,v 1.15 2008-03-29 19:15:57 stephena Exp $ +// $Id: M6532.cxx,v 1.16 2008-03-31 00:59:30 stephena Exp $ //============================================================================ #include @@ -246,7 +246,12 @@ void M6532::poke(uInt16 addr, uInt8 value) else if((addr & 0x07) == 0x01) // Port A Data Direction Register { myDDRA = value; -#ifdef ATARIVOX_SUPPORT + + // TODO - Fix this properly in the core + // Any time the core code needs to know what type of controller + // is connected, it's by definition a bug + // A real Atari doesn't 'know' that an AVox is connected, so we + // shouldn't either /* 20060608 bkw: Not the most elegant thing in the world... When a bit in the DDR is set as input, +5V is placed on its output @@ -264,11 +269,6 @@ void M6532::poke(uInt16 addr, uInt8 value) be able to drive the emulated AtariVox, even though it wouldn't work on real hardware. */ - // TODO - Fix this properly in the core - // Any time the core code needs to know what type of controller - // is connected, it's by definition a bug - // A real Atari doesn't 'know' that an AVox is connected, so we - // shouldn't either Controller& c = myConsole.controller(Controller::Right); if(c.type() == Controller::AtariVox) { @@ -277,7 +277,6 @@ void M6532::poke(uInt16 addr, uInt8 value) c.write(Controller::Three, !(value & 0x04)); c.write(Controller::Four, !(value & 0x08)); } -#endif } else if((addr & 0x07) == 0x02) // Port B I/O Register (Console switches) { diff --git a/stella/src/emucore/OSystem.cxx b/stella/src/emucore/OSystem.cxx index 2a216b28e..9bdfed6d2 100644 --- a/stella/src/emucore/OSystem.cxx +++ b/stella/src/emucore/OSystem.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: OSystem.cxx,v 1.120 2008-03-30 15:01:38 stephena Exp $ +// $Id: OSystem.cxx,v 1.121 2008-03-31 00:59:30 stephena Exp $ //============================================================================ #include @@ -33,6 +33,15 @@ #include "CheatManager.hxx" #endif +#include "SerialPort.hxx" +#if defined(UNIX) + #include "SerialPortUNIX.hxx" +//#elif defined(WIN32) +// #include "SerialPortWin32.hxx" +//#elif defined(MAC_OSX) +// #include "SerialPortMACOSX.hxx" +#endif + #include "FSNode.hxx" #include "unzip.h" #include "MD5.hxx" @@ -62,6 +71,7 @@ OSystem::OSystem() mySettings(NULL), myPropSet(NULL), myConsole(NULL), + mySerialPort(NULL), myMenu(NULL), myCommandMenu(NULL), myLauncher(NULL), @@ -153,6 +163,7 @@ OSystem::~OSystem() delete myPropSet; delete myEventHandler; + delete mySerialPort; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -204,6 +215,20 @@ bool OSystem::create() // that only have a single sound device (no hardware mixing) createSound(); + // Create the serial port object + // This is used by any controller that wants to directly access + // a real serial port on the system +#if defined(UNIX) + mySerialPort = new SerialPortUNIX(); +//#elif defined(WIN32) +// mySerialPort = new SerialPortWin32(); +//#elif defined(MAC_OSX) +// mySerialPort = new SerialPortMACOSX(); +#else + // Create an 'empty' serial port + mySerialPort = new SerialPort(); +#endif + return true; } diff --git a/stella/src/emucore/OSystem.hxx b/stella/src/emucore/OSystem.hxx index d7c550395..88797b6e8 100644 --- a/stella/src/emucore/OSystem.hxx +++ b/stella/src/emucore/OSystem.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: OSystem.hxx,v 1.63 2008-03-30 15:01:38 stephena Exp $ +// $Id: OSystem.hxx,v 1.64 2008-03-31 00:59:30 stephena Exp $ //============================================================================ #ifndef OSYSTEM_HXX @@ -28,6 +28,7 @@ class Launcher; class Menu; class Properties; class PropertiesSet; +class SerialPort; class Settings; class Sound; class StateManager; @@ -55,7 +56,7 @@ typedef Common::Array ResolutionList; other objects belong. @author Stephen Anthony - @version $Id: OSystem.hxx,v 1.63 2008-03-30 15:01:38 stephena Exp $ + @version $Id: OSystem.hxx,v 1.64 2008-03-31 00:59:30 stephena Exp $ */ class OSystem { @@ -126,35 +127,42 @@ class OSystem @return The console object */ - inline Console& console(void) const { return *myConsole; } + inline Console& console() const { return *myConsole; } + + /** + Get the serial port of the system. + + @return The serial port object + */ + inline SerialPort& serialPort() const { return *mySerialPort; } /** Get the settings menu of the system. @return The settings menu object */ - inline Menu& menu(void) const { return *myMenu; } + inline Menu& menu() const { return *myMenu; } /** Get the command menu of the system. @return The command menu object */ - inline CommandMenu& commandMenu(void) const { return *myCommandMenu; } + inline CommandMenu& commandMenu() const { return *myCommandMenu; } /** Get the ROM launcher of the system. @return The launcher object */ - inline Launcher& launcher(void) const { return *myLauncher; } + inline Launcher& launcher() const { return *myLauncher; } /** Get the state manager of the system. @return The statemanager object */ - inline StateManager& state(void) const { return *myStateManager; } + inline StateManager& state() const { return *myStateManager; } #ifdef DEBUGGER_SUPPORT /** @@ -162,7 +170,7 @@ class OSystem @return The debugger object */ - inline Debugger& debugger(void) const { return *myDebugger; } + inline Debugger& debugger() const { return *myDebugger; } #endif #ifdef CHEATCODE_SUPPORT @@ -171,7 +179,7 @@ class OSystem @return The cheatmanager object */ - inline CheatManager& cheat(void) const { return *myCheatManager; } + inline CheatManager& cheat() const { return *myCheatManager; } #endif /** @@ -456,6 +464,9 @@ class OSystem // Pointer to the (currently defined) Console object Console* myConsole; + // Pointer to the serial port object + SerialPort* mySerialPort; + // Pointer to the Menu object Menu* myMenu; diff --git a/stella/src/emucore/SerialPort.hxx b/stella/src/emucore/SerialPort.hxx new file mode 100644 index 000000000..08c742c40 --- /dev/null +++ b/stella/src/emucore/SerialPort.hxx @@ -0,0 +1,74 @@ +//============================================================================ +// +// 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 +// +// Copyright (c) 1995-2008 by Bradford W. Mott and the Stella team +// +// See the file "license" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +// +// $Id: SerialPort.hxx,v 1.1 2008-03-31 00:59:30 stephena Exp $ +//============================================================================ + +#ifndef SERIALPORT_HXX +#define SERIALPORT_HXX + +#include "bspf.hxx" + +/** + This class provides an interface for a standard serial port. + For now, this used when connecting a real AtariVox device, + but it may be used for other devices in the future. + + @author Stephen Anthony + @version $Id: SerialPort.hxx,v 1.1 2008-03-31 00:59:30 stephena Exp $ +*/ +class SerialPort +{ + public: + SerialPort() { } + virtual ~SerialPort() { } + + /** + Open the given serial port with the specified attributes. + + @param device The name of the port + @param baud Baud rate + @param data Number of data bits + @param stop Number of stop bits + @param parity Type of parity bit (0=none, 1=odd, 2=even) + + @return False on any errors, else true + */ + virtual bool open(const string& device, int baud, int data, + int stop, int parity) { return false; } + + /** + Close a previously opened serial port. + */ + virtual void close() { } + + /** + Read a byte from the serial port. + + @param data Destination for the byte read from the port + @return True if a byte was read, else false + */ + virtual bool read(uInt8& data) { return false; } + + /** + Write a byte to the serial port. + + @param data The byte to write to the port + @return True if a byte was written, else false + */ + virtual bool write(const uInt8 data) { return false; } +}; + +#endif diff --git a/stella/src/emucore/SpeakJet.cxx b/stella/src/emucore/SpeakJet.cxx index 98a41f27b..a943e6291 100644 --- a/stella/src/emucore/SpeakJet.cxx +++ b/stella/src/emucore/SpeakJet.cxx @@ -13,10 +13,10 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: SpeakJet.cxx,v 1.8 2008-03-29 19:15:57 stephena Exp $ +// $Id: SpeakJet.cxx,v 1.9 2008-03-31 00:59:30 stephena Exp $ //============================================================================ -#ifdef ATARIVOX_SUPPORT +#ifdef SPEAKJET_EMULATION #include "SpeakJet.hxx" @@ -84,6 +84,8 @@ int SpeakJet::thread(void *data) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void SpeakJet::write(uInt8 code) { + cerr << "SpeakJet: output byte " << ((int)(code)) << endl; + // TODO: clean up this mess. const char *rsynthPhones = xlatePhoneme(code); // cerr << "rsynth: \"" << rsynthPhones << "\"" << endl; diff --git a/stella/src/emucore/SpeakJet.hxx b/stella/src/emucore/SpeakJet.hxx index 1fd8bff9e..eed726cc3 100644 --- a/stella/src/emucore/SpeakJet.hxx +++ b/stella/src/emucore/SpeakJet.hxx @@ -13,10 +13,10 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: SpeakJet.hxx,v 1.9 2008-03-29 19:15:57 stephena Exp $ +// $Id: SpeakJet.hxx,v 1.10 2008-03-31 00:59:30 stephena Exp $ //============================================================================ -#ifdef ATARIVOX_SUPPORT +#ifdef SPEAKJET_EMULATION #ifndef SPEAKJET_HXX #define SPEAKJET_HXX @@ -77,7 +77,7 @@ anyway). @author B. Watson - @version $Id: SpeakJet.hxx,v 1.9 2008-03-29 19:15:57 stephena Exp $ + @version $Id: SpeakJet.hxx,v 1.10 2008-03-31 00:59:30 stephena Exp $ */ #include "bspf.hxx" diff --git a/stella/src/unix/SerialPortUNIX.cxx b/stella/src/unix/SerialPortUNIX.cxx new file mode 100644 index 000000000..812d4e175 --- /dev/null +++ b/stella/src/unix/SerialPortUNIX.cxx @@ -0,0 +1,55 @@ +//============================================================================ +// +// 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 +// +// Copyright (c) 1995-2008 by Bradford W. Mott and the Stella team +// +// See the file "license" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +// +// $Id: SerialPortUNIX.cxx,v 1.1 2008-03-31 00:59:30 stephena Exp $ +//============================================================================ + +#include "SerialPortUNIX.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +SerialPortUNIX::SerialPortUNIX() + : SerialPort() +{ +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +SerialPortUNIX::~SerialPortUNIX() +{ +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool SerialPortUNIX::open(const string& device, int baud, int data, + int stop, int parity) +{ + return false; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void SerialPortUNIX::close() +{ +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool SerialPortUNIX::read(uInt8& data) +{ + return false; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool SerialPortUNIX::write(const uInt8 data) +{ + cerr << "SerialPortUNIX::write " << (int)data << endl; + return false; +} diff --git a/stella/src/unix/SerialPortUNIX.hxx b/stella/src/unix/SerialPortUNIX.hxx new file mode 100644 index 000000000..acf1c4825 --- /dev/null +++ b/stella/src/unix/SerialPortUNIX.hxx @@ -0,0 +1,71 @@ +//============================================================================ +// +// 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 +// +// Copyright (c) 1995-2008 by Bradford W. Mott and the Stella team +// +// See the file "license" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +// +// $Id: SerialPortUNIX.hxx,v 1.1 2008-03-31 00:59:30 stephena Exp $ +//============================================================================ + +#ifndef SERIALPORT_UNIX_HXX +#define SERIALPORT_UNIX_HXX + +#include "SerialPort.hxx" + +/** + Implement reading and writing from a serial port under UNIX. + + @author Stephen Anthony + @version $Id: SerialPortUNIX.hxx,v 1.1 2008-03-31 00:59:30 stephena Exp $ +*/ +class SerialPortUNIX : public SerialPort +{ + public: + SerialPortUNIX(); + virtual ~SerialPortUNIX(); + + /** + Open the given serial port with the specified attributes. + + @param device The name of the port + @param baud Baud rate + @param data Number of data bits + @param stop Number of stop bits + @param parity Type of parity bit (0=none, 1=odd, 2=even) + + @return False on any errors, else true + */ + bool open(const string& device, int baud, int data, int stop, int parity); + + /** + Close a previously opened serial port. + */ + void close(); + + /** + Read a byte from the serial port. + + @param data Destination for the byte read from the port + @return True if a byte was read, else false + */ + bool read(uInt8& data); + + /** + Write a byte to the serial port. + + @param data The byte to write to the port + @return True if a byte was written, else false + */ + bool write(const uInt8 data); +}; + +#endif diff --git a/stella/src/unix/module.mk b/stella/src/unix/module.mk index 70c742626..052b37a8c 100644 --- a/stella/src/unix/module.mk +++ b/stella/src/unix/module.mk @@ -3,6 +3,7 @@ MODULE := src/unix MODULE_OBJS := \ src/unix/FSNodePOSIX.o \ src/unix/OSystemUNIX.o \ + src/unix/SerialPortUNIX.o \ src/unix/SettingsUNIX.o MODULE_DIRS += \