Commodore 128 Alive!

Commodore 128 => 128 programmers => Topic started by: MIRKOSOFT on August 19, 2010, 03:28 AM

Title: FILE (UN)LOCKING
Post by: MIRKOSOFT on August 19, 2010, 03:28 AM
Hi!

As every user of 64HDD knows that simple locking and unlocking files is with these commands:

OPEN 1,11,15,”F-L:FILE.PRG”
CLOSE 1

OPEN 1,11,15,”F-U:FILE.PRG”
CLOSE 1



Is possible to do this without 64HDD? On real drives, exactly: exists any command to (UN)LOCK file?

Many many thanks.

Miro
Title: Re: FILE (UN)LOCKING
Post by: Hydrophilic on August 19, 2010, 06:53 PM
There is no command for this on Commodore floppy drives like 1541/71/81.  Maybe on some third-party drives, but I don't know of any.  On Commodore drives you have to read in the sector from the directory, modify bit 6 of the "file type" byte, then write the sector back onto the disk.

As I recall, $82 = normal PRG, $C2 = locked PRG, $02 = splat PRG.  Of course there are other values, but this should be enough to get you started.
EhPortal 1.34 © 2025, WebDev