On 02/22/2013 07:24 PM, Jules Richardson wrote:
[1] hmm, although I could just zero out the problem
packets and see if that
stops it happening, I suppose. Will report back.
Well... that's confusing! It seems that it's not a particular sequence of
data as such; it stalls when the packet checksum byte read from the sender
happens to be 19d - which is XOFF.
What I don't get is that my packet read code is basically:
/// read packet sequence and "anti-sequence" bytes prior
to this using byte(3) ///
260 cksum = 0
270 for i = 0 to 127 step 1
280 poke &A000 + i, byte(3)
290 cksum = cksum + db
300 next i
310 cksum = cksum AND 255
320 ckr = byte(3)
/// see if computed and read checksums match at this
point; send ACK or NAK to the sender accordingly. ///
('byte(3)' is just a blocking call which returns the next byte
from the QX10's serial port. The pokes are to an area of mem I
set aside for a receive buffer).
There's no difference in the way I read packet sequence numbers, packet
data, and the checksum byte - it's all done using byte(3) calls - and yet
the presence of an XOFF char within the sequence byte (i.e. receiving
packet #19) or within the packet's actual data doesn't cause a problem, but
it does when #19 happens to be sent as the checksum byte.
It's boggling my brain... it seems more like a problem on the sender's side
(i.e. the sender is doing something abnormal when sending 19d as a checksum
byte that it doesn't do when sending 19d at other times) - but I'm using
the stock linux 'sx' command, which I thought had been around for pretty
much as long as linux has, and so surely something as fundamental as this
would have been found and fixed years ago...
cheers
Jules