1 /***************************************************************************
2  *                                                                         *
3  *    LIBDSK: General floppy and diskimage access library                  *
4  *    Copyright (C) 2001-2,2005  John Elliott <seasip.webmaster@gmail.com>     *
5  *                                                                         *
6  *    This library is free software; you can redistribute it and/or        *
7  *    modify it under the terms of the GNU Library General Public          *
8  *    License as published by the Free Software Foundation; either         *
9  *    version 2 of the License, or (at your option) any later version.     *
10  *                                                                         *
11  *    This library is distributed in the hope that it will be useful,      *
12  *    but WITHOUT ANY WARRANTY; without even the implied warranty of       *
13  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    *
14  *    Library General Public License for more details.                     *
15  *                                                                         *
16  *    You should have received a copy of the GNU Library General Public    *
17  *    License along with this library; if not, write to the Free           *
18  *    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,      *
19  *    MA 02111-1307, USA                                                   *
20  *                                                                         *
21  ***************************************************************************/
22 
23 /*
24  * Release 2011-04-06
25 */
26 /* Declarations for the CopyQM driver */
27 typedef enum
28 {
29     QM_DRV_UNKNWN = 0,
30     QM_DRV_525DD = 1,
31     QM_DRV_525HD = 2,
32     QM_DRV_350DD = 3,
33     QM_DRV_350HD = 4,
34     QM_DRV_350ED = 6,
35 } qm_drv_t;
36 
37 typedef struct
38 {
39     DSK_DRIVER    qm_super;
40     char*         qm_filename;
41     size_t        qm_h_sector_size;
42     /* Number of total sectors. Not valid if blind */
43     dsk_psect_t   qm_h_nbr_sectors;
44     dsk_psect_t   qm_h_nbr_sec_per_track;
45     dsk_phead_t   qm_h_nbr_heads;
46     int           qm_h_comment_len;
47     /* Density - 1 means HD, 2 means QD */
48     int           qm_h_density;
49     /* Blind transfer or not. */
50     int           qm_h_blind;
51     dsk_pcyl_t    qm_h_used_cyls;
52     dsk_pcyl_t    qm_h_total_cyls;
53     /* Interleave */
54     int           qm_h_interleave;
55     /* Skew. Negative number for skew between sides */
56     int           qm_h_skew;
57     /* Sector number base. */
58     signed char   qm_h_secbase;
59     /* Source drive type */
60     qm_drv_t      qm_h_drive;
61     /* The crc read from the header */
62     unsigned long qm_h_crc;
63     /* The crc calculated while the image is read */
64     unsigned long qm_calc_crc;
65     unsigned int  qm_image_offset;
66     unsigned char* qm_image;
67     /* Fake sector for READ ID command */
68     dsk_psect_t   qm_sector;
69 } QM_DSK_DRIVER;
70 
71 /* Constants for the QM header fields */
72 
73 #define QM_HEADER_SIZE  133
74 #define QM_H_BASE         0
75 #define QM_H_SECSIZE   0x03
76 #define QM_H_SECTOTL   0x0b
77 #define QM_H_SECPTRK   0x10
78 #define QM_H_HEADS     0x12
79 #define QM_H_DESCR     0x1c
80 #define QM_H_DSCR_SIZE   60
81 #define QM_H_BLIND     0x58
82 #define QM_H_DENS      0x59
83 #define QM_H_USED_CYL  0x5a
84 #define QM_H_TOTL_CYL  0x5b
85 #define QM_H_DATA_CRC  0x5c
86 #define QM_H_LABEL     0x60
87 #define QM_H_LBL_SIZE    11
88 #define QM_H_TIME      0x6b
89 #define QM_H_DATE      0x6d
90 #define QM_H_CMT_SIZE  0x6f
91 #define QM_H_SECBASE   0x71
92 #define QM_H_INTLV     0x74
93 #define QM_H_SKEW      0x75
94 #define QM_H_DRIVE     0x76
95 #define QM_H_HEAD_CRC  0x84
96 
97 #define QM_BLIND_DOS      0
98 #define QM_BLIND_BLN      1
99 #define QM_BLIND_HFS      2
100 
101 #define QM_DENS_DD        0
102 #define QM_DENS_HD        1
103 #define QM_DENS_ED        2
104