Improved compatability for the Neon loader.

This commit is contained in:
Stephen White 2019-04-28 15:27:15 +10:00
parent 65893c857c
commit 809722750a
3 changed files with 29 additions and 19 deletions

View File

@ -20,6 +20,8 @@
static int buttonCount = sizeof(ButtonPinFlags) / sizeof(unsigned);
u32 IEC_Bus::oldClears = 0;
u32 IEC_Bus::oldSets = 0;
u32 IEC_Bus::PIGPIO_MASK_IN_ATN = 1 << PIGPIO_ATN;
u32 IEC_Bus::PIGPIO_MASK_IN_DATA = 1 << PIGPIO_DATA;
u32 IEC_Bus::PIGPIO_MASK_IN_CLOCK = 1 << PIGPIO_CLOCK;
@ -72,7 +74,6 @@ unsigned IEC_Bus::gplev0;
void IEC_Bus::ReadBrowseMode(void)
{
IOPort* portB = 0;
gplev0 = read32(ARM_GPIO_GPLEV0);
int index;
@ -87,9 +88,6 @@ void IEC_Bus::ReadBrowseMode(void)
PI_Atn = ATNIn;
}
if (portB && (portB->GetDirection() & 0x10) == 0)
AtnaDataSetToOut = false; // If the ATNA PB4 gets set to an input then we can't be pulling data low. (Maniac Mansion does this)
if (!AtnaDataSetToOut && !DataSetToOut) // only sense if we have not brought the line low (because we can't as we have the pin set to output but we can simulate in software)
{
bool DATAIn = (gplev0 & PIGPIO_MASK_IN_DATA) == (invertIECInputs ? PIGPIO_MASK_IN_DATA : 0);
@ -311,8 +309,16 @@ void IEC_Bus::RefreshOuts1541(void)
if (OutputSound) set |= 1 << PIGPIO_OUT_SOUND;
else clear |= 1 << PIGPIO_OUT_SOUND;
write32(ARM_GPIO_GPCLR0, clear);
write32(ARM_GPIO_GPSET0, set);
if (oldClears != clear)
{
write32(ARM_GPIO_GPCLR0, clear);
oldClears = clear;
}
if (oldSets != set)
{
write32(ARM_GPIO_GPSET0, set);
oldSets = set;
}
}
void IEC_Bus::PortB_OnPortOut(void* pUserData, unsigned char status)

View File

@ -495,7 +495,7 @@ public:
static inline bool IsClockReleased() { return !PI_Clock; }
static inline bool GetPI_Reset() { return PI_Reset; }
static inline bool IsDataSetToOut() { return DataSetToOut; }
static inline bool IsAtnaDataSetToOut() { return AtnaDataSetToOut; }
//static inline bool IsAtnaDataSetToOut() { return AtnaDataSetToOut; }
static inline bool IsClockSetToOut() { return ClockSetToOut; }
static inline bool IsReset() { return Resetting; }
@ -595,6 +595,9 @@ public:
static bool OutputSound;
private:
static u32 oldClears;
static u32 oldSets;
static bool splitIECLines;
static bool invertIECInputs;
static bool invertIECOutputs;

View File

@ -686,7 +686,6 @@ EXIT_TYPE Emulate1541(FileBrowser* fileBrowser)
while (exitReason == EXIT_UNKNOWN)
{
IEC_Bus::ReadEmulationMode1541();
if (pi1541.m6502.SYNC()) // About to start a new instruction.
{
@ -750,6 +749,16 @@ EXIT_TYPE Emulate1541(FileBrowser* fileBrowser)
}
}
if (options.SoundOnGPIO() && headSoundCounter > 0)
{
headSoundFreqCounter--; // Continue updating a GPIO non DMA sound.
if (headSoundFreqCounter <= 0)
{
headSoundFreqCounter = headSoundFreq;
headSoundCounter -= headSoundFreq * 8;
IEC_Bus::OutputSound = !IEC_Bus::OutputSound;
}
}
}
@ -802,17 +811,9 @@ EXIT_TYPE Emulate1541(FileBrowser* fileBrowser)
} while (ctAfter == ctBefore);
}
ctBefore = ctAfter;
if (options.SoundOnGPIO() && headSoundCounter > 0)
{
headSoundFreqCounter--; // Continue updating a GPIO non DMA sound.
if (headSoundFreqCounter <= 0)
{
headSoundFreqCounter = headSoundFreq;
headSoundCounter -= headSoundFreq * 8;
IEC_Bus::OutputSound = !IEC_Bus::OutputSound;
}
}
IEC_Bus::ReadEmulationMode1541();
if (cycleCount >= FAST_BOOT_CYCLES) // cycleCount is used so we can quickly get through 1541's self test code. This will make the emulated 1541 responsive to commands asap. During this time we don't need to set outputs.
IEC_Bus::RefreshOuts1541(); // Now output all outputs.
if (numberOfImages > 1)
{