summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/hect_dsk.c
blob: 4e8794131f8f187537fbd24b411d792190bb6033 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// license:BSD-3-Clause
// copyright-holders:JJ Stacino
/*********************************************************************

    formats/hect_dsk.c

    Hector disk images

*********************************************************************/

#include <assert.h>

#include "formats/hect_dsk.h"
#include "formats/basicdsk.h"

/*****************************************************************************/
/******  Management of the floppy images 200Ko and 800Ko *********************/
/*****************************************************************************/
/* For the 200Ko disk :
        512 bytes per sectors,
        10  sector per track,
        From sector =0 to sector 9,
        40  tracks,
        1 Head
    This format can be extract from a real disc with anadisk (*.IMG format rename in *.HE2).
*/
static FLOPPY_IDENTIFY(hector_disc2_dsk200_identify)
{
	*vote = (floppy_image_size(floppy) == (1*40*10*512)) ? 100 : 0;
	return FLOPPY_ERROR_SUCCESS;
}

static FLOPPY_CONSTRUCT(hector_disc2_dsk200_construct)
{
	struct basicdsk_geometry geometry;
	memset(&geometry, 0, sizeof(geometry));
	geometry.heads = 1;
	geometry.first_sector_id = 0;
	geometry.sector_length = 512;
	geometry.tracks = 40;
	geometry.sectors = 10;
	return basicdsk_construct(floppy, &geometry);
}
/* For the 720Ko disk :
        512 bytes per sectors,
        9  sector per track,
        From sector =0 to sector 8,
        80  tracks,
        2 Head
    This format can be extract from a real disc with anadisk (*.IMG format rename in *.HE7).
*/
static FLOPPY_IDENTIFY(hector_disc2_dsk720_identify)
{
	*vote = (floppy_image_size(floppy) == (2*80*9*512)) ? 100 : 0;
	return FLOPPY_ERROR_SUCCESS;
}

static FLOPPY_CONSTRUCT(hector_disc2_dsk720_construct)
{
	struct basicdsk_geometry geometry;
	memset(&geometry, 0, sizeof(geometry));
	geometry.heads = 2;
	geometry.first_sector_id = 0;
	geometry.sector_length = 512;
	geometry.tracks = 80;
	geometry.sectors = 9;
	return basicdsk_construct(floppy, &geometry);

}/* For the 800Ko disk :
        512 bytes per sectors,
        10  sector per track,
        From sector =0 to sector 9,
        80  tracks
        2 Heads
    This format can be extract from a real disk with anadisk (*.IMG format rename in *.HE2).
*/

static FLOPPY_IDENTIFY(hector_disc2_dsk800_identify)
{
	*vote = (floppy_image_size(floppy) == (2*80*10*512)) ? 100 : 0;
	return FLOPPY_ERROR_SUCCESS;
}

static FLOPPY_CONSTRUCT(hector_disc2_dsk800_construct)
{
	struct basicdsk_geometry geometry;
	memset(&geometry, 0, sizeof(geometry));
	geometry.heads = 2;
	geometry.first_sector_id = 0;
	geometry.sector_length = 512;
	geometry.tracks = 80;
	geometry.sectors = 10;
	return basicdsk_construct(floppy, &geometry);
}

/* For the 720Ko disk  3 1/2 inch disk for the mini disc unit !!:
        512 bytes per sectors,
        9  sector per track,
        From sector =1 to sector 9,
        80  tracks,
        2 Head
    This format can be extract from a real disc with anadisk (*.IMG format rename in *.HE7).
*/

static FLOPPY_IDENTIFY(hector_minidisc_dsk_identify)
{
	*vote = (floppy_image_size(floppy) == (2*70*9*512)) ? 100 : 0;
	return FLOPPY_ERROR_SUCCESS;
}

static FLOPPY_CONSTRUCT(hector_minidisc_dsk_construct)
{
	struct basicdsk_geometry geometry;
	memset(&geometry, 0, sizeof(geometry));  // 635904 octets
	geometry.heads = 2;//2
	geometry.first_sector_id = 1;
	geometry.sector_length = 512;
	geometry.tracks = 70;//69
	geometry.sectors = 9;
	return basicdsk_construct(floppy, &geometry);
}

/* Specific for the mini disc unit */
LEGACY_FLOPPY_OPTIONS_START( hector_minidisc )
	LEGACY_FLOPPY_OPTION( hector_dsk, "HMD", "hector mini disc floppy disk image 360Ko", hector_minidisc_dsk_identify, hector_minidisc_dsk_construct, NULL, NULL)
LEGACY_FLOPPY_OPTIONS_END

LEGACY_FLOPPY_OPTIONS_START( hector_disc2 )
	LEGACY_FLOPPY_OPTION( hector_dsk, "HE2", "hector disc2 floppy disk image 200K", hector_disc2_dsk200_identify, hector_disc2_dsk200_construct, NULL, NULL)
	LEGACY_FLOPPY_OPTION( hector_dsk, "HE7", "hector disc2 floppy disk image 720K", hector_disc2_dsk720_identify, hector_disc2_dsk720_construct, NULL, NULL)
	LEGACY_FLOPPY_OPTION( hector_dsk, "HE8", "hector disc2 floppy disk image 800K", hector_disc2_dsk800_identify, hector_disc2_dsk800_construct, NULL, NULL)
LEGACY_FLOPPY_OPTIONS_END