This is what I figured.ijor wrote:Ah, I think I understand what is going on.phsstpok wrote:The program is failing at direct reads of the tape. These are in the form of GET #U3, variable (U3 being itself a variable for the file number). The program is doing these reads in a For..Next loop. I would think timing for this would be critical. Difficult using a real tape never mind simulating it on a virtual tape..
First, the (possible) solution, then the explanation. I assume you can recover all three parts successfully. You will need to increase the inter-record-gap on all the blocks of the second part. The inter-record-gap (IRG) is the pause (gap) between each record. You can use a WAVE editor to patch the WAV, or an hex editor to patch the CAS file.
What happens is the following: The Atari OS has two different modes for reading/writing cassettes. One is with a short IRG, other with long IRG. When you load/save a basic file with CLOAD/CSAVE you select the short/fast mode. When you use LOAD “C:”/SAVE “C:” you select the long/slow mode. The slow mode doesn’t just increase the IRG, it actually pauses the tape between each record. Actually the long IRG is done only for the purpose of allowing the stop/start of the tape.
When loading a file recorded with fast mode, everything must be done fast enough. This is because the tape is not stopped. But when using the slow mode you have all the time of the world. After the OS reads a full record, is stops the tape and save the record in a memory buffer. In the meantime, there is no rush, the tape is stopped.
If you try to read a file byte by byte in BASIC, using “GET,#”, this is very slow. It must be done in slow mode. The problem you are seeing, is again, the lack of the motor control signal on the SIO2PC interface. Because the PC never pauses the tape, the slow basic program has no chance to read anything except the first record (of the second part).
So what you must do is to artificially make a very long IRG. The idea is to give enough time for the BASIC program, as if the tape would have been stopped. The long gap must be added before each record of the second part. I can’t say how long this gap must be, probably a couple of seconds.
Now, patching the file manually will probably be not so easy …
Again, the problem is related only to the SIO2PC interface. It won’t happen in real hardware. And if the emulator properly supports the motor control signal, then it shouldn’t be a problem either.
Real hardware won’t have a problem because the second part was surely recorded using slow/long mode. SIO2PC needs extra long gaps to compensate for not pausing the tape.
I don't know if the CAS format allows for adjustable IRGs (beyond the defaults for long and short) but it does allow for pauses. I've seen it in APE for Windows, messages like, "17 second pause". Don't know if a normal record (CAS record not tape record) has an adjustable duration value but I'll invesitgate. If not I can try inserting pause records instead.
The hex dump of the WAV2CAS process only shows two errors for my best conversion. Both errors appear to be at the end of each of two stages of the load. The errors don't necessarily mean corruption of the real data, only extraneous data.
What I mean is I think I have a good CAS file which hopefully only needs some careful patching to address the problem with the data records.
Thanks for another reasonable explanation, ijor.
Phsstpok