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
|
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
// Creation of unformatted floppy images
#include "emu.h"
#include "fs_unformatted.h"
void fs_unformatted::enumerate_f(floppy_enumerator &fe, uint32_t form_factor, const std::vector<uint32_t> &variants) const
{
bool all = form_factor == floppy_image::FF_UNKNOWN;
u32 best_8 =
form_factor == floppy_image::FF_8 ?
has_variant(variants, floppy_image::DSDD) ? FSI_8_DSDD :
has_variant(variants, floppy_image::DSSD) ? FSI_8_DSSD : FSI_8_SSSD
: FSI_NONE;
u32 best_525 =
form_factor == floppy_image::FF_525 ?
has_variant(variants, floppy_image::DSHD) ? FSI_525_DSHD :
has_variant(variants, floppy_image::DSQD) ? FSI_525_DSQD :
has_variant(variants, floppy_image::DSDD) ? FSI_525_DSDD :
has_variant(variants, floppy_image::SSQD) ? FSI_525_SSQD :
has_variant(variants, floppy_image::SSDD) ? FSI_525_SSDD : FSI_525_SSSD
: FSI_NONE;
u32 best_35 =
form_factor == floppy_image::FF_35 ?
has_variant(variants, floppy_image::DSDD) ? FSI_35_DSDD : FSI_35_SSDD
: FSI_NONE;
u32 best_3 =
form_factor == floppy_image::FF_3 ?
has_variant(variants, floppy_image::DSDD) ? FSI_3_DSDD : FSI_3_SSDD
: FSI_NONE;
if(all || best_8 == FSI_8_DSDD)
fe.add_raw("u8dsdd", FSI_8_DSDD, "Unformatted 8\" double-sided double-density");
if(all || best_8 == FSI_8_DSSD)
fe.add_raw("u8dssd", FSI_8_DSSD, "Unformatted 8\" double-sided single-density");
if(all || best_8 == FSI_8_SSSD)
fe.add_raw("u8sssd", FSI_8_SSSD, "Unformatted 8\" single-sided single-density");
if(all || best_525 == FSI_525_DSHD)
fe.add_raw("u525dshd", FSI_525_DSHD, "Unformatted 5\"25 double-sided high-density");
if(all || best_525 == FSI_525_DSQD)
fe.add_raw("u525dsqd", FSI_525_DSQD, "Unformatted 5\"25 double-sided quad-density");
if(all || best_525 == FSI_525_DSDD)
fe.add_raw("u525dsdd", FSI_525_DSDD, "Unformatted 5\"25 double-sided double-density");
if(all)
fe.add_raw("u525dssd", FSI_525_DSSD, "Unformatted 5\"25 double-sided single-density");
if(all || best_525 == FSI_525_SSQD)
fe.add_raw("u525ssqd", FSI_525_SSQD, "Unformatted 5\"25 single-sided quad-density");
if(all || best_525 == FSI_525_SSDD)
fe.add_raw("u525ssdd", FSI_525_SSDD, "Unformatted 5\"25 single-sided double-density");
if(all || best_525 == FSI_525_SSSD)
fe.add_raw("u525sssd", FSI_525_SSSD, "Unformatted 5\"25 single-sided single-density");
if(all || has_variant(variants, floppy_image::DSED))
fe.add_raw("u35dsed", FSI_35_DSED, "Unformatted 3\"5 double-sided extra-density");
if(all || has_variant(variants, floppy_image::DSHD))
fe.add_raw("u35dshd", FSI_35_DSHD, "Unformatted 3\"5 double-sided high-density");
if(all || best_35 == FSI_35_DSDD)
fe.add_raw("u35dsdd", FSI_35_DSDD, "Unformatted 3\"5 double-sided double-density");
if(all || best_35 == FSI_35_SSDD)
fe.add_raw("u35ssdd", FSI_35_SSDD, "Unformatted 3\"5 single-sided double-density");
if(all || best_3 == FSI_3_DSDD)
fe.add_raw("u3dsdd", FSI_35_DSDD, "Unformatted 3\" double-sided double-density");
if(all || best_3 == FSI_3_SSDD)
fe.add_raw("u3ssdd", FSI_35_SSDD, "Unformatted 3\" single-sided double-density");
}
void fs_unformatted::format(u32 key, floppy_image *image)
{
switch(key) {
case FSI_8_DSDD: image->set_form_variant(floppy_image::FF_8, floppy_image::DSDD); break;
case FSI_8_DSSD: image->set_form_variant(floppy_image::FF_8, floppy_image::DSSD); break;
case FSI_8_SSSD: image->set_form_variant(floppy_image::FF_8, floppy_image::SSSD); break;
case FSI_525_DSHD: image->set_form_variant(floppy_image::FF_525, floppy_image::DSHD); break;
case FSI_525_DSQD: image->set_form_variant(floppy_image::FF_525, floppy_image::DSQD); break;
case FSI_525_DSDD: image->set_form_variant(floppy_image::FF_525, floppy_image::DSDD); break;
case FSI_525_DSSD: image->set_form_variant(floppy_image::FF_525, floppy_image::DSSD); break;
case FSI_525_SSQD: image->set_form_variant(floppy_image::FF_525, floppy_image::SSQD); break;
case FSI_525_SSDD: image->set_form_variant(floppy_image::FF_525, floppy_image::SSDD); break;
case FSI_525_SSSD: image->set_form_variant(floppy_image::FF_525, floppy_image::SSSD); break;
case FSI_35_DSED: image->set_form_variant(floppy_image::FF_35, floppy_image::DSED); break;
case FSI_35_DSHD: image->set_form_variant(floppy_image::FF_35, floppy_image::DSHD); break;
case FSI_35_DSDD: image->set_form_variant(floppy_image::FF_35, floppy_image::DSDD); break;
case FSI_35_SSDD: image->set_form_variant(floppy_image::FF_35, floppy_image::SSDD); break;
case FSI_3_DSDD: image->set_form_variant(floppy_image::FF_3, floppy_image::DSDD); break;
case FSI_3_SSDD: image->set_form_variant(floppy_image::FF_3, floppy_image::SSDD); break;
}
}
std::unique_ptr<filesystem_t> fs_unformatted::mount(fsblk_t &blockdev) const
{
return nullptr;
}
bool fs_unformatted::can_format() const
{
return false;
}
bool fs_unformatted::can_read() const
{
return false;
}
bool fs_unformatted::can_write() const
{
return false;
}
const filesystem_manager_type FS_UNFORMATTED = &filesystem_manager_creator<fs_unformatted>;
|