eb70ef1a1036c60ffe04975911c9bf4638418dbc
1 /*************************************************************************
3 * $Id: sim_imd.h 1904 2008-05-21 06:57:57Z hharte $ *
5 * Copyright (c) 2007-2008 Howard M. Harte. *
6 * http://www.hartetec.com *
8 * Permission is hereby granted, free of charge, to any person obtaining *
9 * a copy of this software and associated documentation files (the *
10 * "Software"), to deal in the Software without restriction, including *
11 * without limitation the rights to use, copy, modify, merge, publish, *
12 * distribute, sublicense, and/or sell copies of the Software, and to *
13 * permit persons to whom the Software is furnished to do so, subject to *
14 * the following conditions: *
16 * The above copyright notice and this permission notice shall be *
17 * included in all copies or substantial portions of the Software. *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
22 * NONINFRINGEMENT. IN NO EVENT SHALL HOWARD M. HARTE BE LIABLE FOR ANY *
23 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, *
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE *
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
27 * Except as contained in this notice, the name of Howard M. Harte shall *
28 * not be used in advertising or otherwise to promote the sale, use or *
29 * other dealings in this Software without prior written authorization *
32 * SIMH Interface based on altairz80_hdsk.c, by Peter Schorn. *
34 * Module Description: *
35 * ImageDisk Disk Image File access module for SIMH, definitions. *
37 * for details on the ImageDisk format and other utilities. *
42 *************************************************************************/
49 unsigned char sectsize
;
53 #define IMD_FLAG_SECT_HEAD_MAP (1 << 6)
54 #define IMD_FLAG_SECT_CYL_MAP (1 << 7)
56 #define SECT_RECORD_UNAVAILABLE 0 /* Data could not be read from the original media */
57 #define SECT_RECORD_NORM 1 /* Normal Data */
58 #define SECT_RECORD_NORM_COMP 2 /* Compressed Normal Data */
59 #define SECT_RECORD_NORM_DAM 3 /* Normal Data with deleted address mark */
60 #define SECT_RECORD_NORM_DAM_COMP 4 /* Compressed Normal Data with deleted address mark */
61 #define SECT_RECORD_NORM_ERR 5 /* Normal Data */
62 #define SECT_RECORD_NORM_COMP_ERR 6 /* Compressed Normal Data */
63 #define SECT_RECORD_NORM_DAM_ERR 7 /* Normal Data with deleted address mark */
64 #define SECT_RECORD_NORM_DAM_COMP_ERR 8 /* Compressed Normal Data with deleted address mark */
70 #define FD_FLAG_WRITELOCK 1
72 #define IMD_DISK_IO_ERROR_GENERAL (1 << 0) /* General data error. */
73 #define IMD_DISK_IO_ERROR_CRC (1 << 1) /* Data read/written, but got a CRC error. */
74 #define IMD_DISK_IO_DELETED_ADDR_MARK (1 << 2) /* Sector had a deleted address mark */
75 #define IMD_DISK_IO_COMPRESSED (1 << 3) /* Sector is compressed in the IMD file (Read Only) */
77 #define IMD_MODE_500K_FM 0
78 #define IMD_MODE_300K_FM 1
79 #define IMD_MODE_250K_FM 2
80 #define IMD_MODE_500K_MFM 3
81 #define IMD_MODE_300K_MFM 4
82 #define IMD_MODE_250K_MFM 5
84 #define IMD_MODE_FM(x) (x <= IMD_MODE_250K_FM)
85 #define IMD_MODE_MFM(x) (x >= IMD_MODE_500K_MFM)
90 unsigned int sectsize
;
91 unsigned int sectorOffsetMap
[MAX_SPT
];
92 unsigned char start_sector
;
100 TRACK_INFO track
[MAX_CYL
][MAX_HEAD
];
103 extern DISK_INFO
*diskOpen(FILE *fileref
, int isVerbose
); /*char *filename); */
104 extern unsigned int diskClose(DISK_INFO
*myDisk
);
105 extern unsigned int imdGetSides(DISK_INFO
*myDisk
);
106 extern unsigned int imdIsWriteLocked(DISK_INFO
*myDisk
);
108 extern int sectSeek(DISK_INFO
*myDisk
, unsigned int Cyl
, unsigned int Head
);
109 extern int sectRead(DISK_INFO
*myDisk
, unsigned int Cyl
, unsigned int Head
, unsigned int Sector
, unsigned char *buf
, unsigned int buflen
, unsigned int *flags
, unsigned int *readlen
);
110 extern int sectWrite(DISK_INFO
*myDisk
, unsigned int Cyl
, unsigned int Head
, unsigned int Sector
, unsigned char *buf
, unsigned int buflen
, unsigned int *flags
, unsigned int *writelen
);