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
|
/*********************************************************************
formats/ami_dsk.c
Amiga disk images
*********************************************************************/
#include <string.h>
#include "formats/ami_dsk.h"
#include "formats/basicdsk.h"
/*****************************************************************************
Amiga floppy core functions
*****************************************************************************/
static FLOPPY_IDENTIFY( amiga_dsk_identify )
{
UINT64 size;
*vote = 100;
/* first check the size of the image */
size = floppy_image_size(floppy);
if ((size != 901120) && (size != 1802240))
*vote = 0;
return FLOPPY_ERROR_SUCCESS;
}
static FLOPPY_CONSTRUCT( amiga_dsk_construct )
{
struct basicdsk_geometry geometry;
/* setup geometry with standard values */
memset(&geometry, 0, sizeof(geometry));
geometry.heads = 2;
geometry.tracks = 80;
geometry.first_sector_id = 0;
geometry.sector_length = 512;
if (params)
{
/* create */
geometry.sectors = option_resolution_lookup_int(params, PARAM_SECTORS);
}
else
{
/* open */
UINT64 size = floppy_image_size(floppy);
geometry.sectors = size/512/80/2;
if (geometry.sectors != 11 && geometry.sectors != 22)
return FLOPPY_ERROR_INVALIDIMAGE;
}
return basicdsk_construct(floppy, &geometry);
}
/*****************************************************************************
Amiga floppy options
*****************************************************************************/
FLOPPY_OPTIONS_START( amiga )
FLOPPY_OPTION(
ami_dsk,
"adf",
"Amiga floppy disk image",
amiga_dsk_identify,
amiga_dsk_construct,
NULL,
HEADS([2])
TRACKS([80])
SECTORS([11]/22)
)
FLOPPY_OPTIONS_END
FLOPPY_OPTIONS_START( amiga_only )
FLOPPY_OPTION(
ami_dsk,
"adf",
"Amiga floppy disk image",
amiga_dsk_identify,
amiga_dsk_construct,
NULL,
HEADS([2])
TRACKS([80])
SECTORS([11]/22)
)
FLOPPY_OPTIONS_END0
|