Minor refactoring in CompuMate class.

While having friends in real life is good, we should minimize them
in classes :)
This commit is contained in:
Stephen Anthony 2017-07-20 10:56:17 -02:30
parent 953761e1a1
commit fe7c980d93
3 changed files with 8 additions and 7 deletions

View File

@ -80,7 +80,7 @@ bool CartridgeCM::poke(uInt16 address, uInt8 value)
bank(mySWCHA & 0x3);
if(myCompuMate)
{
uInt8& column = myCompuMate->myColumn;
uInt8& column = myCompuMate->column();
if(value & 0x20)
column = 0;
if(value & 0x40)
@ -95,7 +95,7 @@ bool CartridgeCM::poke(uInt16 address, uInt8 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 CartridgeCM::column() const
{
return myCompuMate->myColumn;
return myCompuMate->column();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -196,7 +196,7 @@ bool CartridgeCM::save(Serializer& out) const
out.putString(name());
out.putShort(myCurrentBank);
out.putByte(mySWCHA);
out.putByte(myCompuMate->myColumn);
out.putByte(myCompuMate->column());
out.putByteArray(myRAM, 2048);
}
catch(...)
@ -218,7 +218,7 @@ bool CartridgeCM::load(Serializer& in)
myCurrentBank = in.getShort();
mySWCHA = in.getByte();
myCompuMate->myColumn = in.getByte();
myCompuMate->column() = in.getByte();
in.getByteArray(myRAM, 2048);
}
catch(...)

View File

@ -76,7 +76,7 @@ void CompuMate::update()
rp.myDigitalPinState[Controller::Three] = true;
rp.myDigitalPinState[Controller::Four] = true;
switch(myColumn) // This is updated outside the class
switch(myColumn) // This is updated inside CartCM class
{
case 0:
if (myKeyTable[KBDK_7]) lp.myDigitalPinState[Controller::Six] = false;

View File

@ -40,8 +40,6 @@
*/
class CompuMate
{
friend class CartridgeCM;
public:
/**
Create a new CompuMate handler for both left and right ports.
@ -77,6 +75,9 @@ class CompuMate
*/
void enableKeyHandling(bool enable);
/** Needed for communication with CartCM class */
uInt8& column() { return myColumn; }
private:
/**
Called by the controller(s) when all pins have been written