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 > The good old 1541 save @:bug - question
2025-01-27 21:32
aeeben

Registered: May 2002
Posts: 46
The good old 1541 save @:bug - question

Finally googled the 1541 replace-save bug - so all the three conditions listed here must be met to make it corrupt data:
https://www.c64-wiki.com/wiki/REPLACE

-> If I'm saving a game state or program settings or something, and it's only 1 or 2 blocks, it should be always safe to use KERNAL save with @:filename, because condition #2 ("One or more blocks must get marked as occupied on at least three tracks") is never met?

Please correct if wrong. Please confirm if right :)

@-save slowly rot my programming disks as a kid, so I learned to never use it!
2025-01-27 21:34
chatGPZ

Registered: Dec 2001
Posts: 11523
This has been discussed to death - and as usual the wiki page isn't the end of the story.

Just don't use it. Ever.

(your example is missing another bad case: when there are less blocks free than you are 'overwriting' -> boom)
2025-01-27 21:47
TheRyk

Registered: Mar 2009
Posts: 2475
Quoting chatGPZ
...
Just don't use it. Ever.
...

Yeah, i.e. if chatGPZ meant save"@:..." not c64-wiki ;)
2025-01-27 21:48
chatGPZ

Registered: Dec 2001
Posts: 11523
of course :D
2025-01-27 21:52
TheRyk

Registered: Mar 2009
Posts: 2475
Quoting 'TS'
so I learned to never use it!


And I wouldn't rely on ALL of the 3 conditions having to be fulfilled for making error happen...

Apart from direct mode and BASIC, where it's of course easier/shorter than doing it properly with all the OPEN-CLOSE-hankypanky, I don't see any advantage leading to recommending anyone risking SAVE"@..." at all
2025-01-27 21:58
chatGPZ

Registered: Dec 2001
Posts: 11523
save/scratch/rename is the way to go indeed. there is no reason to try to work around that bug - there has to be enough blocks free for this in either case.
2025-01-27 22:32
Fungus

Registered: Sep 2002
Posts: 749
I traced it out once, and what happened was the 1541 allocates the block in the bam, then when it goes to update the directory, it re-reads the bam into the same buffer and the bam is then corrupted.
2025-01-27 22:38
chatGPZ

Registered: Dec 2001
Posts: 11523
That is _one_ of the many problems that exist in various DOS versions :) (The wiki page tries to explain some of the others, but is written in a very confusing and slightly misinforming way imho)
2025-01-28 11:17
Frantic

Registered: Mar 2003
Posts: 1661
Is a simple and relatively up-to-date (drive-code-wise) library available somewhere, with fastload/fastsave/fastsave-overwrite/read-dir functionality for use in tools ?
2025-01-28 14:04
chatGPZ

Registered: Dec 2001
Posts: 11523
Krills can only overwrite iirc (creating files is a bit complex...)
2025-01-28 14:31
Frantic

Registered: Mar 2003
Posts: 1661
I will pay 5 SEK to the person who creates such a library, and 5 SEK more if the code is fairly independent of super specific features of some particular assembler.
 
... 1 post hidden. Click here to view all posts....
 
Previous - 1 | 2 - Next
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
Jazzcat/Onslaught
Sychamis
Guests online: 122
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Codeboys & Endians  (9.7)
4 Mojo  (9.6)
5 Coma Light 13  (9.6)
6 Edge of Disgrace  (9.6)
7 Signal Carnival  (9.6)
8 Wonderland XIV  (9.5)
9 Uncensored  (9.5)
10 Comaland 100%  (9.5)
Top onefile Demos
1 Nine  (9.7)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.5)
6 Scan and Spin  (9.5)
7 Onscreen 5k  (9.5)
8 Grey  (9.5)
9 Dawnfall V1.1  (9.5)
10 Rainbow Connection  (9.5)
Top Groups
1 Artline Designs  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Performers  (9.3)
5 Censor Design  (9.3)
Top Musicians
1 Rob Hubbard  (9.7)
2 Jeroen Tel  (9.7)
3 Stinsen  (9.7)
4 LMan  (9.7)
5 Linus  (9.6)

Home - Disclaimer
Copyright © No Name 2001-2025
Page generated in: 0.141 sec.