One of the worst things that can happen is to have a disk become corrupt – especially if it is the only copy you have and the cassette that you had LOADed the original program into the computer will not load again. I had a printout but a six foot LLIST on a ZX81/TS1000 is not one that you would enjoy re-entering into the computer. The disk became corrupt when the system was jarred while SAVEing another program on the disk. I had made a printout of the directory and there were 7 tracks of data in the program.
This is on the Larken ZX81 disk system and so far as I know there is not a program to automatically rewrite a crashed track 0 – which was what seemed to be the problem – at least attempts to read the directory gave CRC ER. Having just recently gotten a ZX81 with 64K on board the computer (no more crashes due to wobbly ram packs) I was working with the two drive Larken interface when I had another disk seemingly get corrupted. This time I was copying it and it was write protected.
A check of the Larken manual gave some POKEs to examine the contents of a track – but not explanation of how to do it. I have Bill Harmer‘s 130 page+ Unofficial Larken ZX81 Disk Manual and he explained it so that I could see that it was practical to do. But he also mentioned a Public Domain program DOSDOC.B1 that had a slower way of doing it (but required no lengthy explanation of how to do it).
The program LOADs the designated track into the disk I/F BUFFER RAM and then lists the addresses and the data on the screen – but it is slow. The address given is the buffer address not the disk address. And by pressing CONT you advance one screen furthur into the addresses – and with a 2K chip that is a lot of screens – except that I did not have to go that far into the addresses. I took a look at the contents of track 0 of the corrupted disk. And it made no sense at all.
I then looked at track 0 of a good disk and kept stepping and finally I found the file name and while it was crazy appearing, the track numbers of the tracks the files were stored on. (The track numbers start with 129 for 1, 130 for track 2 and so on). The good directory looked like the track map given in the Larken manual. What did the corrupt track map look like? Imagine eating in a dining room served by a half dozen or so waiters from several different kitchens and they were running like mad. You’d ordered and your order was coming but several waiters collided and orders slide from tray to tray and some were lost to the floor. The waiters just keep going and delivered the stuff on the trays regardless of what was ordered. That is the way the corrupted disk track 0 looked.
I next looked at track 1 of the corrupted disk and the file name was there and I knew what had been used and made notes. I then LOADed track 0 into the buffer and POKEd in at address 12352 (which is the first address in the buffer) 255 and at 12353 POKEd in byte 0 and 12354,200. The rest seemed unimportant to me so I stepped to the address 12456, and put in 255 which is the pointer to the first character in the file name then starting with address 12457 I input the character codes for the file name (total maximum of 9 pokes) then an end of the name file and then the following the names addresses address number and the POKE 253 and then the addresses and the track numbers where the program is stored. The numbering for the tracks is weird but starting with 129 it increases by one for each track as you progress through the file names. Then immediately after the last track number you POKE in byte 249 for end of track pointer.
Now a little bit of the nitty gritty that I understand. Every track starts with byte 255 and on track 0 it again appears as the 168th address counting disk addresses from the first address on track 0. In fact byte 255 is the byte that points to the file name and will appear for each file name in track 0. To restore track 0 I had to punch in some 23 pokes and then three key punches SAVEd the poked track back to the disk. And upon trying the results I found the directory was correct and that the program also LOADed correctly. Of course I made some extra copies of the program.
Incidentially, I cleaned the contacts with CATUG‘s suggestion with mineral oil and I did get the disk that I thought had crashed and was write protected to LOAD. I also had noticed that if the computer and interface seem to be reluctant to LOAD a program, removing power for a moment from the entire system often enabled me to Load the program.
Even if you only have a single disk drive version of LDOS the program of DOSDOC.B1 has some features that are of great help. If you would like to have a copy send me a FORMATted disk with return postage and I will send you a copy. There are eleven disks of Public Domain software available for the ZX81 Larken interface, all on double sided 5.25 disks.