|
ADFS E format floppies |
|
sinns (20:09 9/3/2009) filecore (21:00 9/3/2009) sinns (21:09 9/3/2009) ksattic (21:30 9/3/2009) Phlamethrower (21:56 9/3/2009) sinns (07:34 10/3/2009) tribbles (20:05 10/3/2009) filecore (21:28 10/3/2009) sinns (14:57 11/3/2009)
|
|
Simon Inns |
Message #109516, posted by sinns at 20:09, 9/3/2009 |
Member
Posts: 73
|
Hi
Another obscure question...
I'm writing a C++ class which can read ADFS format floppy images (ADF files) and to make it as flexible as possible I want to use the information in the disc record... Here is what my program thinks about a 800K E format floppy image (ADF):
log2 of sector size : 0xa sectors per track : 0x5 heads : 0x2 density : 0x2 ID length : 0xf log2bpmb : 0x7 skew : 0x1 boot option : 0x0 number of zones : 0x1 bits in zone : 0x2005 root directory : 0x203 disc size : 0xc8000 disc ID : 0x34cd disc name : DiscName1
The root directory is at 0x203, but looking at the disc sector editor there is nothing there... the root directory seems to be at 0x800.
Since all the other details (like heads, disc size, etc.) look correct, I can only imagine that 'root directory' doesn't mean the physical location on the disc but something else...
or am I just missing something obvious? The PRMs are not helping me!
As always, I appreciate your help
/Simon |
|
[ Log in to reply ] |
|
Jason Togneri |
Message #109518, posted by filecore at 21:00, 9/3/2009, in reply to message #109516 |
Posts: 3868
|
Sadly, I know nothing about this, but perhaps this and this from my bookmarks might be of help. |
|
[ Log in to reply ] |
|
Simon Inns |
Message #109519, posted by sinns at 21:09, 9/3/2009, in reply to message #109518 |
Member
Posts: 73
|
Didn't help I'm afraid... I've googled all I can, and browsed through the source code of libdsk (and a few other programs) most just hard code 0x800 and ignore the disc record.
I'm trying to make my class as flexible as possible, so I would rather not make such assumptions (although I will if I have to ).
Thanks for taking the time anyway |
|
[ Log in to reply ] |
|
Simon Wilson |
Message #109520, posted by ksattic at 21:30, 9/3/2009, in reply to message #109516 |
Finally, an avatar!
Posts: 1291
|
Nice project! I've been looking for something like this for a while. |
|
[ Log in to reply ] |
|
Jeffrey Lee |
Message #109521, posted by Phlamethrower at 21:56, 9/3/2009, in reply to message #109520 |
Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot Hot stuff
Posts: 15100
|
If you want to find out what it's really used for, you could grab the ADFS source code from the RISC OS Open website.
http://www.riscosopen.org/content/downloads/cvs-access http://www.riscosopen.org/viewer/view/castle/RiscOS/Sources/FileSys/ADFS/ |
|
[ Log in to reply ] |
|
Simon Inns |
Message #109522, posted by sinns at 07:34, 10/3/2009, in reply to message #109521 |
Member
Posts: 73
|
As far as I can tell (the source code is not exactly 'readable' ), the values are hard coded and determined by looking at the other disc details. Once the filecore *thinks* it has an E format disc it simply uses some constants:
L_Root * &200 D_Root * &400
L_Size * 640*K D_Size * 800*K
NewMapRoot * &203 ;indirect disc add NewFloppyRootDiscAdd * &800 ;physical disc add
(from the filecore00 sources)
So in order to 'do it like RISC OS' I would need to use the other details in the disc record and then presume the root is at &800.
Why the OS returns the 'indirect disc address' of &203 rather than the actual address I don't know. At the moment I can't even see anywhere in the source code that even uses the indirect address for anything.
Deep into the rabbit hole we go |
|
[ Log in to reply ] |
|
Jason Tribbeck |
Message #109524, posted by tribbles at 20:05, 10/3/2009, in reply to message #109522 |
Captain Helix
Posts: 929
|
FileCore is a bit of a pain when it comes to address calculation. I've got code (in C) that deals with it all in E and E+, and also HD formats - but unfortunately it's under NDA, so I can't do anything with it. |
|
[ Log in to reply ] |
|
Jason Togneri |
Message #109525, posted by filecore at 21:28, 10/3/2009, in reply to message #109524 |
Posts: 3868
|
FileCore is a bit of a pain :-( |
|
[ Log in to reply ] |
|
Simon Inns |
Message #109527, posted by sinns at 14:57, 11/3/2009, in reply to message #109525 |
Member
Posts: 73
|
Seems I am way out on this one... The address of the root directory (like addresses for all other files and directories on the disc) is an 'indirect disc address' which is a combination of a 'System Internal Number' and 'file number'...
The file number allows you to search the disc map for the fragments of the file in question. Then with these fragments (which point to the pieces of the actual file itself) you can grab the actual data and reassemble it.
Now all I have to do is work out how to convert those two paragraphs to C++...
As a matter of interest, my 'aim' in all this is to build a file core extension that lets you mount ADF images on a real A3000 as if they were real floppies (like !spark but for images).
Then it should be possible to run games stored in ADF format without copying them to (increasingly hard to buy) floppy discs.
Mind you, the class should be equally suitable for making an ADFS image explorer for windoze or linux. At the very least I will publish the class when I'm done in case someone finds it useful. |
|
[ Log in to reply ] |
|
|