+karri Posted August 21, 2014 Share Posted August 21, 2014 (edited) Reading comments in another thread I realized that when Lynx is sending only the send interrupt is active. After the message has been sent the receiver is allowed to interrupt again. This may be a logical flaw that makes reliable communication impossible or at least very difficult. Perhaps the sending should read the sent byte before it sends the next byte and if the byte was garbled the transmission would abort with a collision error. Perhaps the sending code @tx_irq: ldx TxPtrOut ; Has all bytes been sent? cpx TxPtrIn beq @allSent lda TxBuffer,x ; Send next byte sta SERDAT inc TxPtrOut could be replaced by something like if (a byte was recently sent by me) { read the byte if (it was not equal) { there was a collision abort mission } } send a byte mark that a byte was sent by me I also noticed that sending does not appear to start before Lynx receives a character. Obviously the Lynx PUT routine should generate a sending buffer empty interrupt to get the thing going. Comments? -- Karri Edited August 21, 2014 by karri Quote Link to comment Share on other sites More sharing options...
Songbird Posted August 22, 2014 Share Posted August 22, 2014 Wouldn't you only run into collisions when first detecting other players? Because once you've negotiated all the players, you could send in sequence and thus a given player would never broadcast until his turn arrived. Quote Link to comment Share on other sites More sharing options...
+karri Posted August 22, 2014 Author Share Posted August 22, 2014 Makes sense. Besides, thanks for the sources. There is one very interesting and clever approach. When you stop sending a sequence of characters and switch the interrupts back to RX you also read the last byte. If the last byte is different from what you sent you had a collision while writing. There can always be breaks because interference, bad connections... Quote Link to comment Share on other sites More sharing options...
Songbird Posted August 22, 2014 Share Posted August 22, 2014 Agreed. The idea of checking the last byte is a good one, as a fairly reliable way of detecting an issue. But basically, I would not expect ComLynx to be robust enough to survive such situations. Unless they happen frequently in actual games, I suppose... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.