Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user BritBlaster ! (Registered 2025-03-12) 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: 45
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!
 
... 1 post hidden. Click here to view all posts....
 
2025-01-27 21:47
TheRyk

Registered: Mar 2009
Posts: 2367
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: 11445
of course :D
2025-01-27 21:52
TheRyk

Registered: Mar 2009
Posts: 2367
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: 11445
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: 714
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: 11445
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: 1650
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: 11445
Krills can only overwrite iirc (creating files is a bit complex...)
2025-01-28 14:31
Frantic

Registered: Mar 2003
Posts: 1650
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.
2025-01-28 16:01
Krill

Registered: Apr 2002
Posts: 3007
Frantic: Maybe Plushdos fits your bill. It's a collection of separate routines, with those you listed not requiring previous installation for mix & match.

There is no save-with-replace, though, nobody really needs that (unless it's in-place on an existing fixed-size file like hiscores, and then the saver in the IRQ loader would be good enough - also note that next release will be able to load the directory as if it were a regular file, but as a binary blob and without BAM).

Edit: Eh, and what's that bit about a particular assembler? Don't tell me you're also one of those people who'd port EVERYTHING to their own assembler of fancy?
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
Solo Kazuki
Sony75/Antia
Exploding Fi../Techn..
thesuperfrog
Tom/TRS
WVL/Xenon
Alakran_64
hedning/G★P
csabanw
EALL/HT
Radd Maxx/SWIM
Guests online: 88
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Codeboys & Endians  (9.7)
4 Coma Light 13  (9.6)
5 Mojo  (9.6)
6 Edge of Disgrace  (9.6)
7 Uncensored  (9.6)
8 Comaland 100%  (9.6)
9 What Is The Matrix 2  (9.5)
10 Wonderland XIV  (9.5)
Top onefile Demos
1 Nine  (9.8)
2 Layers  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Dawnfall V1.1  (9.5)
7 Rainbow Connection  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Barry Boomer - Trapp..  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Booze Design  (9.3)
3 Performers  (9.3)
4 Censor Design  (9.2)
5 Triad  (9.2)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 MWS  (9.7)
4 Irata  (9.7)
5 hedning  (9.7)

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