On 09/10/2011 14:55, Norman Dunbar wrote:
Hi Rich,

this is from my old qformat utility which quickly reformats a disc by writing a "blank" map to the disc. The following is the ED details:

/*----------------------------------------------*
 * DS/ED MAP                    *
 *                        *
 * The map for a DS/ED disc takes up 3 sectors    *
 * of 2048 bytes each. This is because there    *
 * are 1600 allocation blocks on an ED disc.    *
 *----------------------------------------------*/

                      /*-------------------------*/
US char maped[] = {'Q','L','5','B',       /* HD identifier           */
           32,32,32,32,32,      /* Medium name         */
           32,32,32,32,32,      /*                 */
           0,0,           /* Format Random No         */
           0,1,0,0,          /* Update Counter         */
           6,60,          /* Free Sectors         */
           6,64,          /* Good Sectors         */
           6,64,          /* Total Sectors         */
           0,10,          /* Sectors per Track         */
           0,20,          /* Sectors Per Cylinder    */
           0,80,          /* No of Tracks         */
           0,1,           /* Sectors per block         */
           0,0,           /* Directory EOF block     */
           0,64,          /* Directory EOF byte      */
           0,2,           /* Sector offset per track */
           0,2,4,6,8,128,      /* Logical -> Physical     */
           130,132,134,136,      /*                 */
           1,3,5,7,9,129,      /*                 */
           131,133,135,137,      /*                 */
           255,255,255,255,255,   /* Spare (Phys -> Log ?)   */
           255,255,255,255,255,   /*                 */
           255,255,255,255,255,   /*                 */
           255,255,255,       /*                 */
           255,255,255,255,255,   /* Spare             */
           255,255,255,255,255,   /*                 */
           255,255,255,255,255,   /*                 */
           255,255,255,       /*                 */
           248,0,0,          /* Block 0 = MAP         */
           248,0,1,          /* Block 1 = MAP         */
           248,0,2,          /* Block 2 = MAP         */
           0,0,0};          /* Block 3 = DIR         */
                      /*-------------------------*/


So, 80 tracks, 2 sides, 1 sector per block, 10 sectors per track, which is where 3.2 mB comes from:

2 (sides) * 80 (tracks) * 10 (sectors) * 2 KB = 3.2 Mb.

The interleave factor is 2 which means read sector 0, then 2, 4, 6 & 8 on side 0, then switch sides to side 1 and read 0, 2, 4, 6, 8 there then come back to side 0 and read 1, 3, 5, 7, 9 .... - the logical to physical table shows this. The side number is bit 7.

I assume that this is the order you will need to read the data in order to get it onto a "single sided" SD card.

Do I have this working the right way around (or should the sides loop be
outside the tracks loop?)
See above, the sectors are interleaved. And even worse, when you move from track 0 to track 1, because the drive is spinning as the head moved, to avoid having to wait, you add on the sector offset per track so on side 0, track 1, you read 2,4,6,8,0 then side 1 - 2,4,6,8,0, then side 0 - 3,5,7,9,1 and so on.

This does create an image of the correct size, but I can't get the QL to
read it once converted.
Probably because you have read a whole side at once. Then the other.


HTH

Cheers,
Norm.

OK, so that appears to give an updated program:

100 OPEN_IN #3,'flp2_*D4e'
105 OPEN_NEW #4,ram1_ED_img
107 FOR tracks=0 TO 79
108 side=0
109 FOR sector=1,3,5,7,9
110 GET #3\sector+side*256+tracks*2^16,sector$
111 PRINT #4;sector$;
112 END FOR sector
113 side=1
114 FOR sector=1,3,5,7,9
115 GET #3\sector+side*256+tracks*2^16,sector$
116 PRINT #4;sector$;
117 END FOR sector
118 side=0
119 FOR sector=2,4,6,8,10
120 GET #3\sector+side*256+tracks*2^16,sector$
121 PRINT #4;sector$;
122 END FOR sector
123 side=1
124 FOR sector=2,4,6,8,10
125 GET #3\sector+side*256+tracks*2^16,sector$
126 PRINT #4;sector$;
127 END FOR sector
128 AT 0,0
129 PRINT tracks;' '
127 END FOR tracks
130 CLOSE

(remember that for the GET#3\sector, the first sector is sector 1).

--
Rich Mellor
RWAP Services
Specialist Enuuk Auction Programming Services

www.rwapservices.co.uk


_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to