3 Copyright (C) 1999 Gareth Owen <gaz@athene.co.uk>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 typedef struct DrvGeom {
31 BYTE spt; /* sectors per track */
34 /* drive geometries */
35 #define DG144_HEADS 2 /* heads per drive (1.44M) */
36 #define DG144_TRACKS 80 /* number of tracks (1.44M) */
37 #define DG144_SPT 18 /* sectors per track (1.44M) */
38 #define DG144_GAP3FMT 0x54 /* gap3 while formatting (1.44M) */
39 #define DG144_GAP3RW 0x1b /* gap3 while reading/writing (1.44M) */
41 #define DG168_HEADS 2 /* heads per drive (1.68M) */
42 #define DG168_TRACKS 80 /* number of tracks (1.68M) */
43 #define DG168_SPT 21 /* sectors per track (1.68M) */
44 #define DG168_GAP3FMT 0x0c /* gap3 while formatting (1.68M) */
45 #define DG168_GAP3RW 0x1c /* gap3 while reading/writing (1.68M) */
48 #define FDC_DOR (0x3f2) /* Digital Output Register */
49 #define FDC_MSR (0x3f4) /* Main Status Register (input) */
50 #define FDC_DRS (0x3f4) /* Data Rate Select Register (output) */
51 #define FDC_DATA (0x3f5) /* Data Register */
52 #define FDC_DIR (0x3f7) /* Digital Input Register (input) */
53 #define FDC_CCR (0x3f7) /* Configuration Control Register (output) */
55 /* command bytes (these are 765 commands + options such as MFM, etc) */
56 #define CMD_SPECIFY (0x03) /* specify drive timings */
57 #define CMD_WRITE (0xc5) /* write data (+ MT,MFM) */
58 #define CMD_READ (0xe6) /* read data (+ MT,MFM,SK) */
59 #define CMD_RECAL (0x07) /* recalibrate */
60 #define CMD_SENSEI (0x08) /* sense interrupt status */
61 #define CMD_FORMAT (0x4d) /* format track (+ MFM) */
62 #define CMD_SEEK (0x0f) /* seek track */
63 #define CMD_VERSION (0x10) /* FDC version */
66 /* function prototypes */
68 extern void init_floppy();
69 /*void deinit(void); */
71 extern void reset(void);
72 extern BOOL diskchange(void);
73 extern void motoron(void);
74 extern void motoroff(void);
75 extern void recalibrate(void);
76 extern BOOL seek(int track);
77 extern BOOL log_disk(DrvGeom *g);
78 extern BOOL read_block(int block,BYTE *blockbuff,unsigned long nosectors);
79 extern BOOL write_block(int block,BYTE *blockbuff,unsigned long nosectors);
80 extern BOOL format_track(BYTE track,DrvGeom *g);
81 extern void floppy_detect(void);