Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Disk image linting
2024-11-02 12:33
Krill

Registered: Apr 2002
Posts: 2971
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?
2024-11-02 15:13
tlr

Registered: Sep 2003
Posts: 1787
- 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?
2024-11-03 03:46
Krill

Registered: Apr 2002
Posts: 2971
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 tlr
Regarding 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". =)
2024-11-03 10:20
tlr

Registered: Sep 2003
Posts: 1787
Quoting Krill
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?

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.
2024-11-03 14:24
Krill

Registered: Apr 2002
Posts: 2971
Quoting tlr
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.
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.
2024-11-03 15:38
tlr

Registered: Sep 2003
Posts: 1787
Quoting Krill
Quoting tlr
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. =)

I guess for anything else than the file that matches "*", the user will have to flag which entries he wants to be loadable.

Quoting Krill
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.

IIRC a DOS 2.6 formatted disk always gives an initial $4b, followed by all $01's.
2024-11-03 15:54
Krill

Registered: Apr 2002
Posts: 2971
Quoting tlr
IIRC 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.
2024-11-03 16:02
tlr

Registered: Sep 2003
Posts: 1787
Quoting Krill
Quoting tlr
IIRC 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.
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Guests online: 86
Top Demos
1 Next Level  (9.7)
2 What Is The Matrix 2  (9.7)
3 13:37  (9.7)
4 Coma Light 13  (9.7)
5 Edge of Disgrace  (9.7)
6 Mojo  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 Party Elk 2  (9.6)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.6)
5 Libertongo  (9.5)
6 Rainbow Connection  (9.5)
7 Onscreen 5k  (9.5)
8 Morph  (9.5)
9 Dawnfall V1.1  (9.5)
10 It's More Fun to Com..  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Nostalgia  (9.3)
5 Triad  (9.3)
Top Diskmag Editors
1 Magic  (9.8)
2 hedning  (9.6)
3 Jazzcat  (9.5)
4 Elwix  (9.1)
5 Remix  (9.1)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.062 sec.