Hi ,
I am writing floppy driver and he goes right. But i have one problem.
If I read some sectors from floopy => change diskette => and read sectors again, I will get the same sectors (sectors from first diskette..not from second diskette)...
I think, that problem is with cache of floppy... How can I delete data from cache... If problem is otherwhere, tell me
thanks
(I am OS novice )
FDD cache
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:FDD cache
well, you may want to force your user to tell the system when they remove the floppy ... or check if the "disk changed" status is somehow reliable ...
Re:FDD cache
Do it the DOS way. It's slow but reliable.
On any non-sequential operation read track 0.
Compare the volume number ID with the previous request, if it doesn't match then put up a box demanding the previous disk.
If the user hits cancel, try to exit gracefully. Apple 2, Commodore and CP/M all suffered problems because they didn't check the disk.
I would also reccommend not using the floppy controllers 'disk change' feature. A lot of mass produced floppy drives don't implement it correctly. The only way to make sure (if you want to use it) is have the user change disks during installation of your OS and then decide. Microsoft Backup for MSDOS did this, and only 1 of 3 computers I used Backup on supported the disk change notification correctly.
On any non-sequential operation read track 0.
Compare the volume number ID with the previous request, if it doesn't match then put up a box demanding the previous disk.
If the user hits cancel, try to exit gracefully. Apple 2, Commodore and CP/M all suffered problems because they didn't check the disk.
I would also reccommend not using the floppy controllers 'disk change' feature. A lot of mass produced floppy drives don't implement it correctly. The only way to make sure (if you want to use it) is have the user change disks during installation of your OS and then decide. Microsoft Backup for MSDOS did this, and only 1 of 3 computers I used Backup on supported the disk change notification correctly.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:FDD cache
The alternative being to be unix-like: user mounts floppy before she can access it and knows (because she read the f*** manual) that if she changes the floppy without unmounting first, Bad Things (tm) are going to occur ...
Now of course, if your average user looks more like Mr. Anykey, your system will be unusable for him ... all depend. Do you expect Mr. Anykey to know how to insert a floppy in 2005, anyway ?
(writing this post makes me feels the urge to start a USB support for clicker
Now of course, if your average user looks more like Mr. Anykey, your system will be unusable for him ... all depend. Do you expect Mr. Anykey to know how to insert a floppy in 2005, anyway ?
(writing this post makes me feels the urge to start a USB support for clicker
Re:FDD cache
thanks ;D
now I can detect floppy disk change, but I don't know, what I have to do, when i detect disk change... how can i clear cache memory in floppy controller? I haven't any idea...
now I can detect floppy disk change, but I don't know, what I have to do, when i detect disk change... how can i clear cache memory in floppy controller? I haven't any idea...
Re:FDD cache
Ahem... I assume you refer to Commodore PC.Xardfir wrote: On any non-sequential operation read track 0.
Compare the volume number ID with the previous request, if it doesn't match then put up a box demanding the previous disk.
If the user hits cancel, try to exit gracefully. Apple 2, Commodore and CP/M all suffered problems because they didn't check the disk.
Commodore Amiga checked the volume ID of the disk every three seconds or so. That allowed to sense disk changes automatically, and if there were unwritten buffers, it popped a requester asking you to insert the previous disk or lose data.
Every good solution is obvious once you've found it.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:FDD cache
Well, that all depends on how you built your cache. I assume you don't simply grab 1.44 MB of physical ram for floppy caching, right ? you have something like
Code: Select all
struct FloppyCache {
FloppyTrack *cache[TRACKS_ON_DISK];
// initialize this with NULLs
};
void fillCache(struct FloppyCache* fc, trackno)
{
if (fc->cache[trackno]) return; // in cache already;
fc->cache[trackno]=alloc(MEM_DMA_CAPABLE,sizeof(FloppyTrack));
floppy_load_track(fc->cache[trackno],trackno);
return;
}
void clearCache(struct FloppyCache *fc)
{
for (int i=0;i<TRACK_ON_DISK;i++) {
if (fc->cache[i]) free(fc->cache[i]);
fc->cache[i]=NULL;
}
}
Re:FDD cache
Hiya,
@ Solar:
My apologies for my Commodore ambiguity (I have adopted 3 Amiga 500's myself). My reference was to the less capable 1541/2 and 1570 series of Commodore disk drives running their own version of Commodore Dos.
The only redeeming feature of the 1570 was that it could write CP/M disks which could be read on a PC (using CP/M 86).
@ HanzZ:
As for caching, might I suggest looking at the DMA page in the OSFAQ, as it provides a way of using the DMA to supply a track cache for the floppy disk in hardware. Less code for you to write, let the hardware do the work.
@ Solar:
My apologies for my Commodore ambiguity (I have adopted 3 Amiga 500's myself). My reference was to the less capable 1541/2 and 1570 series of Commodore disk drives running their own version of Commodore Dos.
The only redeeming feature of the 1570 was that it could write CP/M disks which could be read on a PC (using CP/M 86).
@ HanzZ:
As for caching, might I suggest looking at the DMA page in the OSFAQ, as it provides a way of using the DMA to supply a track cache for the floppy disk in hardware. Less code for you to write, let the hardware do the work.
Re:FDD cache
Hi,
They also made better use of the media (more sectors on outer tracks) and allowed custom code to be uploaded.
Cheers,
Brendan
These disk drives aren't disk drives - they're more like mini file servers (you could connect several computers to one of them, and the computer/s send commands rather than messing about with low level sector addressing stuff).Xardfir wrote:The only redeeming feature of the 1570 was that it could write CP/M disks which could be read on a PC (using CP/M 86).
They also made better use of the media (more sectors on outer tracks) and allowed custom code to be uploaded.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.