Skip to content

Commit

Permalink
Merge pull request #628 from FozzTexx/master
Browse files Browse the repository at this point in the history
Restore ATN fix, don't hang on load
  • Loading branch information
tschak909 committed Jul 6, 2023
2 parents 214635e + 9aae66e commit b1a6ee2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions lib/bus/iec/iec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ void systemBus::read_command()
//Debug_printv("stabalize!");
//protocol->wait ( TIMING_STABLE );

//} while ( IEC.flags & ATN_PULLED );
} while ( status( PIN_IEC_ATN ) == PULLED );
} while ( IEC.flags & ATN_PULLED );
//} while ( status( PIN_IEC_ATN ) == PULLED );

// Is this command for us?
if ( !isDeviceEnabled( data.device ) )
Expand Down Expand Up @@ -351,7 +351,11 @@ void systemBus::read_payload()

// ATN might get pulled right away if there is no command string to send
//pull ( PIN_IEC_SRQ );
protocol->wait( TIMING_STABLE );

/* Sometimes ATN isn't released immediately. Wait for ATN to be
released before trying to read payload. Long ATN delay (>1.5ms)
seems to occur more frequently with VIC-20. */
protocol->timeoutWait(PIN_IEC_ATN, RELEASED, FOREVER);

while (IEC.status(PIN_IEC_ATN) != PULLED)
{
Expand Down
6 changes: 3 additions & 3 deletions lib/bus/iec/protocol/iecProtocolSerial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,11 @@ int16_t IecProtocolSerial::receiveByte()
// happened. If EOI was sent or received in this last transmission, both talker and listener "letgo." After a suitable pause,
// the Clock and Data lines are RELEASED to false and transmission stops.

if ( IEC.flags & EOI_RECVD
if ( (IEC.flags & EOI_RECVD)
&& wait ( TIMING_Tfr )
&& (IEC.status( PIN_IEC_ATN ) == RELEASED) )
{
IEC.release ( PIN_IEC_DATA_OUT );
IEC.release ( PIN_IEC_DATA_OUT );
}

timeoutWait( PIN_IEC_CLK_IN, RELEASED, TIMING_Tbb);
Expand Down Expand Up @@ -409,4 +409,4 @@ int16_t IecProtocolSerial::receiveBits ()



#endif
#endif

0 comments on commit b1a6ee2

Please sign in to comment.