[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More on 6809 board.



Am 21.07.2012 05:51 schrieb Alex Freed:

Also can somebody explain the .DO/.PO thing to me?

The sectors are written to disk in different orders to increase access time. The idea was that after the first sector has been read from disk and is processed, the disk has spun further and the second sector is immediately in front of the head. This interleave scheme is different for DOS and ProDOS.

If now a disk is archived, the DOS interleave is resolved and the sectors are stored in their correct logical order. However, some tools follow the DOS scheme and produce *.dsk/*.do images, other expect the source to be ProDOS interleaved and produce *.po images.

Years ago I wrote a Pascal program to convert *.po into the more common *.dsk format. It is attached below.


Best regards
Patrick




PROGRAM PoDo;
{This program converts Apple ProDOS order disk images into DOS order images.
Both file formats contain the sectors in their logical order. Due to different
 interleaving schemes both formats are incompatible.
 Version 0.1 (c) P. Schäfer Feb-2000}
{$I-}

USES DOS;

TYPE Sector=ARRAY[0..255] OF BYTE;
     Track=ARRAY[0..15] OF Sector;
     Image=FILE OF Track;

VAR PoName, DoName:STRING;
    PoFile, DoFile:Image;
    buffer:Track;
    i:INTEGER;

PROCEDURE CheckNames;
VAR
  P: PathStr;
  D: DirStr;
  N: NameStr;
  E: ExtStr;
BEGIN
  Case ParamCount OF
    2:BEGIN
        P:=ParamStr(1); FSplit(P,D,N,E);
        PoName:=D+N+E;
        IF E='' THEN PoName:=PoName+'.po';
        P:=ParamStr(2); FSplit(P,D,N,E);
        DoName:=D+N+E;
        IF E='' THEN DoName:=DoName+'.dsk';
      END;
    1:BEGIN
        P:=ParamStr(1); FSplit(P,D,N,E);
        DoName:=D+N+'.dsk'; PoName:=D+N+E;
        IF E='' THEN PoName:=PoName+'.po';
      END;
    0:BEGIN
        Write('Prodos Order file: '); ReadLn(P);
        FSplit(P,D,N,E);
        DoName:=D+N+'.dsk'; PoName:=D+N+E;
        IF E='' THEN PoName:=PoName+'.po';
      END;
  END;
END;

PROCEDURE Shuffle(VAR Old:Track);
VAR New:Track;
BEGIN
  New[0]:=Old[0];
  New[1]:=Old[14];
  New[2]:=Old[13];
  New[3]:=Old[12];
  New[4]:=Old[11];
  New[5]:=Old[10];
  New[6]:=Old[9];
  New[7]:=Old[8];
  New[8]:=Old[7];
  New[9]:=Old[6];
  New[10]:=Old[5];
  New[11]:=Old[4];
  New[12]:=Old[3];
  New[13]:=Old[2];
  New[14]:=Old[1];
  New[15]:=Old[15];
  Old:=New;
END;

BEGIN
  WriteLn; WriteLn('ProDOS to DOS order conversion program');
  WriteLn('Ver. 0.1  P.Schaefer 8-Feb-00');
  CheckNames;
  WriteLn; WriteLn(PoName,' -> ',DoName);
  Assign(PoFile, PoName);
  FileMode := 0;  { Set file access to read only }
  Reset(PoFile);
  IF IOresult<>0 THEN WriteLn('File not found.')
  ELSE BEGIN
         Assign(DoFile, DoName); ReWrite(DoFile);
         FOR i:=0 TO 34 DO BEGIN
           Read(PoFile,Buffer);
           Shuffle(Buffer);
           Write(DoFile,Buffer);
         END;
         Close(PoFile); Close(DoFile);
         WriteLn('Done.');
  END;
END.