<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Wed, 01 Jul 2009 22:19:10 +0100
From   : jgh@... (Jonathan Graham Harston)
Subject: DSD format and 'short' images

"Michael Firth" wrote:
> Does anyone here know where the 'DSD' disk format originated? - It seems
> a strange layout for a BBC format, as the sector ordering is rather
 
I think it originated with people using PCs to image disks and
imaging them a track at a time instead of the natural BBC order.
 
> Also, is there a good algorithm for detecting a DSD - presumably looking
> to see if sectors 0,1 and 10,11 look like DFS catalogues will catch most
> of them?
 
I've posted the following before, from my update to BeebArc. On
entry I% is the handle of an opened image file.
 
DEFPROCidentifyimage(I%)                                 :REM Make an educated
guess at the image type
LOCAL a$
dsd%=FALSE:dbl%=FALSE:fsid%=0                            :REM DFS31 sequential
IF EXT#I%>&4700 THEN
 a$="":PTR#I%=&4610:FOR A%=0 TO 7:a$=a$+CHR$BGET#I%:NEXT
 IF a$=CHR$0+"(C)JGH"+CHR$0:fsid%=3:dsd%=FALSE           :REM HADFS sequential
ENDIF
IF EXT#I%>&8D00 AND fsid%=0 THEN
 a$="":PTR#I%=&8C10:FOR A%=0 TO 7:a$=a$+CHR$BGET#I%:NEXT
 IF a$=CHR$0+"(C)JGH"+CHR$0:fsid%=3:dsd%=TRUE            :REM HADFS
interleaved
ENDIF
IF EXT#I%>&400 AND fsid%=0 THEN
 a$="":PTR#I%=&200:FOR A%=0 TO 7:a$=a$+CHR$BGET#I%:NEXT
 IF a$=STRING$(8,CHR$&AA):fsid%=1:dsd%=FALSE             :REM DFS62 sequential
ENDIF
IF EXT#I%>&D00 AND fsid%<2 THEN
 a$="":PTR#I%=&C00:FOR A%=0 TO 7:a$=a$+CHR$BGET#I%:NEXT
 IF a$=STRING$(8,CHR$&AA):fsid%=1:dsd%=TRUE              :REM DFS62 sequential
ENDIF
IF EXT#I%>&700 AND fsid%=0 THEN
 a$="":PTR#I%=&201:FOR A%=0 TO 3:a$=a$+CHR$BGET#I%:NEXT
 IF a$="Nick" OR a$="Hugo":fsid%=2:PROCcheckadfs:ENDPROC :REM ADFS sequential
ENDIF
IF fsid%=0 THEN
  PTR#I%=&106:L%=(BGET#I% AND 15)<<16 OR BGET#I%<<8
  IF L%<EXT#I% THEN dsd%=TRUE                            :REM DFS interleaved
                                                         :REM ** or sequential
<side0><side1> **
ENDIF
ENDPROC
 
DEFPROCcheckadfs
LOCAL p%,z%,b%
dsd%=FALSE
p%=&205:REPEAT
  PTR#I%=p%:z%=BGET#I%
  IF z% THEN
    PTR#I%=p%+3:b%=BGET#I%
    IF (b%AND128) THEN
      PTR#I%=p%+&16:b%=BGET#I%+256*BGET#I%+65536*BGET#I%
      IF b%<&32000 THEN
        b%=(b%AND15)+(b%DIV16)*32
        PTR#I%=b%*256+1:a$="":FOR A%=0 TO 3:a$=a$+CHR$BGET#I%:NEXT
        IF a$="Nick" OR a$="Hugo":dsd%=TRUE
      ENDIF
    ENDIF
  ENDIF
  p%=p%+26
UNTIL dsd% OR z%=0 OR p%>=&6CB
ENDPROC
 
See http://mdfs.net/Apps/FileUtils/BeebArc.zip
 
> strict - certainly on early Acorn DFSes you could get away with putting
> control characters into the disk title or filenames with a sector editor
 
Filenames like "Mr.E", "$" and "#" are valid.
 
> on the Wiki. Is there any code I can crib anywhere that will do a 'first
> pass' sanity check on a DFS catalogue - i.e. as a minimum ensuring that
> the files don't overlap, and that the starting sectors are in descending
> order?
 
That's about all you can rely on. "Number of files" at &105 must be
a multiple of 8, b6-b7 of byte &106 must be zero, and sector
numbers in descending order.
See http://mdfs.net/Docs/Comp/Disk/Format/DFS
 
> Finally, is there anything that can create 'short' DSD files like
> several things do for SSD files (i.e. only containing the amount of
> sectors to cover the highest occupied sector on either side), or are
> DSDs always 400k?
 
Any program that can create a dsd image can theoretically create
short dsd if it so wishes. The only program I know of that does is
my SSDtoDSD utility, which will create a short DSD from a short
SSD (http://mdfs.net/Apps/DiskTools).
 
-- 
J.G.Harston - jgh@...                - mdfs.net/User/JGH
A Review of Sheffield City Council's Members' Allowances Scheme
                                  See http://mdfs.net/payreform
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>