| | Krill
Registered: Apr 2002 Posts: 2981 |
Disk image linting
As noted over on https://csdb.dk/forums/?roomid=11&topicid=168409#168443 there seems to be a need to check disk images for certain properties, such that things like LOAD"*",8 work as expected.
Another popular bug is invalid last sectors, especially in the directory, such that the length byte (2nd byte of the final block) is 0 or 1.
Now, there are plans to add a linting option to cc1541, which would check for those pitfalls.
What else should such a check validate? |
|
| | tlr
Registered: Sep 2003 Posts: 1790 |
- also check that load "<filename>",8,1 would work
- circular links (dir and/or files)
- invalid t/s in links
Regarding 2nd byte in the last block of dir, shouldn't that always be $ff? |
| | Krill
Registered: Apr 2002 Posts: 2981 |
Quoting tlr- also check that load "<filename>",8,1 would work Please elaborate. Do you mean a special check option to make sure that a given filename can be loaded?
Quoting tlrRegarding 2nd byte in the last block of dir, shouldn't that always be $ff? Yes, it should. And yet, many a disk image has been spotted with the dir's final block starting with "00 00". =) |
| | tlr
Registered: Sep 2003 Posts: 1790 |
Quoting KrillQuoting tlr- also check that load "<filename>",8,1 would work Please elaborate. Do you mean a special check option to make sure that a given filename can be loaded?
Ah, that wasn't too clear, was it? :)
I ment that it should check if loading the filename listed in the directory will actually work, e.g by adding load and ,8,1 to what is listed when doing load "$",8 (or $, DOS"$, etc...)
I think it would be good if it performs checks that load also works for popular traditional carts like FC3, AR6 and such in case there are filename limitations there.
Maybe a load address check too to flag things like needing ,8,1 for a file that is supposed to be basic runnable, e.g load address is $0800. |
| | Krill
Registered: Apr 2002 Posts: 2981 |
Quoting tlrI ment that it should check if loading the filename listed in the directory will actually work, e.g by adding load and ,8,1 to what is listed when doing load "$",8 (or $, DOS"$, etc...)
I think it would be good if it performs checks that load also works for popular traditional carts like FC3, AR6 and such in case there are filename limitations there.
Maybe a load address check too to flag things like needing ,8,1 for a file that is supposed to be basic runnable, e.g load address is $0800. Can you detail those checks? It all seems awfully close to trying to solve the halting problem, imho. =)
Checking the filename for ambiguous or unreachable (via KERNAL editor) characters seems possible, but with dir-art and all that, how to know which files beyond the first one ("*") are actually supposed to be loadable? And whether a file is intended for autorun or BASIC RUN... or both?
And here's another proposed check:
- non-empty blocks that are marked as free in the BAM
The interesting thing here is that there seems to be a bug in 1541's DOS 2.6, such that blocks aren't all-zeroes after format. The first byte may be anything. Apparently some off-by-one thing. |
| | tlr
Registered: Sep 2003 Posts: 1790 |
Quoting KrillQuoting tlrMaybe a load address check too to flag things like needing ,8,1 for a file that is supposed to be basic runnable, e.g load address is $0800. Can you detail those checks? It all seems awfully close to trying to solve the halting problem, imho. =)
I guess for anything else than the file that matches "*", the user will have to flag which entries he wants to be loadable.
Quoting KrillThe interesting thing here is that there seems to be a bug in 1541's DOS 2.6, such that blocks aren't all-zeroes after format. The first byte may be anything. Apparently some off-by-one thing.
IIRC a DOS 2.6 formatted disk always gives an initial $4b, followed by all $01's. |
| | Krill
Registered: Apr 2002 Posts: 2981 |
Quoting tlrIIRC a DOS 2.6 formatted disk always gives an initial $4b, followed by all $01's. Yes about the $01s, but at least in VICE, the first byte can also be $00 or $08 (seen on track 1 after format).
Also, Action Replay fast format leaves all empty blocks with 00 FF 00 ... 00. |
| | tlr
Registered: Sep 2003 Posts: 1790 |
Quoting KrillQuoting tlrIIRC a DOS 2.6 formatted disk always gives an initial $4b, followed by all $01's. Yes about the $01s, but at least in VICE, the first byte can also be $00 or $08 (seen on track 1 after format).
Cool, didn't know that! I guess I never looked at track 1 for this. :)
Makes sense as the code has an extra INX weird reason (X=0 when starting):
FC86: E8 INX
FC87: 8A TXA
FC88: 9D 00 05 STA $0500,X
FC8B: E8 INX
FC8C: D0 FA BNE $FC88
...
FC9E: A9 05 LDA #$05
FCA0: 85 31 STA $31 ; buffer pointer to $500
FCA2: 20 E9 F5 JSR $F5E9 ; calculate parity for data buffer
FCA5: 85 3A STA $3A ; and save
FCA7: 20 8F F7 JSR $F78F ; block -> GCR This is run once per track so after this has been run for track 1, $0500 will contain GCR, which I guess just happens to be $4b. For track 1 it will be whatever was in $0500 from before. |
|