Add invertIECOutputs and ignoreReset options

This commit is contained in:
Alexander Kovalenko 2018-05-27 01:55:17 +03:00
parent c0f06e33e2
commit 78fa906846
5 changed files with 52 additions and 3 deletions

View file

@ -44,6 +44,8 @@ bool IEC_Bus::Resetting = false;
bool IEC_Bus::splitIECLines = false;
bool IEC_Bus::invertIECInputs = false;
bool IEC_Bus::invertIECOutputs = true;
bool IEC_Bus::ignoreReset = false;
u32 IEC_Bus::myOutsGPFSEL1 = 0;
u32 IEC_Bus::myOutsGPFSEL0 = 0;
@ -122,5 +124,5 @@ void IEC_Bus::Read(void)
if (VIA) portB->SetInput(VIAPORTPINS_CLOCKIN, true); // simulate the read in software
}
Resetting = (gplev0 & PIGPIO_MASK_IN_RESET) == (invertIECInputs ? PIGPIO_MASK_IN_RESET : 0);
Resetting = !ignoreReset && ((gplev0 & PIGPIO_MASK_IN_RESET) == (invertIECInputs ? PIGPIO_MASK_IN_RESET : 0));
}

View file

@ -336,7 +336,8 @@ public:
do
{
gplev0 = read32(ARM_GPIO_GPLEV0);
Resetting = (gplev0 & PIGPIO_MASK_IN_RESET) == (invertIECInputs ? PIGPIO_MASK_IN_RESET : 0);
Resetting = !ignoreReset && ((gplev0 & PIGPIO_MASK_IN_RESET) == \
(invertIECInputs ? PIGPIO_MASK_IN_RESET : 0));
if (Resetting)
IEC_Bus::WaitMicroSeconds(100);
@ -395,6 +396,7 @@ public:
{
unsigned set = 0;
unsigned clear = 0;
unsigned tmp;
if (!splitIECLines)
{
@ -408,11 +410,19 @@ public:
}
else
{
clear |= 1 << PIGPIO_OUT_ATN;
if (AtnaDataSetToOut || DataSetToOut) set |= 1 << PIGPIO_OUT_DATA;
else clear |= 1 << PIGPIO_OUT_DATA;
if (ClockSetToOut) set |= 1 << PIGPIO_OUT_CLOCK;
else clear |= 1 << PIGPIO_OUT_CLOCK;
if (!invertIECOutputs) {
tmp = set;
set = clear;
clear = tmp;
}
}
if (OutputLED) set |= 1 << PIGPIO_OUT_LED;
@ -477,6 +487,7 @@ public:
RefreshOuts();
}
}
static inline bool GetPI_Atn() { return PI_Atn; }
static inline bool IsAtnAsserted() { return PI_Atn; }
static inline bool IsAtnReleased() { return !PI_Atn; }
@ -526,6 +537,16 @@ public:
}
}
static inline void SetInvertIECOutputs(bool value)
{
invertIECOutputs = value;
}
static inline void SetIgnoreReset(bool value)
{
ignoreReset = value;
}
// CA1 input ATN
// If CA1 is ever set to output
// - CA1 will start to drive pb7
@ -570,6 +591,9 @@ public:
private:
static bool splitIECLines;
static bool invertIECInputs;
static bool invertIECOutputs;
static bool ignoreReset;
static u32 PIGPIO_MASK_IN_ATN;
static u32 PIGPIO_MASK_IN_DATA;
static u32 PIGPIO_MASK_IN_CLOCK;

View file

@ -96,7 +96,9 @@ bool quickBoot = false;
bool displayPNGIcons = false;
bool soundOnGPIO = false;
bool invertIECInputs = false;
bool invertIECOutputs = true;
bool splitIECLines = false;
bool ignoreReset = false;
const char* termainalTextRed = "\E[31m";
const char* termainalTextNormal = "\E[0m";
@ -958,10 +960,11 @@ static void LoadOptions()
displayPNGIcons = options.DisplayPNGIcons();
soundOnGPIO = options.SoundOnGPIO();
invertIECInputs = options.InvertIECInputs();
invertIECOutputs = options.InvertIECOutputs();
splitIECLines = options.SplitIECLines();
if (!splitIECLines)
invertIECInputs = false;
ignoreReset = options.IgnoreReset();
ROMName = options.GetRomFontName();
if (ROMName)
@ -1096,6 +1099,8 @@ extern "C"
IEC_Bus::SetSplitIECLines(splitIECLines);
IEC_Bus::SetInvertIECInputs(invertIECInputs);
IEC_Bus::SetInvertIECOutputs(invertIECOutputs);
IEC_Bus::SetIgnoreReset(ignoreReset);
if (!soundOnGPIO)
{

View file

@ -129,7 +129,9 @@ Options::Options(void)
, displayPNGIcons(0)
, soundOnGPIO(0)
, invertIECInputs(0)
, invertIECOutputs(1)
, splitIECLines(0)
, ignoreReset(0)
{
strcpy(ROMFontName, "chargen");
ROMName[0] = 0;
@ -212,12 +214,24 @@ void Options::Process(char* buffer)
if ((nValue = GetDecimal(pValue)) != INVALID_VALUE)
invertIECInputs = nValue;
}
else if (strcasecmp(pOption, "invertIECOutputs") == 0)
{
unsigned nValue = 0;
if ((nValue = GetDecimal(pValue)) != INVALID_VALUE)
invertIECOutputs = nValue;
}
else if (strcasecmp(pOption, "splitIECLines") == 0)
{
unsigned nValue = 0;
if ((nValue = GetDecimal(pValue)) != INVALID_VALUE)
splitIECLines = nValue;
}
else if (strcasecmp(pOption, "ignoreReset") == 0)
{
unsigned nValue = 0;
if ((nValue = GetDecimal(pValue)) != INVALID_VALUE)
ignoreReset = nValue;
}
else if ((strcasecmp(pOption, "Font") == 0))
{
strncpy(ROMFontName, pValue, 255);

View file

@ -58,6 +58,8 @@ public:
unsigned int SoundOnGPIO() const { return soundOnGPIO; }
unsigned int SplitIECLines() const { return splitIECLines; }
unsigned int InvertIECInputs() const { return invertIECInputs; }
unsigned int InvertIECOutputs() const { return invertIECOutputs; }
unsigned int IgnoreReset() const { return ignoreReset; }
static unsigned GetDecimal(char* pString);
@ -72,7 +74,9 @@ private:
unsigned int displayPNGIcons;
unsigned int soundOnGPIO;
unsigned int invertIECInputs;
unsigned int invertIECOutputs;
unsigned int splitIECLines;
unsigned int ignoreReset;
char ROMFontName[256];
char ROMName[256];