mirror of https://github.com/stella-emu/stella.git
Updated VS project file, reworked SaveKey/AtariVox widget, started with implementing trackball widgets for debugger (AmigaMouse working)
This commit is contained in:
parent
01449ddeec
commit
f77cd9ab06
|
@ -71,6 +71,11 @@ class Base
|
||||||
os.flags(myHexflags);
|
os.flags(myHexflags);
|
||||||
return os << std::setw(2) << std::setfill('0');
|
return os << std::setw(2) << std::setfill('0');
|
||||||
}
|
}
|
||||||
|
static inline std::ostream& HEX3(std::ostream& os)
|
||||||
|
{
|
||||||
|
os.flags(myHexflags);
|
||||||
|
return os << std::setw(3) << std::setfill('0');
|
||||||
|
}
|
||||||
static inline std::ostream& HEX4(std::ostream& os) {
|
static inline std::ostream& HEX4(std::ostream& os) {
|
||||||
os.flags(myHexflags);
|
os.flags(myHexflags);
|
||||||
return os << std::setw(4) << std::setfill('0');
|
return os << std::setw(4) << std::setfill('0');
|
||||||
|
|
|
@ -44,9 +44,17 @@ void AtariVoxWidget::eraseAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool AtariVoxWidget::isPageDetected()
|
bool AtariVoxWidget::isUseDetected()
|
||||||
{
|
{
|
||||||
AtariVox& avox = static_cast<AtariVox&>(myController);
|
AtariVox& avox = static_cast<AtariVox&>(myController);
|
||||||
|
|
||||||
return avox.myEEPROM->isPageDetected();
|
return avox.myEEPROM->isUseDetected();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool AtariVoxWidget::isPageUsed(int page)
|
||||||
|
{
|
||||||
|
AtariVox& avox = static_cast<AtariVox&>(myController);
|
||||||
|
|
||||||
|
return avox.myEEPROM->isPageUsed(page);
|
||||||
}
|
}
|
|
@ -31,13 +31,10 @@ class AtariVoxWidget : public FlashWidget
|
||||||
private:
|
private:
|
||||||
void loadConfig() override { }
|
void loadConfig() override { }
|
||||||
|
|
||||||
string getName()
|
|
||||||
{
|
|
||||||
return "AtariVox";
|
|
||||||
}
|
|
||||||
void eraseCurrent();
|
void eraseCurrent();
|
||||||
void eraseAll();
|
void eraseAll();
|
||||||
bool isPageDetected();
|
bool isUseDetected();
|
||||||
|
bool isPageUsed(int page);
|
||||||
|
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
AtariVoxWidget() = delete;
|
AtariVoxWidget() = delete;
|
||||||
|
|
|
@ -22,13 +22,13 @@
|
||||||
DrivingWidget::DrivingWidget(GuiObject* boss, const GUI::Font& font,
|
DrivingWidget::DrivingWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, Controller& controller)
|
int x, int y, Controller& controller)
|
||||||
: ControllerWidget(boss, font, x, y, controller),
|
: ControllerWidget(boss, font, x, y, controller),
|
||||||
myGreyIndex(0)
|
myGrayIndex(0)
|
||||||
{
|
{
|
||||||
bool leftport = myController.jack() == Controller::Left;
|
bool leftport = myController.jack() == Controller::Left;
|
||||||
const string& label = leftport ? "Left (Driving)" : "Right (Driving)";
|
const string& label = leftport ? "Left (Driving)" : "Right (Driving)";
|
||||||
|
|
||||||
const int fontHeight = font.getFontHeight(),
|
const int fontHeight = font.getFontHeight(),
|
||||||
bwidth = font.getStringWidth("Grey code +") + 10,
|
bwidth = font.getStringWidth("Gray code +") + 10,
|
||||||
bheight = font.getLineHeight() + 4;
|
bheight = font.getLineHeight() + 4;
|
||||||
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Driving)");
|
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Driving)");
|
||||||
StaticTextWidget* t;
|
StaticTextWidget* t;
|
||||||
|
@ -37,22 +37,22 @@ DrivingWidget::DrivingWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
fontHeight, label, kTextAlignLeft);
|
fontHeight, label, kTextAlignLeft);
|
||||||
|
|
||||||
ypos += t->getHeight() + 20;
|
ypos += t->getHeight() + 20;
|
||||||
myGreyUp = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
myGrayUp = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
"Grey code +", kGreyUpCmd);
|
"Gray code +", kGrayUpCmd);
|
||||||
myGreyUp->setTarget(this);
|
myGrayUp->setTarget(this);
|
||||||
|
|
||||||
ypos += myGreyUp->getHeight() + 5;
|
ypos += myGrayUp->getHeight() + 5;
|
||||||
myGreyDown = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
myGrayDown = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight,
|
||||||
"Grey code -", kGreyDownCmd);
|
"Gray code -", kGrayDownCmd);
|
||||||
myGreyDown->setTarget(this);
|
myGrayDown->setTarget(this);
|
||||||
|
|
||||||
xpos += myGreyDown->getWidth() + 10; ypos -= 10;
|
xpos += myGrayDown->getWidth() + 10; ypos -= 10;
|
||||||
myGreyValue = new DataGridWidget(boss, font, xpos, ypos,
|
myGrayValue = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 2, 8, Common::Base::F_16);
|
1, 1, 2, 8, Common::Base::F_16);
|
||||||
myGreyValue->setTarget(this);
|
myGrayValue->setTarget(this);
|
||||||
myGreyValue->setEditable(false);
|
myGrayValue->setEditable(false);
|
||||||
|
|
||||||
xpos = x + 30; ypos += myGreyDown->getHeight() + 20;
|
xpos = x + 30; ypos += myGrayDown->getHeight() + 20;
|
||||||
myFire = new CheckboxWidget(boss, font, xpos, ypos, "Fire", kFireCmd);
|
myFire = new CheckboxWidget(boss, font, xpos, ypos, "Fire", kFireCmd);
|
||||||
myFire->setTarget(this);
|
myFire->setTarget(this);
|
||||||
}
|
}
|
||||||
|
@ -60,16 +60,16 @@ DrivingWidget::DrivingWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void DrivingWidget::loadConfig()
|
void DrivingWidget::loadConfig()
|
||||||
{
|
{
|
||||||
uInt8 grey = 0;
|
uInt8 gray = 0;
|
||||||
if(myController.read(Controller::One)) grey += 1;
|
if(myController.read(Controller::One)) gray += 1;
|
||||||
if(myController.read(Controller::Two)) grey += 2;
|
if(myController.read(Controller::Two)) gray += 2;
|
||||||
|
|
||||||
for(myGreyIndex = 0; myGreyIndex < 4; ++myGreyIndex)
|
for(myGrayIndex = 0; myGrayIndex < 4; ++myGrayIndex)
|
||||||
if(ourGreyTable[myGreyIndex] == grey)
|
if(ourGrayTable[myGrayIndex] == gray)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
myFire->setState(!myController.read(Controller::Six));
|
myFire->setState(!myController.read(Controller::Six));
|
||||||
myGreyValue->setList(0, grey);
|
myGrayValue->setList(0, gray);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -78,17 +78,17 @@ void DrivingWidget::handleCommand(
|
||||||
{
|
{
|
||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
case kGreyUpCmd:
|
case kGrayUpCmd:
|
||||||
myGreyIndex = (myGreyIndex + 1) % 4;
|
myGrayIndex = (myGrayIndex + 1) % 4;
|
||||||
myController.set(Controller::One, (ourGreyTable[myGreyIndex] & 0x1) != 0);
|
myController.set(Controller::One, (ourGrayTable[myGrayIndex] & 0x1) != 0);
|
||||||
myController.set(Controller::Two, (ourGreyTable[myGreyIndex] & 0x2) != 0);
|
myController.set(Controller::Two, (ourGrayTable[myGrayIndex] & 0x2) != 0);
|
||||||
myGreyValue->setList(0, ourGreyTable[myGreyIndex]);
|
myGrayValue->setList(0, ourGrayTable[myGrayIndex]);
|
||||||
break;
|
break;
|
||||||
case kGreyDownCmd:
|
case kGrayDownCmd:
|
||||||
myGreyIndex = myGreyIndex == 0 ? 3 : myGreyIndex - 1;
|
myGrayIndex = myGrayIndex == 0 ? 3 : myGrayIndex - 1;
|
||||||
myController.set(Controller::One, (ourGreyTable[myGreyIndex] & 0x1) != 0);
|
myController.set(Controller::One, (ourGrayTable[myGrayIndex] & 0x1) != 0);
|
||||||
myController.set(Controller::Two, (ourGreyTable[myGreyIndex] & 0x2) != 0);
|
myController.set(Controller::Two, (ourGrayTable[myGrayIndex] & 0x2) != 0);
|
||||||
myGreyValue->setList(0, ourGreyTable[myGreyIndex]);
|
myGrayValue->setList(0, ourGrayTable[myGrayIndex]);
|
||||||
break;
|
break;
|
||||||
case kFireCmd:
|
case kFireCmd:
|
||||||
myController.set(Controller::Six, !myFire->getState());
|
myController.set(Controller::Six, !myFire->getState());
|
||||||
|
@ -97,4 +97,4 @@ void DrivingWidget::handleCommand(
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt8 DrivingWidget::ourGreyTable[4] = { 0x03, 0x01, 0x00, 0x02 };
|
uInt8 DrivingWidget::ourGrayTable[4] = { 0x03, 0x01, 0x00, 0x02 };
|
||||||
|
|
|
@ -35,17 +35,17 @@ class DrivingWidget : public ControllerWidget
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
kGreyUpCmd = 'DWup',
|
kGrayUpCmd = 'DWup',
|
||||||
kGreyDownCmd = 'DWdn',
|
kGrayDownCmd = 'DWdn',
|
||||||
kFireCmd = 'DWfr'
|
kFireCmd = 'DWfr'
|
||||||
};
|
};
|
||||||
ButtonWidget *myGreyUp, *myGreyDown;
|
ButtonWidget *myGrayUp, *myGrayDown;
|
||||||
DataGridWidget* myGreyValue;
|
DataGridWidget* myGrayValue;
|
||||||
CheckboxWidget* myFire;
|
CheckboxWidget* myFire;
|
||||||
|
|
||||||
int myGreyIndex;
|
int myGrayIndex;
|
||||||
|
|
||||||
static uInt8 ourGreyTable[4];
|
static uInt8 ourGrayTable[4];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadConfig() override;
|
void loadConfig() override;
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "KeyboardWidget.hxx"
|
#include "KeyboardWidget.hxx"
|
||||||
#include "AtariVoxWidget.hxx"
|
#include "AtariVoxWidget.hxx"
|
||||||
#include "SaveKeyWidget.hxx"
|
#include "SaveKeyWidget.hxx"
|
||||||
|
#include "AmigaMouseWidget.hxx"
|
||||||
|
|
||||||
#include "RiotWidget.hxx"
|
#include "RiotWidget.hxx"
|
||||||
|
|
||||||
|
@ -437,7 +438,8 @@ ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font&
|
||||||
switch(controller.type())
|
switch(controller.type())
|
||||||
{
|
{
|
||||||
case Controller::AmigaMouse: // TODO - implement this
|
case Controller::AmigaMouse: // TODO - implement this
|
||||||
return new NullControlWidget(boss, font, x, y, controller);
|
//return new NullControlWidget(boss, font, x, y, controller);
|
||||||
|
return new AmigaMouseWidget(boss, font, x, y, controller);
|
||||||
case Controller::AtariMouse: // TODO - implement this
|
case Controller::AtariMouse: // TODO - implement this
|
||||||
return new NullControlWidget(boss, font, x, y, controller);
|
return new NullControlWidget(boss, font, x, y, controller);
|
||||||
case Controller::AtariVox:
|
case Controller::AtariVox:
|
||||||
|
|
|
@ -44,9 +44,17 @@ void SaveKeyWidget::eraseAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool SaveKeyWidget::isPageDetected()
|
bool SaveKeyWidget::isUseDetected()
|
||||||
{
|
{
|
||||||
SaveKey& skey = static_cast<SaveKey&>(myController);
|
SaveKey& skey = static_cast<SaveKey&>(myController);
|
||||||
|
|
||||||
return skey.myEEPROM->isPageDetected();
|
return skey.myEEPROM->isUseDetected();
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool SaveKeyWidget::isPageUsed(int page)
|
||||||
|
{
|
||||||
|
SaveKey& skey = static_cast<SaveKey&>(myController);
|
||||||
|
|
||||||
|
return skey.myEEPROM->isPageUsed(page);
|
||||||
}
|
}
|
|
@ -31,13 +31,10 @@ class SaveKeyWidget : public FlashWidget
|
||||||
private:
|
private:
|
||||||
void loadConfig() override { }
|
void loadConfig() override { }
|
||||||
|
|
||||||
string getName()
|
|
||||||
{
|
|
||||||
return "SaveKey";
|
|
||||||
}
|
|
||||||
void eraseCurrent();
|
void eraseCurrent();
|
||||||
void eraseAll();
|
void eraseAll();
|
||||||
bool isPageDetected();
|
bool isUseDetected();
|
||||||
|
bool isPageUsed(int page);
|
||||||
|
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
SaveKeyWidget() = delete;
|
SaveKeyWidget() = delete;
|
||||||
|
|
|
@ -38,8 +38,8 @@ class AmigaMouse : public PointingDevice
|
||||||
protected:
|
protected:
|
||||||
uInt8 ioPortA(uInt8 countH, uInt8 countV, uInt8, uInt8) override
|
uInt8 ioPortA(uInt8 countH, uInt8 countV, uInt8, uInt8) override
|
||||||
{
|
{
|
||||||
static constexpr uInt32 ourTableH[4] = { 0x00, 0x80, 0xa0, 0x20 };
|
static constexpr uInt32 ourTableH[4] = { 0b0000, 0b1000, 0b1010, 0b0010 };
|
||||||
static constexpr uInt32 ourTableV[4] = { 0x00, 0x10, 0x50, 0x40 };
|
static constexpr uInt32 ourTableV[4] = { 0b0000, 0b0001, 0b0101, 0b0100 };
|
||||||
|
|
||||||
return ourTableH[countH] | ourTableV[countV];
|
return ourTableH[countH] | ourTableV[countV];
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,8 @@ class AtariMouse : public PointingDevice
|
||||||
protected:
|
protected:
|
||||||
uInt8 ioPortA(uInt8 countH, uInt8 countV, uInt8, uInt8) override
|
uInt8 ioPortA(uInt8 countH, uInt8 countV, uInt8, uInt8) override
|
||||||
{
|
{
|
||||||
static constexpr uInt32 ourTableH[4] = { 0x00, 0x10, 0x30, 0x20 };
|
static constexpr uInt32 ourTableH[4] = { 0b0000, 0b0001, 0b0011, 0b0010 };
|
||||||
static constexpr uInt32 ourTableV[4] = { 0x00, 0x80, 0xc0, 0x40 };
|
static constexpr uInt32 ourTableV[4] = { 0b0000, 0b1000, 0b1100, 0b0100 };
|
||||||
|
|
||||||
return ourTableH[countH] | ourTableV[countV];
|
return ourTableH[countH] | ourTableV[countV];
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ MT24LC256::MT24LC256(const string& filename, const System& system)
|
||||||
myDataFile(filename),
|
myDataFile(filename),
|
||||||
myDataFileExists(false),
|
myDataFileExists(false),
|
||||||
myDataChanged(false),
|
myDataChanged(false),
|
||||||
myPageDetected(false),
|
myUseDetected(false),
|
||||||
jpee_mdat(0),
|
jpee_mdat(0),
|
||||||
jpee_sdat(0),
|
jpee_sdat(0),
|
||||||
jpee_mclk(0),
|
jpee_mclk(0),
|
||||||
|
@ -151,7 +151,7 @@ void MT24LC256::systemReset()
|
||||||
myCyclesWhenSDASet = myCyclesWhenSCLSet = myCyclesWhenTimerSet =
|
myCyclesWhenSDASet = myCyclesWhenSCLSet = myCyclesWhenTimerSet =
|
||||||
mySystem.cycles();
|
mySystem.cycles();
|
||||||
|
|
||||||
myPageDetected = false;
|
myUseDetected = false;
|
||||||
memset(myPageHit, false, sizeof(myPageHit));
|
memset(myPageHit, false, sizeof(myPageHit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,6 +175,15 @@ void MT24LC256::eraseCurrent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
bool MT24LC256::isPageUsed(int page) const
|
||||||
|
{
|
||||||
|
if(page < PAGE_NUM)
|
||||||
|
return myPageHit[page];
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void MT24LC256::jpee_init()
|
void MT24LC256::jpee_init()
|
||||||
{
|
{
|
||||||
|
@ -243,7 +252,7 @@ void MT24LC256::jpee_data_stop()
|
||||||
for (int i=3; i<jpee_pptr; i++)
|
for (int i=3; i<jpee_pptr; i++)
|
||||||
{
|
{
|
||||||
myDataChanged = true;
|
myDataChanged = true;
|
||||||
myPageDetected = myPageHit[jpee_address / PAGE_SIZE] = true;
|
myUseDetected = myPageHit[jpee_address / PAGE_SIZE] = true;
|
||||||
myData[(jpee_address++) & jpee_sizemask] = jpee_packet[i];
|
myData[(jpee_address++) & jpee_sizemask] = jpee_packet[i];
|
||||||
if (!(jpee_address & jpee_pagemask))
|
if (!(jpee_address & jpee_pagemask))
|
||||||
break; /* Writes can't cross page boundary! */
|
break; /* Writes can't cross page boundary! */
|
||||||
|
@ -340,7 +349,7 @@ void MT24LC256::jpee_clock_fall()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
jpee_state=3;
|
jpee_state=3;
|
||||||
myPageDetected = myPageHit[jpee_address / PAGE_SIZE] = true;
|
myUseDetected = myPageHit[jpee_address / PAGE_SIZE] = true;
|
||||||
jpee_nb = (myData[jpee_address & jpee_sizemask] << 1) | 1; /* Fall through */
|
jpee_nb = (myData[jpee_address & jpee_sizemask] << 1) | 1; /* Fall through */
|
||||||
JPEE_LOG2("I2C_READ(%04X=%02X)",jpee_address,jpee_nb/2);
|
JPEE_LOG2("I2C_READ(%04X=%02X)",jpee_address,jpee_nb/2);
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
|
|
@ -42,7 +42,14 @@ class MT24LC256
|
||||||
MT24LC256(const string& filename, const System& system);
|
MT24LC256(const string& filename, const System& system);
|
||||||
~MT24LC256();
|
~MT24LC256();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Sizes of the EEPROM
|
||||||
|
static constexpr uInt32 FLASH_SIZE = 32 * 1024;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static constexpr uInt32 PAGE_SIZE = 64;
|
||||||
|
static constexpr uInt32 PAGE_NUM = FLASH_SIZE / PAGE_SIZE;
|
||||||
|
|
||||||
/** Read boolean data from the SDA line */
|
/** Read boolean data from the SDA line */
|
||||||
bool readSDA() const { return jpee_mdat && jpee_sdat; }
|
bool readSDA() const { return jpee_mdat && jpee_sdat; }
|
||||||
|
|
||||||
|
@ -60,10 +67,9 @@ class MT24LC256
|
||||||
void eraseCurrent();
|
void eraseCurrent();
|
||||||
|
|
||||||
/** Returns true if at least one EEPROM page has been detected for the current ROM */
|
/** Returns true if at least one EEPROM page has been detected for the current ROM */
|
||||||
bool isPageDetected()
|
bool isUseDetected() const { return myUseDetected; }
|
||||||
{
|
|
||||||
return myPageDetected;
|
bool isPageUsed(int page) const;
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// I2C access code provided by Supercat
|
// I2C access code provided by Supercat
|
||||||
|
@ -77,11 +83,6 @@ class MT24LC256
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Sizes of the EEPROM
|
|
||||||
static constexpr uInt32 FLASH_SIZE = 32 * 1024;
|
|
||||||
static constexpr uInt32 PAGE_SIZE = 64;
|
|
||||||
static constexpr uInt32 PAGE_NUM = FLASH_SIZE / PAGE_SIZE;
|
|
||||||
|
|
||||||
// Inital state value of flash EEPROM
|
// Inital state value of flash EEPROM
|
||||||
static constexpr uInt8 INIT_VALUE = 0xff;
|
static constexpr uInt8 INIT_VALUE = 0xff;
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@ class MT24LC256
|
||||||
|
|
||||||
// Track which pages are used
|
// Track which pages are used
|
||||||
bool myPageHit[PAGE_NUM];
|
bool myPageHit[PAGE_NUM];
|
||||||
bool myPageDetected;
|
bool myUseDetected;
|
||||||
|
|
||||||
// Cached state of the SDA and SCL pins on the last write
|
// Cached state of the SDA and SCL pins on the last write
|
||||||
bool mySDA, mySCL;
|
bool mySDA, mySCL;
|
||||||
|
|
|
@ -66,17 +66,17 @@ uInt8 PointingDevice::read()
|
||||||
myScanCountV += myTrackBallLinesV;
|
myScanCountV += myTrackBallLinesV;
|
||||||
}
|
}
|
||||||
|
|
||||||
myCountH &= 0x03;
|
myCountH &= 0b11;
|
||||||
myCountV &= 0x03;
|
myCountV &= 0b11;
|
||||||
|
|
||||||
uInt8 portA = ioPortA(myCountH, myCountV, myTrackBallLeft, myTrackBallDown);
|
uInt8 portA = ioPortA(myCountH, myCountV, myTrackBallLeft, myTrackBallDown);
|
||||||
|
|
||||||
myDigitalPinState[One] = portA & 0x10;
|
myDigitalPinState[One] = portA & 0b0001;
|
||||||
myDigitalPinState[Two] = portA & 0x20;
|
myDigitalPinState[Two] = portA & 0b0010;
|
||||||
myDigitalPinState[Three] = portA & 0x40;
|
myDigitalPinState[Three] = portA & 0b0100;
|
||||||
myDigitalPinState[Four] = portA & 0x80;
|
myDigitalPinState[Four] = portA & 0b1000;
|
||||||
|
|
||||||
return (portA >> 4);
|
return portA;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
class Controller;
|
class Controller;
|
||||||
class Event;
|
class Event;
|
||||||
|
|
||||||
|
#include "Control.hxx"
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,6 +32,8 @@ class Event;
|
||||||
*/
|
*/
|
||||||
class PointingDevice : public Controller
|
class PointingDevice : public Controller
|
||||||
{
|
{
|
||||||
|
friend class TrackBallWidget;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PointingDevice(Jack jack, const Event& event,
|
PointingDevice(Jack jack, const Event& event,
|
||||||
const System& system, Controller::Type type,
|
const System& system, Controller::Type type,
|
||||||
|
|
|
@ -38,8 +38,10 @@ class TrakBall : public PointingDevice
|
||||||
protected:
|
protected:
|
||||||
uInt8 ioPortA(uInt8 countH, uInt8 countV, uInt8 left, uInt8 down) override
|
uInt8 ioPortA(uInt8 countH, uInt8 countV, uInt8 left, uInt8 down) override
|
||||||
{
|
{
|
||||||
static constexpr uInt32 ourTableH[2][2] = {{ 0x00, 0x10 }, { 0x20, 0x30 }};
|
//static constexpr uInt32 ourTableH[2][2] = {{ 0x00, 0x10 }, { 0x20, 0x30 }};
|
||||||
static constexpr uInt32 ourTableV[2][2] = {{ 0x40, 0x00 }, { 0xc0, 0x80 }};
|
//static constexpr uInt32 ourTableV[2][2] = {{ 0x40, 0x00 }, { 0xc0, 0x80 }};
|
||||||
|
static constexpr uInt32 ourTableH[2][2] = { { 0b00, 0b01 },{ 0b10, 0b11 } };
|
||||||
|
static constexpr uInt32 ourTableV[2][2] = { { 0b0100, 0b0000 },{ 0b1100, 0b1000 } };
|
||||||
|
|
||||||
return ourTableH[countH & 0x01][left] | ourTableV[countV & 0x01][down];
|
return ourTableH[countH & 0x01][left] | ourTableV[countV & 0x01][down];
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include "FlashWidget.hxx"
|
#include "FlashWidget.hxx"
|
||||||
|
#include "MT24LC256.hxx"
|
||||||
|
#include "Base.hxx"
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
FlashWidget::FlashWidget(GuiObject* boss, const GUI::Font& font,
|
FlashWidget::FlashWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
|
@ -31,11 +33,23 @@ void FlashWidget::init(GuiObject* boss, const GUI::Font& font, int x, int y)
|
||||||
int xpos = x, ypos = y;
|
int xpos = x, ypos = y;
|
||||||
|
|
||||||
bool leftport = myController.jack() == Controller::Left;
|
bool leftport = myController.jack() == Controller::Left;
|
||||||
new StaticTextWidget(boss, font, xpos, ypos + 2, (leftport ? "Left (" : "Right (") + getName() + ")");
|
new StaticTextWidget(boss, font, xpos, ypos + 2, (leftport ? "Left (" : "Right (") + myController.name() + ")");
|
||||||
|
|
||||||
ypos += lineHeight + 8;
|
ypos += lineHeight + 6;
|
||||||
|
|
||||||
myEEPROMEraseCurrent = new ButtonWidget(boss, font, xpos, ypos,
|
new StaticTextWidget(boss, ifont, xpos, ypos, "Pages/Ranges used:");
|
||||||
|
|
||||||
|
ypos += lineHeight + 2;
|
||||||
|
xpos += 8;
|
||||||
|
|
||||||
|
for(int page = 0; page < MAX_PAGES; page++)
|
||||||
|
{
|
||||||
|
myPage[page] = new StaticTextWidget(boss, ifont, xpos, ypos,
|
||||||
|
page ? " " : "none ");
|
||||||
|
ypos += lineHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*myEEPROMEraseCurrent = new ButtonWidget(boss, font, xpos, ypos,
|
||||||
"Erase EEPROM range", kEEPROMEraseCurrent);
|
"Erase EEPROM range", kEEPROMEraseCurrent);
|
||||||
myEEPROMEraseCurrent->setTarget(this);
|
myEEPROMEraseCurrent->setTarget(this);
|
||||||
ypos += lineHeight + 8;
|
ypos += lineHeight + 8;
|
||||||
|
@ -54,7 +68,7 @@ void FlashWidget::init(GuiObject* boss, const GUI::Font& font, int x, int y)
|
||||||
ypos += iLineHeight;
|
ypos += iLineHeight;
|
||||||
new StaticTextWidget(boss, ifont, xpos, ypos, "all EEPROM data!");
|
new StaticTextWidget(boss, ifont, xpos, ypos, "all EEPROM data!");
|
||||||
|
|
||||||
updateButtonState();
|
updateButtonState();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -71,11 +85,44 @@ void FlashWidget::handleCommand(CommandSender*, int cmd, int, int)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FlashWidget::drawWidget(bool hilite)
|
void FlashWidget::drawWidget(bool hilite)
|
||||||
{
|
{
|
||||||
updateButtonState();
|
int useCount = 0, startPage = -1;
|
||||||
|
for(int page = 0; page < MT24LC256::PAGE_NUM; page++)
|
||||||
|
{
|
||||||
|
if(isPageUsed(page)/* || page == 0x21 || page == 0x22*/)
|
||||||
|
{
|
||||||
|
if (startPage == -1)
|
||||||
|
startPage = page;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(startPage != -1)
|
||||||
|
{
|
||||||
|
int from = startPage * MT24LC256::PAGE_SIZE;
|
||||||
|
int to = page * MT24LC256::PAGE_SIZE - 1;
|
||||||
|
ostringstream label;
|
||||||
|
|
||||||
|
label.str("");
|
||||||
|
label << Common::Base::HEX3 << startPage;
|
||||||
|
|
||||||
|
if(page -1 != startPage)
|
||||||
|
label << "-" << Common::Base::HEX3 << page - 1;
|
||||||
|
else
|
||||||
|
label << " ";
|
||||||
|
label << ": " << Common::Base::HEX4 << from << "-" << Common::Base::HEX4 << to;
|
||||||
|
|
||||||
|
myPage[useCount]->setLabel(label.str());
|
||||||
|
|
||||||
|
startPage = -1;
|
||||||
|
if(++useCount == MAX_PAGES)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//updateButtonState();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void FlashWidget::updateButtonState()
|
void FlashWidget::updateButtonState()
|
||||||
{
|
{
|
||||||
myEEPROMEraseCurrent->setEnabled(isPageDetected());
|
//myEEPROMEraseCurrent->setEnabled(isUseDetected());
|
||||||
}
|
}
|
|
@ -43,15 +43,18 @@ private:
|
||||||
kEEPROMEraseCurrent = 'eeEC'
|
kEEPROMEraseCurrent = 'eeEC'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static constexpr uInt32 MAX_PAGES = 7;
|
||||||
|
StaticTextWidget* myPage[MAX_PAGES];
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadConfig() override {}
|
void loadConfig() override {}
|
||||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||||
void updateButtonState();
|
void updateButtonState();
|
||||||
|
|
||||||
virtual string getName() = 0;
|
|
||||||
virtual void eraseCurrent() = 0;
|
virtual void eraseCurrent() = 0;
|
||||||
virtual void eraseAll() = 0;
|
virtual void eraseAll() = 0;
|
||||||
virtual bool isPageDetected() = 0;
|
virtual bool isUseDetected() = 0;
|
||||||
|
virtual bool isPageUsed(int page) = 0;
|
||||||
|
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
FlashWidget() = delete;
|
FlashWidget() = delete;
|
||||||
|
|
|
@ -331,6 +331,7 @@
|
||||||
<ClCompile Include="..\gui\JoystickDialog.cxx" />
|
<ClCompile Include="..\gui\JoystickDialog.cxx" />
|
||||||
<ClCompile Include="..\gui\LoggerDialog.cxx" />
|
<ClCompile Include="..\gui\LoggerDialog.cxx" />
|
||||||
<ClCompile Include="..\gui\SnapshotDialog.cxx" />
|
<ClCompile Include="..\gui\SnapshotDialog.cxx" />
|
||||||
|
<ClCompile Include="AmigaMouseWidget.cxx" />
|
||||||
<ClCompile Include="FlashWidget.cxx" />
|
<ClCompile Include="FlashWidget.cxx" />
|
||||||
<ClCompile Include="FSNodeWINDOWS.cxx" />
|
<ClCompile Include="FSNodeWINDOWS.cxx" />
|
||||||
<ClCompile Include="OSystemWINDOWS.cxx" />
|
<ClCompile Include="OSystemWINDOWS.cxx" />
|
||||||
|
@ -491,6 +492,7 @@
|
||||||
<ClCompile Include="..\libpng\pngwtran.c" />
|
<ClCompile Include="..\libpng\pngwtran.c" />
|
||||||
<ClCompile Include="..\libpng\pngwutil.c" />
|
<ClCompile Include="..\libpng\pngwutil.c" />
|
||||||
<ClCompile Include="StateList.cxx" />
|
<ClCompile Include="StateList.cxx" />
|
||||||
|
<ClCompile Include="TrackBallWidget.cxx" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\common\Base.hxx" />
|
<ClInclude Include="..\common\Base.hxx" />
|
||||||
|
@ -621,6 +623,7 @@
|
||||||
<ClInclude Include="..\libpng\pnginfo.h" />
|
<ClInclude Include="..\libpng\pnginfo.h" />
|
||||||
<ClInclude Include="..\libpng\pnglibconf.h" />
|
<ClInclude Include="..\libpng\pnglibconf.h" />
|
||||||
<ClInclude Include="..\libpng\pngstruct.h" />
|
<ClInclude Include="..\libpng\pngstruct.h" />
|
||||||
|
<ClInclude Include="AmigaMouseWidget.hxx" />
|
||||||
<ClInclude Include="FlashWidget.hxx" />
|
<ClInclude Include="FlashWidget.hxx" />
|
||||||
<ClInclude Include="FSNodeWINDOWS.hxx" />
|
<ClInclude Include="FSNodeWINDOWS.hxx" />
|
||||||
<ClInclude Include="HomeFinder.hxx" />
|
<ClInclude Include="HomeFinder.hxx" />
|
||||||
|
@ -786,6 +789,7 @@
|
||||||
<ClInclude Include="..\libpng\pngconf.h" />
|
<ClInclude Include="..\libpng\pngconf.h" />
|
||||||
<ClInclude Include="..\libpng\pngpriv.h" />
|
<ClInclude Include="..\libpng\pngpriv.h" />
|
||||||
<ClInclude Include="StateList.hxx" />
|
<ClInclude Include="StateList.hxx" />
|
||||||
|
<ClInclude Include="TrackBallWidget.hxx" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="stella.ico" />
|
<None Include="stella.ico" />
|
||||||
|
|
|
@ -843,8 +843,14 @@
|
||||||
<ClCompile Include="StateList.cxx">
|
<ClCompile Include="StateList.cxx">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="TrackBallWidget.cxx">
|
||||||
|
<Filter>Source Files\debugger</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="FlashWidget.cxx">
|
<ClCompile Include="FlashWidget.cxx">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files\debugger</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="AmigaMouseWidget.cxx">
|
||||||
|
<Filter>Source Files\debugger</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1725,7 +1731,13 @@
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="FlashWidget.hxx">
|
<ClInclude Include="FlashWidget.hxx">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files\debugger</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="TrackBallWidget.hxx">
|
||||||
|
<Filter>Header Files\debugger</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="AmigaMouseWidget.hxx">
|
||||||
|
<Filter>Header Files\debugger</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Loading…
Reference in New Issue