Open btb opened 1 year ago
It's worth looking harder at the protocol reaction here - the idea is supposed to be that the client only advances to the next block when it knows the "current" one is successful. So it may be the case that it's not getting it right in this situation (it's been ages since I looked at it). I'm not in a position to dig into it now, so if you want to use this as an opportunity to sharpen your assembly skills, feel free to dive in!
Yeah, I tried a few hacks by modifying the program in the machine language monitor, but didn't hit on anything that really worked. Basically as far as the client is concerned, it was successful, so there's no mechanism for back-tracking once the ACK is sent. Unfortunately the server never gets the message and treats it the same as a NACK
Eventually I worked around it by changing the server to treat the garbage/timeout the same as a successful ACK.
Very weird that my setup is doing this so consistently (bad ACK every hundred kilobytes or so). Could be a hardware problem with my Apple II+, maybe power supply going bad and the cassette output driver is the first thing to start dropping out?
Fortunate problem to have if you want to catch bugs like this I suppose!
There are some interesting interactions with audio (feedback?) that maybe sets up some sort of waveform that confuses everyone, so we get into these failure modes based on some particular data patterns. Sometimes changing the block count (i.e. shifting down to one) will change the outcome, even if it makes it overall slower.
Speaking of reproducibility - do you have an image you can attach that causes the problem? That would be nice to have for posterity.
I think the one I was trying at the time of the trace was Oregon Trail from here: http://www.mecc.co/software/apple-ii/the-oregon-trail---a-157/ OT.zip
Yikes, that site is scary-bad. Here are the images so no one else has to go there: testdisks.zip
Another user has run into the same problem in the IP transport, so I started digging. It does look like there's a bug in the protocol implementation that is common to all, and it's that a NAK leaves us with an incremented block count even though it shouldn't. I've got a test client available if you want to give it a shot. ADTPRO-v.r.m.DSK.zip
Also, we're discussing this issue in slack if you want to join (https://apple2.gs/slack) and the channel is https://apple2infinitum.slack.com/archives/C048MF00ZQX .
I'm using ADTPro over audio, and having a hard time receiving disks. It seems like any time there is a single failed ACK, the whole transfer will be aborted.
Looking at the trace, everything goes fine, until some random point, we are sending blocks, in this case beginning with 007C:
Then, instead of the client ACK, we get what looks like garbage, so the server re-sends those blocks:
Now, we get an ACK from the client, but it seems to have no idea we're sending an old block. After a couple retries, the host aborts:
So it seems like the client is completely unaware there was ever a problem?
I'm very new to 6502 assembly, but I think maybe part of the problem is in
RECVWIDE
ofclient/src/prodos/audio/audproto.asm
, - where the block number as sent by the host is put into HOSTBLX, but I think this is never used for actually controlling where the client is in the receive process.