mirror of https://github.com/stella-emu/stella.git
Some more experimentation with the RIOT and AVox 'connection'. The AVox
SpeakJet portion is working, but still no-go for the I2C stuff. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1482 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
b0d9de7344
commit
0682a85999
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: AtariVox.cxx,v 1.15 2008-04-17 13:39:14 stephena Exp $
|
// $Id: AtariVox.cxx,v 1.16 2008-04-20 19:52:33 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifdef SPEAKJET_EMULATION
|
#ifdef SPEAKJET_EMULATION
|
||||||
|
@ -34,7 +34,6 @@ AtariVox::AtariVox(Jack jack, const Event& event, const System& system,
|
||||||
: Controller(jack, event, system, Controller::AtariVox),
|
: Controller(jack, event, system, Controller::AtariVox),
|
||||||
mySerialPort((SerialPort*)&port),
|
mySerialPort((SerialPort*)&port),
|
||||||
myEEPROM(NULL),
|
myEEPROM(NULL),
|
||||||
myPinState(0),
|
|
||||||
myShiftCount(0),
|
myShiftCount(0),
|
||||||
myShiftRegister(0),
|
myShiftRegister(0),
|
||||||
myLastDataWriteCycle(0)
|
myLastDataWriteCycle(0)
|
||||||
|
@ -138,8 +137,9 @@ void AtariVox::write(DigitalPin pin, bool value)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void AtariVox::clockDataIn(bool value)
|
void AtariVox::clockDataIn(bool value)
|
||||||
{
|
{
|
||||||
// bool oldValue = myPinState & 0x01;
|
// Data is normally inverted when sending to the SpeakJet;
|
||||||
myPinState = (myPinState & 0xfe) | (int)value;
|
// we need to reverse that
|
||||||
|
// value = !value;
|
||||||
|
|
||||||
uInt32 cycle = mySystem.cycles();
|
uInt32 cycle = mySystem.cycles();
|
||||||
if(DEBUG_ATARIVOX)
|
if(DEBUG_ATARIVOX)
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: AtariVox.hxx,v 1.12 2008-04-13 23:43:14 stephena Exp $
|
// $Id: AtariVox.hxx,v 1.13 2008-04-20 19:52:33 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef ATARIVOX_HXX
|
#ifndef ATARIVOX_HXX
|
||||||
|
@ -33,7 +33,7 @@ class MT24LC256;
|
||||||
driver code.
|
driver code.
|
||||||
|
|
||||||
@author B. Watson
|
@author B. Watson
|
||||||
@version $Id: AtariVox.hxx,v 1.12 2008-04-13 23:43:14 stephena Exp $
|
@version $Id: AtariVox.hxx,v 1.13 2008-04-20 19:52:33 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class AtariVox : public Controller
|
class AtariVox : public Controller
|
||||||
{
|
{
|
||||||
|
@ -111,9 +111,6 @@ class AtariVox : public Controller
|
||||||
SpeakJet *mySpeakJet;
|
SpeakJet *mySpeakJet;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// State of the output pins
|
|
||||||
uInt8 myPinState;
|
|
||||||
|
|
||||||
// How many bits have been shifted into the shift register?
|
// How many bits have been shifted into the shift register?
|
||||||
uInt8 myShiftCount;
|
uInt8 myShiftCount;
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: M6532.cxx,v 1.19 2008-04-19 21:11:52 stephena Exp $
|
// $Id: M6532.cxx,v 1.20 2008-04-20 19:52:33 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -126,23 +126,17 @@ uInt8 M6532::peek(uInt16 addr)
|
||||||
{
|
{
|
||||||
uInt8 value = 0x00;
|
uInt8 value = 0x00;
|
||||||
|
|
||||||
if(myConsole.controller(Controller::Left).read(Controller::One))
|
Controller& port0 = myConsole.controller(Controller::Left);
|
||||||
value |= 0x10;
|
if(port0.read(Controller::One)) value |= 0x10;
|
||||||
if(myConsole.controller(Controller::Left).read(Controller::Two))
|
if(port0.read(Controller::Two)) value |= 0x20;
|
||||||
value |= 0x20;
|
if(port0.read(Controller::Three)) value |= 0x40;
|
||||||
if(myConsole.controller(Controller::Left).read(Controller::Three))
|
if(port0.read(Controller::Four)) value |= 0x80;
|
||||||
value |= 0x40;
|
|
||||||
if(myConsole.controller(Controller::Left).read(Controller::Four))
|
|
||||||
value |= 0x80;
|
|
||||||
|
|
||||||
if(myConsole.controller(Controller::Right).read(Controller::One))
|
Controller& port1 = myConsole.controller(Controller::Right);
|
||||||
value |= 0x01;
|
if(port1.read(Controller::One)) value |= 0x01;
|
||||||
if(myConsole.controller(Controller::Right).read(Controller::Two))
|
if(port1.read(Controller::Two)) value |= 0x02;
|
||||||
value |= 0x02;
|
if(port1.read(Controller::Three)) value |= 0x04;
|
||||||
if(myConsole.controller(Controller::Right).read(Controller::Three))
|
if(port1.read(Controller::Four)) value |= 0x08;
|
||||||
value |= 0x04;
|
|
||||||
if(myConsole.controller(Controller::Right).read(Controller::Four))
|
|
||||||
value |= 0x08;
|
|
||||||
|
|
||||||
// Return the input bits set by the controller *and* the
|
// Return the input bits set by the controller *and* the
|
||||||
// output bits set by the last write to SWCHA
|
// output bits set by the last write to SWCHA
|
||||||
|
@ -187,6 +181,9 @@ uInt8 M6532::peek(uInt16 addr)
|
||||||
case 0x05: // Interrupt Flag
|
case 0x05: // Interrupt Flag
|
||||||
case 0x07:
|
case 0x07:
|
||||||
{
|
{
|
||||||
|
// TODO - test this
|
||||||
|
// it seems as if myTimerReadAfterInterrupt being true
|
||||||
|
// would mean that the interrupt has been enabled??
|
||||||
if((timerClocks() >= 0) || myTimerReadAfterInterrupt)
|
if((timerClocks() >= 0) || myTimerReadAfterInterrupt)
|
||||||
return 0x00;
|
return 0x00;
|
||||||
else
|
else
|
||||||
|
@ -219,20 +216,24 @@ void M6532::poke(uInt16 addr, uInt8 value)
|
||||||
myOutA = value;
|
myOutA = value;
|
||||||
uInt8 a = myOutA & myDDRA;
|
uInt8 a = myOutA & myDDRA;
|
||||||
|
|
||||||
myConsole.controller(Controller::Left).write(Controller::One, a & 0x10);
|
Controller& port0 = myConsole.controller(Controller::Left);
|
||||||
myConsole.controller(Controller::Left).write(Controller::Two, a & 0x20);
|
port0.write(Controller::One, a & 0x10);
|
||||||
myConsole.controller(Controller::Left).write(Controller::Three, a & 0x40);
|
port0.write(Controller::Two, a & 0x20);
|
||||||
myConsole.controller(Controller::Left).write(Controller::Four, a & 0x80);
|
port0.write(Controller::Three, a & 0x40);
|
||||||
|
port0.write(Controller::Four, a & 0x80);
|
||||||
|
|
||||||
myConsole.controller(Controller::Right).write(Controller::One, a & 0x01);
|
Controller& port1 = myConsole.controller(Controller::Right);
|
||||||
myConsole.controller(Controller::Right).write(Controller::Two, a & 0x02);
|
port1.write(Controller::One, a & 0x01);
|
||||||
myConsole.controller(Controller::Right).write(Controller::Three, a & 0x04);
|
port1.write(Controller::Two, a & 0x02);
|
||||||
myConsole.controller(Controller::Right).write(Controller::Four, a & 0x08);
|
port1.write(Controller::Three, a & 0x04);
|
||||||
|
port1.write(Controller::Four, a & 0x08);
|
||||||
}
|
}
|
||||||
else if((addr & 0x07) == 0x01) // Port A Data Direction Register
|
else if((addr & 0x07) == 0x01) // Port A Data Direction Register
|
||||||
{
|
{
|
||||||
myDDRA = value;
|
myDDRA = value;
|
||||||
|
|
||||||
|
uInt8 a = myOutA | ~myDDRA;
|
||||||
|
|
||||||
// TODO - Fix this properly in the core
|
// TODO - Fix this properly in the core
|
||||||
// Any time the core code needs to know what type of controller
|
// Any time the core code needs to know what type of controller
|
||||||
// is connected, it's by definition a bug
|
// is connected, it's by definition a bug
|
||||||
|
@ -255,14 +256,17 @@ void M6532::poke(uInt16 addr, uInt8 value)
|
||||||
be able to drive the emulated AtariVox, even though it wouldn't
|
be able to drive the emulated AtariVox, even though it wouldn't
|
||||||
work on real hardware.
|
work on real hardware.
|
||||||
*/
|
*/
|
||||||
Controller& c = myConsole.controller(Controller::Right);
|
Controller& port0 = myConsole.controller(Controller::Left);
|
||||||
if(c.type() == Controller::AtariVox)
|
port0.write(Controller::One, a & 0x10);
|
||||||
{
|
port0.write(Controller::Two, a & 0x20);
|
||||||
c.write(Controller::One, !(value & 0x01));
|
port0.write(Controller::Three, a & 0x40);
|
||||||
c.write(Controller::Two, !(value & 0x02));
|
port0.write(Controller::Four, a & 0x80);
|
||||||
c.write(Controller::Three, !(value & 0x04));
|
|
||||||
c.write(Controller::Four, !(value & 0x08));
|
Controller& port1 = myConsole.controller(Controller::Right);
|
||||||
}
|
port1.write(Controller::One, a & 0x01);
|
||||||
|
port1.write(Controller::Two, a & 0x02);
|
||||||
|
port1.write(Controller::Three, a & 0x04);
|
||||||
|
port1.write(Controller::Four, a & 0x08);
|
||||||
}
|
}
|
||||||
else if((addr & 0x07) == 0x02) // Port B I/O Register (Console switches)
|
else if((addr & 0x07) == 0x02) // Port B I/O Register (Console switches)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: M6532.hxx,v 1.10 2008-04-19 21:11:52 stephena Exp $
|
// $Id: M6532.hxx,v 1.11 2008-04-20 19:52:33 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef M6532_HXX
|
#ifndef M6532_HXX
|
||||||
|
@ -32,7 +32,7 @@ class Deserializer;
|
||||||
RIOT
|
RIOT
|
||||||
|
|
||||||
@author Bradford W. Mott
|
@author Bradford W. Mott
|
||||||
@version $Id: M6532.hxx,v 1.10 2008-04-19 21:11:52 stephena Exp $
|
@version $Id: M6532.hxx,v 1.11 2008-04-20 19:52:33 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class M6532 : public Device
|
class M6532 : public Device
|
||||||
{
|
{
|
||||||
|
@ -168,5 +168,5 @@ class M6532 : public Device
|
||||||
// Assignment operator isn't supported by this class so make it private
|
// Assignment operator isn't supported by this class so make it private
|
||||||
M6532& operator = (const M6532&);
|
M6532& operator = (const M6532&);
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: MT24LC256.cxx,v 1.4 2008-04-17 13:39:14 stephena Exp $
|
// $Id: MT24LC256.cxx,v 1.5 2008-04-20 19:52:33 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -93,7 +93,7 @@ bool MT24LC256::readSDA()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void MT24LC256::writeSDA(bool state)
|
void MT24LC256::writeSDA(bool state)
|
||||||
{
|
{
|
||||||
//cerr << "writeSDA: " << state << endl;
|
cerr << "writeSDA: " << state << endl;
|
||||||
|
|
||||||
#define jpee_data(x) ( (x) ? \
|
#define jpee_data(x) ( (x) ? \
|
||||||
(!jpee_mdat && jpee_sdat && jpee_mclk && (jpee_data_stop(),1), jpee_mdat = 1) : \
|
(!jpee_mdat && jpee_sdat && jpee_mclk && (jpee_data_stop(),1), jpee_mdat = 1) : \
|
||||||
|
@ -105,7 +105,7 @@ void MT24LC256::writeSDA(bool state)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void MT24LC256::writeSCL(bool state)
|
void MT24LC256::writeSCL(bool state)
|
||||||
{
|
{
|
||||||
//cerr << "writeSCL: " << state << endl;
|
cerr << "writeSCL: " << state << endl;
|
||||||
|
|
||||||
#define jpee_clock(x) ( (x) ? \
|
#define jpee_clock(x) ( (x) ? \
|
||||||
(jpee_mclk = 1) : \
|
(jpee_mclk = 1) : \
|
||||||
|
@ -331,7 +331,7 @@ cerr << " --> elapsed: " << elapsed << endl;
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
int MT24LC256::jpee_logproc(char const *st)
|
int MT24LC256::jpee_logproc(char const *st)
|
||||||
{
|
{
|
||||||
// cerr << " " << st << endl;
|
cerr << " " << st << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue