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!
 
... 1 post hidden. Click here to view all posts....
 
2025-01-27 21:47
TheRyk

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

Registered: Mar 2009
Posts: 2466
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: 11510
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: 746
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: 11510
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: 11510
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.
2025-01-28 16:01
Krill

Registered: Apr 2002
Posts: 3083
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
t0m3000/bo0M!^hf^ibex
GI-Joe/MYD!
katon/Lepsi De
Guests online: 404
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 Uncensored  (9.5)
9 Wonderland XIV  (9.5)
10 No Bounds  (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 NTSC-Fixers
1 Pudwerx  (10)
2 Stormbringer  (9.7)
3 Fungus  (9.6)
4 Booze  (9.5)
5 Grim Reaper  (9.3)

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