So I have figured one thing out.
The more I work on the AFP, the less I sleep. At least that’s how it’s been over the last two nights. Two nights ago it was 3am, last night it was after 2am.
Ideas come and go with me.
I’ve completely scrapped the token idea. After a couple dry runs with some amiga floppies, it seems like the density of “10”s seem to be much more popular than 100, or 1000’s. I guess I could have told you that looking at a scope. But anyways, I had a lot of trouble getting the idea to work, and suffice to say, I quickly abandoned it. The point is that the tokens were saving me about 400 bytes or so on average(about 3%), not the grand 50% or whatever I had imagined.
This also avoids unnecessary complexity.
So the current read routine times the difference between the pulses and then writes a ’10’, ‘100’, or ‘1000’ to the FRAM. I manually write out the bits for each grouping…… no loops or anything. And plus I take advantage of the fact that the output bit, once changed to 0 really doesn’t need to change. So basically write a 1, clock, write a 0, clock, clock, clock for the 1000.
I successfully read a floppy last night using this method, so at least my concept is stable. This still eliminates interrupts completely (edge and timed) and eliminates the ISR, etc. Definitely getting a little more robust. Now, will it actually help me read more floppies? I don’t know. I think the next step is to start documenting HOW these floppies are failing if I can tell.
I was having a few goofy problems last night, which I think were mostly related to flow-control. I was using putty without f.c. and my SX appeared to lockup — it wouldn’t echo commands or the actual track. Turned off flow control completely, and it started working. I don’t know if putty handles the dtr/dsr flow control properly. or should I say I’m not sure if the FTDI VCP drivers support DTR/DSR flow control. I think they do because I think I tested it in Windows under C++ earlier.
The other goofy problem I was having was related to my code spontaneously restarting. I think it was related to using JMP’s and not using the @ before the address. The @ causes a PAGE to be inserted before the jump. Now I don’t know if this is true for other CJxx commands etc.
I also saw a bunch of transfer checksum errors, but I think that’s related to the number of bytes being received. I think I have to use the beginning delimiter FF FF effectively, and stop using an absolute offset for start of frame etc.