summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/formats')
-rw-r--r--src/lib/formats/a26_cas.cpp2
-rw-r--r--src/lib/formats/a5105_dsk.cpp2
-rw-r--r--src/lib/formats/abc800_dsk.cpp2
-rw-r--r--src/lib/formats/abcfd2_dsk.cpp2
-rw-r--r--src/lib/formats/ace_tap.cpp2
-rw-r--r--src/lib/formats/acorn_dsk.cpp10
-rw-r--r--src/lib/formats/adam_cas.cpp2
-rw-r--r--src/lib/formats/adam_dsk.cpp2
-rw-r--r--src/lib/formats/agat840k_hle_dsk.cpp2
-rw-r--r--src/lib/formats/aim_dsk.cpp2
-rw-r--r--src/lib/formats/ami_dsk.cpp2
-rw-r--r--src/lib/formats/ap2_dsk.cpp12
-rw-r--r--src/lib/formats/ap_dsk35.cpp4
-rw-r--r--src/lib/formats/apf_apt.cpp2
-rw-r--r--src/lib/formats/apollo_dsk.cpp2
-rw-r--r--src/lib/formats/applix_dsk.cpp2
-rw-r--r--src/lib/formats/asst128_dsk.cpp2
-rw-r--r--src/lib/formats/atari_dsk.cpp2
-rw-r--r--src/lib/formats/atom_tap.cpp2
-rw-r--r--src/lib/formats/basicdsk.cpp6
-rw-r--r--src/lib/formats/bw12_dsk.cpp2
-rw-r--r--src/lib/formats/bw2_dsk.cpp2
-rw-r--r--src/lib/formats/c3040_dsk.cpp2
-rw-r--r--src/lib/formats/c4040_dsk.cpp2
-rw-r--r--src/lib/formats/camplynx_dsk.cpp2
-rw-r--r--src/lib/formats/cassimg.cpp4
-rw-r--r--src/lib/formats/cbm_tap.cpp2
-rw-r--r--src/lib/formats/cgen_cas.cpp2
-rw-r--r--src/lib/formats/comx35_dsk.cpp2
-rw-r--r--src/lib/formats/concept_dsk.cpp2
-rw-r--r--src/lib/formats/coupedsk.cpp2
-rw-r--r--src/lib/formats/cqm_dsk.cpp4
-rw-r--r--src/lib/formats/csw_cas.cpp4
-rw-r--r--src/lib/formats/d71_dsk.cpp2
-rw-r--r--src/lib/formats/d80_dsk.cpp2
-rw-r--r--src/lib/formats/d81_dsk.cpp2
-rw-r--r--src/lib/formats/d82_dsk.cpp2
-rw-r--r--src/lib/formats/d88_dsk.cpp2
-rw-r--r--src/lib/formats/dcp_dsk.cpp2
-rw-r--r--src/lib/formats/dim_dsk.cpp4
-rw-r--r--src/lib/formats/dip_dsk.cpp2
-rw-r--r--src/lib/formats/dmk_dsk.cpp2
-rw-r--r--src/lib/formats/dmv_dsk.cpp2
-rw-r--r--src/lib/formats/ds9_dsk.cpp2
-rw-r--r--src/lib/formats/dsk_dsk.cpp4
-rw-r--r--src/lib/formats/dvk_mx_dsk.cpp2
-rw-r--r--src/lib/formats/ep64_dsk.cpp2
-rw-r--r--src/lib/formats/esq16_dsk.cpp2
-rw-r--r--src/lib/formats/esq8_dsk.cpp2
-rw-r--r--src/lib/formats/excali64_dsk.cpp2
-rw-r--r--src/lib/formats/fc100_cas.cpp2
-rw-r--r--src/lib/formats/fdd_dsk.cpp2
-rw-r--r--src/lib/formats/fdi_dsk.cpp2
-rw-r--r--src/lib/formats/flopimg.cpp12
-rw-r--r--src/lib/formats/fm7_cas.cpp2
-rw-r--r--src/lib/formats/fmsx_cas.cpp2
-rw-r--r--src/lib/formats/fmtowns_dsk.cpp2
-rw-r--r--src/lib/formats/gtp_cas.cpp2
-rw-r--r--src/lib/formats/hect_dsk.cpp2
-rw-r--r--src/lib/formats/hect_tap.cpp2
-rw-r--r--src/lib/formats/hp_ipc_dsk.cpp2
-rw-r--r--src/lib/formats/hxcmfm_dsk.cpp2
-rw-r--r--src/lib/formats/imageutl.cpp2
-rw-r--r--src/lib/formats/imd_dsk.cpp4
-rw-r--r--src/lib/formats/img_dsk.cpp378
-rw-r--r--src/lib/formats/img_dsk.h55
-rw-r--r--src/lib/formats/ioprocs.cpp6
-rw-r--r--src/lib/formats/ioprocs.h4
-rw-r--r--src/lib/formats/ipf_dsk.cpp2
-rw-r--r--src/lib/formats/iq151_dsk.cpp2
-rw-r--r--src/lib/formats/itt3030_dsk.cpp2
-rw-r--r--src/lib/formats/jvc_dsk.cpp8
-rw-r--r--src/lib/formats/kaypro_dsk.cpp2
-rw-r--r--src/lib/formats/kc85_dsk.cpp2
-rw-r--r--src/lib/formats/kc_cas.cpp2
-rw-r--r--src/lib/formats/kim1_cas.cpp2
-rw-r--r--src/lib/formats/lviv_lvt.cpp2
-rw-r--r--src/lib/formats/m5_dsk.cpp2
-rw-r--r--src/lib/formats/mbee_cas.cpp2
-rw-r--r--src/lib/formats/mfi_dsk.cpp2
-rw-r--r--src/lib/formats/mm_dsk.cpp2
-rw-r--r--src/lib/formats/ms0515_dsk.cpp2
-rw-r--r--src/lib/formats/mz_cas.cpp4
-rw-r--r--src/lib/formats/nanos_dsk.cpp2
-rw-r--r--src/lib/formats/naslite_dsk.cpp2
-rw-r--r--src/lib/formats/nes_dsk.cpp4
-rw-r--r--src/lib/formats/nfd_dsk.cpp2
-rw-r--r--src/lib/formats/orao_cas.cpp2
-rw-r--r--src/lib/formats/oric_tap.cpp2
-rw-r--r--src/lib/formats/p6001_cas.cpp2
-rw-r--r--src/lib/formats/pc98_dsk.cpp4
-rw-r--r--src/lib/formats/pc98fdi_dsk.cpp2
-rw-r--r--src/lib/formats/pc_dsk.cpp4
-rw-r--r--src/lib/formats/phc25_cas.cpp2
-rw-r--r--src/lib/formats/pmd_cas.cpp2
-rw-r--r--src/lib/formats/ppg_dsk.cpp2
-rw-r--r--src/lib/formats/primoptp.cpp2
-rw-r--r--src/lib/formats/pyldin_dsk.cpp2
-rw-r--r--src/lib/formats/ql_dsk.cpp2
-rw-r--r--src/lib/formats/rk_cas.cpp2
-rw-r--r--src/lib/formats/rx50_dsk.cpp2
-rw-r--r--src/lib/formats/sc3000_bit.cpp2
-rw-r--r--src/lib/formats/sdf_dsk.cpp2
-rw-r--r--src/lib/formats/sf7000_dsk.cpp2
-rw-r--r--src/lib/formats/smx_dsk.cpp2
-rw-r--r--src/lib/formats/sol_cas.cpp2
-rw-r--r--src/lib/formats/sorc_cas.cpp2
-rw-r--r--src/lib/formats/sorc_dsk.cpp4
-rw-r--r--src/lib/formats/sord_cas.cpp4
-rw-r--r--src/lib/formats/spc1000_cas.cpp2
-rw-r--r--src/lib/formats/st_dsk.cpp2
-rw-r--r--src/lib/formats/svi_cas.cpp2
-rw-r--r--src/lib/formats/tandy2k_dsk.cpp2
-rw-r--r--src/lib/formats/td0_dsk.cpp4
-rw-r--r--src/lib/formats/thom_cas.cpp4
-rw-r--r--src/lib/formats/thom_dsk.cpp4
-rw-r--r--src/lib/formats/ti99_dsk.cpp6
-rw-r--r--src/lib/formats/tiki100_dsk.cpp2
-rw-r--r--src/lib/formats/trd_dsk.cpp2
-rw-r--r--src/lib/formats/trs_cas.cpp2
-rw-r--r--src/lib/formats/tvc_cas.cpp2
-rw-r--r--src/lib/formats/tvc_dsk.cpp2
-rw-r--r--src/lib/formats/tzx_cas.cpp2
-rw-r--r--src/lib/formats/uef_cas.cpp6
-rw-r--r--src/lib/formats/vg5k_cas.cpp2
-rw-r--r--src/lib/formats/vt_cas.cpp2
-rw-r--r--src/lib/formats/wavfile.cpp4
-rw-r--r--src/lib/formats/x07_cas.cpp2
-rw-r--r--src/lib/formats/x1_tap.cpp2
-rw-r--r--src/lib/formats/xdf_dsk.cpp2
-rw-r--r--src/lib/formats/zx81_p.cpp2
131 files changed, 610 insertions, 167 deletions
diff --git a/src/lib/formats/a26_cas.cpp b/src/lib/formats/a26_cas.cpp
index 5030c2bfe0f..0074da6aba3 100644
--- a/src/lib/formats/a26_cas.cpp
+++ b/src/lib/formats/a26_cas.cpp
@@ -6,7 +6,7 @@ Atari 2600 SuperCharger support
*/
-#include <assert.h>
+#include <cassert>
#include "formats/a26_cas.h"
diff --git a/src/lib/formats/a5105_dsk.cpp b/src/lib/formats/a5105_dsk.cpp
index 33d7f15e1fd..f44c8c5f263 100644
--- a/src/lib/formats/a5105_dsk.cpp
+++ b/src/lib/formats/a5105_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/a5105_dsk.h"
diff --git a/src/lib/formats/abc800_dsk.cpp b/src/lib/formats/abc800_dsk.cpp
index e61a0a1d1ff..af1f92ec75c 100644
--- a/src/lib/formats/abc800_dsk.cpp
+++ b/src/lib/formats/abc800_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/abc800_dsk.h"
diff --git a/src/lib/formats/abcfd2_dsk.cpp b/src/lib/formats/abcfd2_dsk.cpp
index 8cc87ae20cd..94684f0ef5d 100644
--- a/src/lib/formats/abcfd2_dsk.cpp
+++ b/src/lib/formats/abcfd2_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/abcfd2_dsk.h"
diff --git a/src/lib/formats/ace_tap.cpp b/src/lib/formats/ace_tap.cpp
index 56b4bd877c8..522050f612a 100644
--- a/src/lib/formats/ace_tap.cpp
+++ b/src/lib/formats/ace_tap.cpp
@@ -10,7 +10,7 @@ For more information see:
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "ace_tap.h"
diff --git a/src/lib/formats/acorn_dsk.cpp b/src/lib/formats/acorn_dsk.cpp
index d8992b9ad5a..d0f0bdb93aa 100644
--- a/src/lib/formats/acorn_dsk.cpp
+++ b/src/lib/formats/acorn_dsk.cpp
@@ -45,6 +45,11 @@ int acorn_ssd_format::find_size(io_generic *io, uint32_t form_factor)
if (memcmp(cat, "\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd", 4) == 0 && size == (uint64_t)compute_track_size(f) * f.track_count * f.head_count)
return i;
+ // test for HADFS - test pattern at sector 70
+ io_generic_read(io, cat, 0x04610, 8);
+ if (memcmp(cat, "\x00\x28\x43\x29\x4a\x47\x48\x00", 4) == 0 && size == (uint64_t)compute_track_size(f) * f.track_count * f.head_count)
+ return i;
+
// read sector count from side 0 catalogue
io_generic_read(io, cat, 0x100, 8);
sectors0 = ((cat[6] & 3) << 8) + cat[7];
@@ -170,6 +175,11 @@ int acorn_dsd_format::find_size(io_generic *io, uint32_t form_factor)
if (memcmp(cat, "\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd", 4) == 0 && size == (uint64_t)compute_track_size(f) * f.track_count * f.head_count)
return i;
+ // test for HADFS - test pattern at sector 70
+ io_generic_read(io, cat, 0x08c10, 8);
+ if (memcmp(cat, "\x00\x28\x43\x29\x4a\x47\x48\x00", 4) == 0 && size == (uint64_t)compute_track_size(f) * f.track_count * f.head_count)
+ return i;
+
// read sector count from side 0 catalogue
io_generic_read(io, cat, 0x100, 8);
sectors0 = ((cat[6] & 3) << 8) + cat[7];
diff --git a/src/lib/formats/adam_cas.cpp b/src/lib/formats/adam_cas.cpp
index 3de9413cb90..5d24eed2543 100644
--- a/src/lib/formats/adam_cas.cpp
+++ b/src/lib/formats/adam_cas.cpp
@@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:Curt Coder
-#include <assert.h>
+#include <cassert>
#include "cassimg.h"
#include "adam_cas.h"
diff --git a/src/lib/formats/adam_dsk.cpp b/src/lib/formats/adam_dsk.cpp
index e78e94a4763..3010aa309b2 100644
--- a/src/lib/formats/adam_dsk.cpp
+++ b/src/lib/formats/adam_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/adam_dsk.h"
diff --git a/src/lib/formats/agat840k_hle_dsk.cpp b/src/lib/formats/agat840k_hle_dsk.cpp
index 52cdd4668be..682b0edd7ad 100644
--- a/src/lib/formats/agat840k_hle_dsk.cpp
+++ b/src/lib/formats/agat840k_hle_dsk.cpp
@@ -12,7 +12,7 @@
************************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/agat840k_hle_dsk.h"
diff --git a/src/lib/formats/aim_dsk.cpp b/src/lib/formats/aim_dsk.cpp
index 3bc2c2b5b5f..5abc410d57c 100644
--- a/src/lib/formats/aim_dsk.cpp
+++ b/src/lib/formats/aim_dsk.cpp
@@ -12,7 +12,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "aim_dsk.h"
diff --git a/src/lib/formats/ami_dsk.cpp b/src/lib/formats/ami_dsk.cpp
index 8a757e6a4c9..ba04067f752 100644
--- a/src/lib/formats/ami_dsk.cpp
+++ b/src/lib/formats/ami_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/ami_dsk.h"
diff --git a/src/lib/formats/ap2_dsk.cpp b/src/lib/formats/ap2_dsk.cpp
index a2fa0ee188a..9e71303ece5 100644
--- a/src/lib/formats/ap2_dsk.cpp
+++ b/src/lib/formats/ap2_dsk.cpp
@@ -8,9 +8,9 @@
*********************************************************************/
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
+#include <cstdlib>
+#include <cstring>
+#include <cassert>
#include "ap2_dsk.h"
#include "basicdsk.h"
@@ -496,19 +496,19 @@ static uint32_t apple2_get_track_size(floppy_image_legacy *floppy, int head, int
LEGACY_FLOPPY_OPTIONS_START( apple2 )
LEGACY_FLOPPY_OPTION( apple2_do, "do,dsk,bin", "Apple ][ DOS order disk image", apple2_dsk_identify, apple2_do_construct, nullptr,
HEADS([1])
- TRACKS([APPLE2_TRACK_COUNT])
+ TRACKS([40]) // APPLE2_TRACK_COUNT
SECTORS([16])
SECTOR_LENGTH([256])
FIRST_SECTOR_ID([0]))
LEGACY_FLOPPY_OPTION( apple2_po, "po,dsk,bin", "Apple ][ ProDOS order disk image", apple2_dsk_identify, apple2_po_construct, nullptr,
HEADS([1])
- TRACKS([APPLE2_TRACK_COUNT])
+ TRACKS([40]) // APPLE2_TRACK_COUNT
SECTORS([16])
SECTOR_LENGTH([256])
FIRST_SECTOR_ID([0]))
LEGACY_FLOPPY_OPTION( apple2_nib, "dsk,nib", "Apple ][ Nibble order disk image", apple2_nib_identify, apple2_nib_construct, nullptr,
HEADS([1])
- TRACKS([APPLE2_TRACK_COUNT])
+ TRACKS([40]) // APPLE2_TRACK_COUNT
SECTORS([16])
SECTOR_LENGTH([256])
FIRST_SECTOR_ID([0]))
diff --git a/src/lib/formats/ap_dsk35.cpp b/src/lib/formats/ap_dsk35.cpp
index c18ea8c65d4..677cfcc9463 100644
--- a/src/lib/formats/ap_dsk35.cpp
+++ b/src/lib/formats/ap_dsk35.cpp
@@ -98,8 +98,8 @@
*********************************************************************/
-#include <stdio.h>
-#include <assert.h>
+#include <cstdio>
+#include <cassert>
#include "emu.h" // logerror
#include "ap_dsk35.h"
diff --git a/src/lib/formats/apf_apt.cpp b/src/lib/formats/apf_apt.cpp
index de919b0bddd..28793f0f853 100644
--- a/src/lib/formats/apf_apt.cpp
+++ b/src/lib/formats/apf_apt.cpp
@@ -34,7 +34,7 @@ e. A checksum byte (8-bit addition)
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/apf_apt.h"
diff --git a/src/lib/formats/apollo_dsk.cpp b/src/lib/formats/apollo_dsk.cpp
index b2fef28be71..213286dd85b 100644
--- a/src/lib/formats/apollo_dsk.cpp
+++ b/src/lib/formats/apollo_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/apollo_dsk.h"
diff --git a/src/lib/formats/applix_dsk.cpp b/src/lib/formats/applix_dsk.cpp
index 59a0d4c06f5..70a52c42ccb 100644
--- a/src/lib/formats/applix_dsk.cpp
+++ b/src/lib/formats/applix_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/applix_dsk.h"
diff --git a/src/lib/formats/asst128_dsk.cpp b/src/lib/formats/asst128_dsk.cpp
index fe64cc725ee..e0c90636484 100644
--- a/src/lib/formats/asst128_dsk.cpp
+++ b/src/lib/formats/asst128_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/asst128_dsk.h"
diff --git a/src/lib/formats/atari_dsk.cpp b/src/lib/formats/atari_dsk.cpp
index d73cbf8185f..4008ec32fe3 100644
--- a/src/lib/formats/atari_dsk.cpp
+++ b/src/lib/formats/atari_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/atari_dsk.h"
diff --git a/src/lib/formats/atom_tap.cpp b/src/lib/formats/atom_tap.cpp
index 881433ef1a8..1c8c3642838 100644
--- a/src/lib/formats/atom_tap.cpp
+++ b/src/lib/formats/atom_tap.cpp
@@ -40,7 +40,7 @@
*/
-#include <assert.h>
+#include <cassert>
#include "atom_tap.h"
#include "csw_cas.h"
diff --git a/src/lib/formats/basicdsk.cpp b/src/lib/formats/basicdsk.cpp
index 9de079232e0..c654362309e 100644
--- a/src/lib/formats/basicdsk.cpp
+++ b/src/lib/formats/basicdsk.cpp
@@ -8,9 +8,9 @@
*********************************************************************/
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
+#include <cstdlib>
+#include <cstring>
+#include <cassert>
#include "basicdsk.h"
diff --git a/src/lib/formats/bw12_dsk.cpp b/src/lib/formats/bw12_dsk.cpp
index 06c8be72347..407db641d9c 100644
--- a/src/lib/formats/bw12_dsk.cpp
+++ b/src/lib/formats/bw12_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/bw12_dsk.h"
diff --git a/src/lib/formats/bw2_dsk.cpp b/src/lib/formats/bw2_dsk.cpp
index 3dc46e9b225..297f78f863f 100644
--- a/src/lib/formats/bw2_dsk.cpp
+++ b/src/lib/formats/bw2_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/bw2_dsk.h"
diff --git a/src/lib/formats/c3040_dsk.cpp b/src/lib/formats/c3040_dsk.cpp
index 78786979953..b5c35f9d2e5 100644
--- a/src/lib/formats/c3040_dsk.cpp
+++ b/src/lib/formats/c3040_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/c3040_dsk.h"
diff --git a/src/lib/formats/c4040_dsk.cpp b/src/lib/formats/c4040_dsk.cpp
index e6314f69261..69d371525c1 100644
--- a/src/lib/formats/c4040_dsk.cpp
+++ b/src/lib/formats/c4040_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/c4040_dsk.h"
diff --git a/src/lib/formats/camplynx_dsk.cpp b/src/lib/formats/camplynx_dsk.cpp
index c58b12b9423..46cd4f2a55d 100644
--- a/src/lib/formats/camplynx_dsk.cpp
+++ b/src/lib/formats/camplynx_dsk.cpp
@@ -19,7 +19,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/camplynx_dsk.h"
diff --git a/src/lib/formats/cassimg.cpp b/src/lib/formats/cassimg.cpp
index 816af2dccfd..4f5d9320754 100644
--- a/src/lib/formats/cassimg.cpp
+++ b/src/lib/formats/cassimg.cpp
@@ -8,8 +8,8 @@
*********************************************************************/
-#include <string.h>
-#include <assert.h>
+#include <cstring>
+#include <cassert>
#include "imageutl.h"
#include "cassimg.h"
diff --git a/src/lib/formats/cbm_tap.cpp b/src/lib/formats/cbm_tap.cpp
index e621651f577..7ef8015c6f9 100644
--- a/src/lib/formats/cbm_tap.cpp
+++ b/src/lib/formats/cbm_tap.cpp
@@ -94,7 +94,7 @@ Unfortunately, I have no such a .tap file to test, so my implementation
below could be not working. FP ]
*/
-#include <assert.h>
+#include <cassert>
#include "cbm_tap.h"
diff --git a/src/lib/formats/cgen_cas.cpp b/src/lib/formats/cgen_cas.cpp
index be4b9397f89..de47a45375d 100644
--- a/src/lib/formats/cgen_cas.cpp
+++ b/src/lib/formats/cgen_cas.cpp
@@ -19,7 +19,7 @@ We now support these three types below...
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/cgen_cas.h"
diff --git a/src/lib/formats/comx35_dsk.cpp b/src/lib/formats/comx35_dsk.cpp
index aa8603f3c1c..a06f1a2dd6c 100644
--- a/src/lib/formats/comx35_dsk.cpp
+++ b/src/lib/formats/comx35_dsk.cpp
@@ -36,7 +36,7 @@
*/
-#include <assert.h>
+#include <cassert>
#include "formats/comx35_dsk.h"
diff --git a/src/lib/formats/concept_dsk.cpp b/src/lib/formats/concept_dsk.cpp
index eea65064fc7..b8c010af852 100644
--- a/src/lib/formats/concept_dsk.cpp
+++ b/src/lib/formats/concept_dsk.cpp
@@ -10,7 +10,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "flopimg.h"
#include "formats/concept_dsk.h"
diff --git a/src/lib/formats/coupedsk.cpp b/src/lib/formats/coupedsk.cpp
index 045e42b7bb5..967896195f1 100644
--- a/src/lib/formats/coupedsk.cpp
+++ b/src/lib/formats/coupedsk.cpp
@@ -8,7 +8,7 @@
**************************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/coupedsk.h"
#include "flopimg.h"
diff --git a/src/lib/formats/cqm_dsk.cpp b/src/lib/formats/cqm_dsk.cpp
index e2bde8fcf8c..c38f06bde1c 100644
--- a/src/lib/formats/cqm_dsk.cpp
+++ b/src/lib/formats/cqm_dsk.cpp
@@ -8,8 +8,8 @@
*********************************************************************/
-#include <string.h>
-#include <assert.h>
+#include <cstring>
+#include <cassert>
#include "flopimg.h"
#define CQM_HEADER_SIZE 133
diff --git a/src/lib/formats/csw_cas.cpp b/src/lib/formats/csw_cas.cpp
index 84aab50d3b8..9edea5c3ff7 100644
--- a/src/lib/formats/csw_cas.cpp
+++ b/src/lib/formats/csw_cas.cpp
@@ -22,10 +22,10 @@ Offset Value Type Description
*/
-#include <string.h>
+#include <cstring>
#include <zlib.h>
-#include <assert.h>
+#include <cassert>
#include "uef_cas.h"
#include "csw_cas.h"
diff --git a/src/lib/formats/d71_dsk.cpp b/src/lib/formats/d71_dsk.cpp
index af1186948c6..16c8efea2e9 100644
--- a/src/lib/formats/d71_dsk.cpp
+++ b/src/lib/formats/d71_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/d71_dsk.h"
diff --git a/src/lib/formats/d80_dsk.cpp b/src/lib/formats/d80_dsk.cpp
index e08ef22f6b9..d350411b159 100644
--- a/src/lib/formats/d80_dsk.cpp
+++ b/src/lib/formats/d80_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/d80_dsk.h"
diff --git a/src/lib/formats/d81_dsk.cpp b/src/lib/formats/d81_dsk.cpp
index 714b9c3cd9e..a7f01c9c92e 100644
--- a/src/lib/formats/d81_dsk.cpp
+++ b/src/lib/formats/d81_dsk.cpp
@@ -73,7 +73,7 @@ PER SECTOR ORGANIZATION:
*/
-#include <assert.h>
+#include <cassert>
#include "formats/d81_dsk.h"
diff --git a/src/lib/formats/d82_dsk.cpp b/src/lib/formats/d82_dsk.cpp
index 00de1f5fd7c..0d79ad891ae 100644
--- a/src/lib/formats/d82_dsk.cpp
+++ b/src/lib/formats/d82_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/d82_dsk.h"
diff --git a/src/lib/formats/d88_dsk.cpp b/src/lib/formats/d88_dsk.cpp
index c2bf9772e7d..30073d1874d 100644
--- a/src/lib/formats/d88_dsk.cpp
+++ b/src/lib/formats/d88_dsk.cpp
@@ -29,7 +29,7 @@
*
*/
- #include <assert.h>
+ #include <cassert>
#include "flopimg.h"
#include "imageutl.h"
diff --git a/src/lib/formats/dcp_dsk.cpp b/src/lib/formats/dcp_dsk.cpp
index 179552409f8..c245d4ff0e3 100644
--- a/src/lib/formats/dcp_dsk.cpp
+++ b/src/lib/formats/dcp_dsk.cpp
@@ -20,7 +20,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "dcp_dsk.h"
diff --git a/src/lib/formats/dim_dsk.cpp b/src/lib/formats/dim_dsk.cpp
index 67c04adc2bf..ac9930e4782 100644
--- a/src/lib/formats/dim_dsk.cpp
+++ b/src/lib/formats/dim_dsk.cpp
@@ -8,8 +8,8 @@
*********************************************************************/
-#include <string.h>
-#include <assert.h>
+#include <cstring>
+#include <cassert>
#include "dim_dsk.h"
#include "basicdsk.h"
diff --git a/src/lib/formats/dip_dsk.cpp b/src/lib/formats/dip_dsk.cpp
index 310eab56a73..573f3768072 100644
--- a/src/lib/formats/dip_dsk.cpp
+++ b/src/lib/formats/dip_dsk.cpp
@@ -14,7 +14,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "dip_dsk.h"
diff --git a/src/lib/formats/dmk_dsk.cpp b/src/lib/formats/dmk_dsk.cpp
index 5ca0a3b8781..4b3336b4bcb 100644
--- a/src/lib/formats/dmk_dsk.cpp
+++ b/src/lib/formats/dmk_dsk.cpp
@@ -13,7 +13,7 @@ TODO:
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "dmk_dsk.h"
diff --git a/src/lib/formats/dmv_dsk.cpp b/src/lib/formats/dmv_dsk.cpp
index 02469ed74d4..b64fea5b318 100644
--- a/src/lib/formats/dmv_dsk.cpp
+++ b/src/lib/formats/dmv_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/dmv_dsk.h"
diff --git a/src/lib/formats/ds9_dsk.cpp b/src/lib/formats/ds9_dsk.cpp
index 0866d78d58f..cd241c3a319 100644
--- a/src/lib/formats/ds9_dsk.cpp
+++ b/src/lib/formats/ds9_dsk.cpp
@@ -14,7 +14,7 @@
************************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/ds9_dsk.h"
diff --git a/src/lib/formats/dsk_dsk.cpp b/src/lib/formats/dsk_dsk.cpp
index db9d54920e5..7994f60f3ce 100644
--- a/src/lib/formats/dsk_dsk.cpp
+++ b/src/lib/formats/dsk_dsk.cpp
@@ -8,8 +8,8 @@
*********************************************************************/
-#include <string.h>
-#include <assert.h>
+#include <cstring>
+#include <cassert>
#include "imageutl.h"
#include "flopimg.h"
diff --git a/src/lib/formats/dvk_mx_dsk.cpp b/src/lib/formats/dvk_mx_dsk.cpp
index 477dd07690f..37de4111948 100644
--- a/src/lib/formats/dvk_mx_dsk.cpp
+++ b/src/lib/formats/dvk_mx_dsk.cpp
@@ -18,7 +18,7 @@
************************************************************************/
-#include <assert.h>
+#include <cassert>
#include "flopimg.h"
#include "formats/dvk_mx_dsk.h"
diff --git a/src/lib/formats/ep64_dsk.cpp b/src/lib/formats/ep64_dsk.cpp
index 80981bf698e..f47615c76d9 100644
--- a/src/lib/formats/ep64_dsk.cpp
+++ b/src/lib/formats/ep64_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/ep64_dsk.h"
diff --git a/src/lib/formats/esq16_dsk.cpp b/src/lib/formats/esq16_dsk.cpp
index 1f6e86f295f..72e27ebfad5 100644
--- a/src/lib/formats/esq16_dsk.cpp
+++ b/src/lib/formats/esq16_dsk.cpp
@@ -10,7 +10,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "flopimg.h"
#include "formats/esq16_dsk.h"
diff --git a/src/lib/formats/esq8_dsk.cpp b/src/lib/formats/esq8_dsk.cpp
index c575fe0db2f..b7f69c85afc 100644
--- a/src/lib/formats/esq8_dsk.cpp
+++ b/src/lib/formats/esq8_dsk.cpp
@@ -12,7 +12,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "flopimg.h"
#include "formats/esq8_dsk.h"
diff --git a/src/lib/formats/excali64_dsk.cpp b/src/lib/formats/excali64_dsk.cpp
index 5d41c39f4e6..cc255052800 100644
--- a/src/lib/formats/excali64_dsk.cpp
+++ b/src/lib/formats/excali64_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/excali64_dsk.h"
diff --git a/src/lib/formats/fc100_cas.cpp b/src/lib/formats/fc100_cas.cpp
index 5004da147d3..42b99ad3f0e 100644
--- a/src/lib/formats/fc100_cas.cpp
+++ b/src/lib/formats/fc100_cas.cpp
@@ -10,7 +10,7 @@ it's all a guess.
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "fc100_cas.h"
diff --git a/src/lib/formats/fdd_dsk.cpp b/src/lib/formats/fdd_dsk.cpp
index 5e34c4ad7df..f5eb6ea19a5 100644
--- a/src/lib/formats/fdd_dsk.cpp
+++ b/src/lib/formats/fdd_dsk.cpp
@@ -31,7 +31,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "fdd_dsk.h"
diff --git a/src/lib/formats/fdi_dsk.cpp b/src/lib/formats/fdi_dsk.cpp
index c703f29cc69..57083f1230e 100644
--- a/src/lib/formats/fdi_dsk.cpp
+++ b/src/lib/formats/fdi_dsk.cpp
@@ -16,7 +16,7 @@
*/
-#include <assert.h>
+#include <cassert>
#include "imageutl.h"
#include "flopimg.h"
diff --git a/src/lib/formats/flopimg.cpp b/src/lib/formats/flopimg.cpp
index ea812506f50..79d97b1bf71 100644
--- a/src/lib/formats/flopimg.cpp
+++ b/src/lib/formats/flopimg.cpp
@@ -8,12 +8,12 @@
*********************************************************************/
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <limits.h>
-#include <assert.h>
+#include <cstdlib>
+#include <cstring>
+#include <cstdio>
+#include <cctype>
+#include <climits>
+#include <cassert>
#include "emu.h" // emu_fatalerror
#include "osdcore.h"
diff --git a/src/lib/formats/fm7_cas.cpp b/src/lib/formats/fm7_cas.cpp
index 32cd08e3b27..f275866d31b 100644
--- a/src/lib/formats/fm7_cas.cpp
+++ b/src/lib/formats/fm7_cas.cpp
@@ -4,7 +4,7 @@
* Fujitsu FM-7 series cassette handling
*/
-#include <assert.h>
+#include <cassert>
#include "fm7_cas.h"
diff --git a/src/lib/formats/fmsx_cas.cpp b/src/lib/formats/fmsx_cas.cpp
index 6da8fc47f81..3b00b81dc92 100644
--- a/src/lib/formats/fmsx_cas.cpp
+++ b/src/lib/formats/fmsx_cas.cpp
@@ -1,6 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Sean Young
-#include <assert.h>
+#include <cassert>
#include "formats/fmsx_cas.h"
diff --git a/src/lib/formats/fmtowns_dsk.cpp b/src/lib/formats/fmtowns_dsk.cpp
index 633b53fcd87..13d1408ba4b 100644
--- a/src/lib/formats/fmtowns_dsk.cpp
+++ b/src/lib/formats/fmtowns_dsk.cpp
@@ -8,7 +8,7 @@
* Created on: 23/03/2014
*/
- #include <assert.h>
+ #include <cassert>
#include "formats/fmtowns_dsk.h"
diff --git a/src/lib/formats/gtp_cas.cpp b/src/lib/formats/gtp_cas.cpp
index fd3a16932b3..0a5c34d140c 100644
--- a/src/lib/formats/gtp_cas.cpp
+++ b/src/lib/formats/gtp_cas.cpp
@@ -6,7 +6,7 @@
Miodrag Milanovic
*/
-#include <assert.h>
+#include <cassert>
#include "gtp_cas.h"
diff --git a/src/lib/formats/hect_dsk.cpp b/src/lib/formats/hect_dsk.cpp
index 4cd36008540..cf8fc2cacc4 100644
--- a/src/lib/formats/hect_dsk.cpp
+++ b/src/lib/formats/hect_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/hect_dsk.h"
#include "formats/basicdsk.h"
diff --git a/src/lib/formats/hect_tap.cpp b/src/lib/formats/hect_tap.cpp
index 4f823fb24e5..78f1bad2e42 100644
--- a/src/lib/formats/hect_tap.cpp
+++ b/src/lib/formats/hect_tap.cpp
@@ -14,7 +14,7 @@ You can find some *.K7 file on serveral server in France
Updated 3/1/10 : use real value for timing.
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "hect_tap.h"
diff --git a/src/lib/formats/hp_ipc_dsk.cpp b/src/lib/formats/hp_ipc_dsk.cpp
index 8b9efce0120..66485b461be 100644
--- a/src/lib/formats/hp_ipc_dsk.cpp
+++ b/src/lib/formats/hp_ipc_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/hp_ipc_dsk.h"
diff --git a/src/lib/formats/hxcmfm_dsk.cpp b/src/lib/formats/hxcmfm_dsk.cpp
index dcc4718c114..390e07ff3f8 100644
--- a/src/lib/formats/hxcmfm_dsk.cpp
+++ b/src/lib/formats/hxcmfm_dsk.cpp
@@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
-#include <assert.h>
+#include <cassert>
#include "hxcmfm_dsk.h"
diff --git a/src/lib/formats/imageutl.cpp b/src/lib/formats/imageutl.cpp
index 6ab427115e0..6bf2bbd3323 100644
--- a/src/lib/formats/imageutl.cpp
+++ b/src/lib/formats/imageutl.cpp
@@ -8,7 +8,7 @@
***************************************************************************/
-#include <ctype.h>
+#include <cctype>
#include "imageutl.h"
int compute_log2(int val)
diff --git a/src/lib/formats/imd_dsk.cpp b/src/lib/formats/imd_dsk.cpp
index 51337a7f890..4ae22724fb9 100644
--- a/src/lib/formats/imd_dsk.cpp
+++ b/src/lib/formats/imd_dsk.cpp
@@ -8,8 +8,8 @@
*********************************************************************/
-#include <string.h>
-#include <assert.h>
+#include <cstring>
+#include <cassert>
#include "flopimg.h"
struct imddsk_tag
diff --git a/src/lib/formats/img_dsk.cpp b/src/lib/formats/img_dsk.cpp
new file mode 100644
index 00000000000..0dfcc7a359f
--- /dev/null
+++ b/src/lib/formats/img_dsk.cpp
@@ -0,0 +1,378 @@
+// license:BSD-3-Clause
+// copyright-holders: F. Ulivi
+/*********************************************************************
+
+ img_dsk.cpp
+
+ "IMG" disk format
+
+ This format is just a raw image of every sector on SSDD 8" floppy
+ disks as used in Intel MDS-II systems.
+ Files with this format have no header/trailer and are exactly
+ 512512 bytes in size (52 sectors, 1 head, 77 tracks,
+ 128 bytes per sector).
+
+*********************************************************************/
+
+#include "emu.h"
+#include "img_dsk.h"
+
+// Debugging
+#define VERBOSE 0
+#define LOG(...) do { if (VERBOSE) printf(__VA_ARGS__); } while (false)
+
+constexpr unsigned CELL_SIZE = 1200; // Bit cell size (1 µs)
+constexpr uint8_t INDEX_AM = 0x0c; // Index address mark
+constexpr uint8_t ID_AM = 0x0e; // ID address mark
+constexpr uint8_t DATA_AM = 0x0b; // Data address mark
+constexpr uint8_t AM_CLOCK = 0x70; // Clock pattern of AM
+constexpr unsigned PREIDX_GAP = 45; // Size of pre-index gap
+constexpr unsigned SYNC_00_LEN = 18; // 00's in sync (gaps 1, 2, 3)
+constexpr unsigned SYNC_FF_LEN = 10; // FF's in sync (gaps 1, 2, 3)
+constexpr int ID_DATA_OFFSET = 35 * 16; // Nominal distance (in cells) between ID & DATA AM
+// Size of image file
+constexpr unsigned IMG_IMAGE_SIZE = IMG_TRACKS * IMG_HEADS * IMG_SECTORS * IMG_SECTOR_SIZE;
+constexpr uint16_t CRC_POLY = 0x1021; // CRC-CCITT
+
+img_format::img_format()
+{
+}
+
+int img_format::identify(io_generic *io, uint32_t form_factor)
+{
+ uint64_t size = io_generic_size(io);
+
+ if (((form_factor == floppy_image::FF_8) || (form_factor == floppy_image::FF_UNKNOWN)) &&
+ size == IMG_IMAGE_SIZE) {
+ return 50;
+ } else {
+ return 0;
+ }
+}
+
+bool img_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
+{
+ uint64_t size = io_generic_size(io);
+ if (size != IMG_IMAGE_SIZE) {
+ return false;
+ }
+ image->set_variant(floppy_image::SSDD);
+
+ // Suck in the whole image
+ std::vector<uint8_t> image_data(size);
+ io_generic_read(io, (void *)image_data.data(), 0, size);
+
+ for (unsigned cyl = 0; cyl < IMG_TRACKS; cyl++) {
+ std::vector<uint32_t> track_data;
+
+ write_gap(track_data, 0 , PREIDX_GAP);
+ write_mmfm_byte(track_data , INDEX_AM , AM_CLOCK);
+
+ // Compute interleave factor and skew for current track
+ unsigned il_factor;
+ unsigned skew;
+ if (cyl == 0) {
+ il_factor = 1;
+ skew = 51;
+ } else if (cyl == 1) {
+ il_factor = 4;
+ skew = 48;
+ } else {
+ il_factor = 5;
+ skew = (47 + 45 * (cyl - 2)) % 52;
+ }
+ std::vector<uint8_t> sector_list = interleaved_sectors(il_factor);
+
+ for (unsigned sector = 0; sector < IMG_SECTORS; sector++) {
+ unsigned real_sector = sector_list[ (sector + skew) % IMG_SECTORS ];
+ unsigned offset_in_image = (real_sector - 1 + cyl * IMG_SECTORS) * IMG_SECTOR_SIZE;
+ write_sector(track_data , cyl , real_sector , &image_data[ offset_in_image ]);
+ }
+ fill_with_gap4(track_data);
+ generate_track_from_levels(cyl , 0 , track_data , 0 , image);
+ }
+ return true;
+}
+
+bool img_format::save(io_generic *io, floppy_image *image)
+{
+ for (int cyl = 0; cyl < IMG_TRACKS; cyl++) {
+ uint8_t bitstream[ 21000 ];
+ int bitstream_size;
+ generate_bitstream_from_track(cyl , 0 , CELL_SIZE , bitstream , bitstream_size , image , 0);
+ int pos = 0;
+ unsigned track_no , sector_no;
+ uint8_t sector_data[ IMG_SECTOR_SIZE ];
+ while (get_next_sector(bitstream , bitstream_size , pos , track_no , sector_no , sector_data)) {
+ if (track_no == cyl && sector_no >= 1 && sector_no <= IMG_SECTORS) {
+ unsigned offset_in_image = (cyl * IMG_SECTORS + sector_no - 1) * IMG_SECTOR_SIZE;
+ io_generic_write(io, sector_data, offset_in_image, IMG_SECTOR_SIZE);
+ }
+ }
+ }
+ return true;
+}
+
+const char *img_format::name() const
+{
+ return "img";
+}
+
+const char *img_format::description() const
+{
+ return "MDS-II floppy disk image";
+}
+
+const char *img_format::extensions() const
+{
+ return "img";
+}
+
+bool img_format::supports_save() const
+{
+ return true;
+}
+
+std::vector<uint8_t> img_format::interleaved_sectors(unsigned il_factor)
+{
+ std::vector<uint8_t> out(IMG_SECTORS);
+ unsigned idx = 0;
+ for (unsigned s = 0; s < IMG_SECTORS; s++) {
+ while (out[ idx ] != 0) {
+ if (++idx >= IMG_SECTORS) {
+ idx = 0;
+ }
+ }
+ out[ idx ] = s + 1;
+ idx += il_factor;
+ if (idx >= IMG_SECTORS) {
+ idx -= IMG_SECTORS;
+ }
+ }
+ return out;
+}
+
+void img_format::write_mmfm_bit(std::vector<uint32_t> &buffer , bool data_bit , bool clock_bit)
+{
+ bool had_transition = buffer.size() < 2 ? false : bit_r(buffer, buffer.size() - 1) || bit_r(buffer , buffer.size() - 2);
+ clock_bit = !data_bit && (clock_bit || !had_transition);
+ bit_w(buffer , clock_bit , CELL_SIZE);
+ bit_w(buffer , data_bit , CELL_SIZE);
+
+ if (BIT(m_crc , 15) ^ data_bit) {
+ m_crc = (m_crc << 1) ^ CRC_POLY;
+ } else {
+ m_crc <<= 1;
+ }
+}
+
+void img_format::write_mmfm_byte(std::vector<uint32_t> &buffer , uint8_t data , uint8_t clock)
+{
+ for (int i = 7; i >= 0; i--) {
+ write_mmfm_bit(buffer , BIT(data , i) , BIT(clock , i));
+ }
+}
+
+void img_format::write_sync(std::vector<uint32_t> &buffer)
+{
+ write_gap(buffer , SYNC_00_LEN , SYNC_FF_LEN);
+}
+
+void img_format::write_crc(std::vector<uint32_t> &buffer , uint16_t crc)
+{
+ // Note that CRC is stored with MSB (x^15) first
+ for (unsigned i = 0; i < 16; i++) {
+ write_mmfm_bit(buffer , BIT(crc , 15 - i) , 0);
+ }
+}
+
+void img_format::write_gap(std::vector<uint32_t> &buffer , unsigned size_00 , unsigned size_ff)
+{
+ for (unsigned i = 0; i < size_00; ++i) {
+ write_mmfm_byte(buffer, 0);
+ }
+ for (unsigned i = 0; i < size_ff; ++i) {
+ write_mmfm_byte(buffer, 0xff);
+ }
+}
+
+void img_format::write_sector(std::vector<uint32_t> &buffer , uint8_t track_no , uint8_t sect_no , const uint8_t *sect_data)
+{
+ // **** On-disk format of a sector ****
+ //
+ // | Offset | Size | Value | Content |
+ // |--------+------+-------+----------------------|
+ // | 0 | 18 | 00 | Gap 1/3 |
+ // | 18 | 10 | ff | Gap 1/3 |
+ // | 28 | 1 | 0e | ID AM (clock = 70) |
+ // | 29 | 1 | xx | Track no. |
+ // | 30 | 1 | 00 | N/U |
+ // | 31 | 1 | xx | Sector no. |
+ // | 32 | 1 | 00 | N/U |
+ // | 33 | 2 | xx | ID CRC |
+ // | 35 | 18 | 00 | Gap 2 |
+ // | 53 | 10 | ff | Gap 2 |
+ // | 63 | 1 | 0b | Data AM (clock = 70) |
+ // | 64 | 128 | xx | Sector data |
+ // | 192 | 2 | xx | Data CRC |
+ // | 194 | | | |
+
+ // Gap1
+ write_sync(buffer);
+ // ID AM
+ m_crc = 0;
+ write_mmfm_byte(buffer , ID_AM , AM_CLOCK);
+ // Track #
+ write_mmfm_byte(buffer , track_no);
+ write_mmfm_byte(buffer , 0);
+ // Sector #
+ write_mmfm_byte(buffer , sect_no);
+ write_mmfm_byte(buffer , 0);
+ // ID CRC
+ write_crc(buffer , m_crc);
+ // Gap 2
+ write_sync(buffer);
+ // Data AM
+ m_crc = 0;
+ write_mmfm_byte(buffer , DATA_AM , AM_CLOCK);
+ for (unsigned i = 0; i < IMG_SECTOR_SIZE; i++) {
+ // Data
+ write_mmfm_byte(buffer , sect_data[ i ]);
+ }
+ // Data CRC
+ write_crc(buffer , m_crc);
+}
+
+void img_format::fill_with_gap4(std::vector<uint32_t> &buffer)
+{
+ // Cell count in a track (1 µs cells in a 1/6 s track)
+ unsigned cell_count = (500000 * 120) / 360;
+ unsigned cells_in_buffer = buffer.size();
+ // Size of gap 4
+ unsigned gap_4 = (cell_count - cells_in_buffer) / 16;
+ // Gap 4
+ write_gap(buffer , gap_4 , 0);
+ // Last cell to round everything up to 2E+8
+ if (buffer.size() * CELL_SIZE < 200000000) {
+ bit_w(buffer , false , 200000000 - buffer.size() * CELL_SIZE);
+ }
+}
+
+std::vector<uint8_t> img_format::get_next_id_n_block(const uint8_t *bitstream , int bitstream_size , int& pos , int& start_pos)
+{
+ std::vector<uint8_t> res;
+ uint8_t data_sr;
+ uint8_t clock_sr;
+
+ // Look for either sync + ID AM or sync + DATA AM
+ do {
+ unsigned cnt_trans = 0;
+ while (pos < bitstream_size && cnt_trans < 34) {
+ bool bit = BIT(bitstream[ pos >> 3 ] , ~pos & 7);
+ pos++;
+ if (cnt_trans < 32) {
+ if (!(BIT(cnt_trans , 0) ^ bit)) {
+ cnt_trans++;
+ } else {
+ cnt_trans = 0;
+ }
+ } else if (cnt_trans == 32) {
+ if (!bit) {
+ start_pos = pos;
+ cnt_trans++;
+ } else {
+ cnt_trans = 0;
+ }
+ } else if (!bit) {
+ cnt_trans++;
+ } else {
+ cnt_trans = 32;
+ }
+ }
+
+ if (pos == bitstream_size) {
+ // End of track reached
+ return res;
+ }
+
+ // Get AM
+ data_sr = clock_sr = 0;
+ for (unsigned i = 0; i < 7; ++i) {
+ bool bit = BIT(bitstream[ pos >> 3 ] , ~pos & 7);
+ pos++;
+ clock_sr = (clock_sr << 1) | bit;
+ bit = BIT(bitstream[ pos >> 3 ] , ~pos & 7);
+ pos++;
+ data_sr = (data_sr << 1) | bit;
+ }
+ if (pos >= bitstream_size) {
+ return res;
+ }
+ } while (clock_sr != AM_CLOCK);
+
+ // ID blocks: Track no. + 0 + sector no. + 0 + CRC
+ // Data blocks: Sector data + CRC
+ res.push_back(data_sr);
+ unsigned to_dump;
+ if (data_sr == ID_AM) {
+ to_dump = 4;
+ } else if (data_sr == DATA_AM) {
+ to_dump = IMG_SECTOR_SIZE;
+ } else {
+ to_dump = 0;
+ }
+
+ pos++;
+ for (unsigned i = 0; i < to_dump && pos < bitstream_size; i++) {
+ data_sr = 0;
+ unsigned j;
+ for (j = 0; j < 8 && pos < bitstream_size; j++) {
+ bool bit = BIT(bitstream[ pos >> 3 ] , ~pos & 7);
+ pos += 2;
+ data_sr = (data_sr << 1) | bit;
+ }
+ if (j == 8) {
+ res.push_back(data_sr);
+ }
+ }
+ return res;
+}
+
+bool img_format::get_next_sector(const uint8_t *bitstream , int bitstream_size , int& pos , unsigned& track , unsigned& sector , uint8_t *sector_data)
+{
+ std::vector<uint8_t> block;
+ while (true) {
+ // Scan for ID block first
+ int id_pos = 0;
+ while (true) {
+ if (block.size() == 0) {
+ block = get_next_id_n_block(bitstream , bitstream_size , pos , id_pos);
+ if (block.size() == 0) {
+ return false;
+ }
+ }
+ if (block[ 0 ] == ID_AM && block.size() >= 5) {
+ track = block[ 1 ];
+ sector = block[ 3 ];
+ break;
+ } else {
+ block.clear();
+ }
+ }
+ // Then for DATA block
+ int data_pos = 0;
+ block = get_next_id_n_block(bitstream , bitstream_size , pos , data_pos);
+ if (block.size() == 0) {
+ return false;
+ }
+ if (block[ 0 ] == DATA_AM && block.size() >= (IMG_SECTOR_SIZE + 1) && abs((data_pos - id_pos) - ID_DATA_OFFSET) <= 64) {
+ break;
+ }
+ }
+
+ memcpy(sector_data , block.data() + 1 , IMG_SECTOR_SIZE);
+
+ return true;
+}
+
+const floppy_format_type FLOPPY_IMG_FORMAT = &floppy_image_format_creator<img_format>;
diff --git a/src/lib/formats/img_dsk.h b/src/lib/formats/img_dsk.h
new file mode 100644
index 00000000000..f1ac7aef3c0
--- /dev/null
+++ b/src/lib/formats/img_dsk.h
@@ -0,0 +1,55 @@
+// license:BSD-3-Clause
+// copyright-holders: F. Ulivi
+/*********************************************************************
+
+ img_dsk.h
+
+ "IMG" disk format for SSDD Intel MDS-II 8" disks
+
+*********************************************************************/
+#ifndef MAME_FORMATS_IMG_DSK_H
+#define MAME_FORMATS_IMG_DSK_H
+
+#pragma once
+
+#include "flopimg.h"
+
+#include <vector>
+
+// Geometry constants
+constexpr unsigned IMG_TRACKS = 77;
+constexpr unsigned IMG_HEADS = 1;
+constexpr unsigned IMG_SECTORS = 52;
+constexpr unsigned IMG_SECTOR_SIZE = 128;
+
+class img_format : public floppy_image_format_t
+{
+public:
+ img_format();
+
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
+ virtual bool save(io_generic *io, floppy_image *image) override;
+ virtual const char *name() const override;
+ virtual const char *description() const override;
+ virtual const char *extensions() const override;
+ virtual bool supports_save() const override;
+
+private:
+ uint16_t m_crc;
+
+ static std::vector<uint8_t> interleaved_sectors(unsigned il_factor);
+ void write_mmfm_bit(std::vector<uint32_t> &buffer , bool data_bit , bool clock_bit);
+ void write_mmfm_byte(std::vector<uint32_t> &buffer , uint8_t data , uint8_t clock = 0);
+ void write_sync(std::vector<uint32_t> &buffer);
+ void write_crc(std::vector<uint32_t> &buffer , uint16_t crc);
+ void write_gap(std::vector<uint32_t> &buffer , unsigned size_00 , unsigned size_ff);
+ void write_sector(std::vector<uint32_t> &buffer , uint8_t track_no , uint8_t sect_no , const uint8_t *sect_data);
+ void fill_with_gap4(std::vector<uint32_t> &buffer);
+ std::vector<uint8_t> get_next_id_n_block(const uint8_t *bitstream , int bitstream_size , int& pos , int& start_pos);
+ bool get_next_sector(const uint8_t *bitstream , int bitstream_size , int& pos , unsigned& track , unsigned& sector , uint8_t *sector_data);
+};
+
+extern const floppy_format_type FLOPPY_IMG_FORMAT;
+
+#endif // MAME_FORMATS_IMG_DSK_H
diff --git a/src/lib/formats/ioprocs.cpp b/src/lib/formats/ioprocs.cpp
index 69943c13dc0..34810153f9a 100644
--- a/src/lib/formats/ioprocs.cpp
+++ b/src/lib/formats/ioprocs.cpp
@@ -1,8 +1,8 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
+#include <cstdio>
+#include <cstring>
+#include <cassert>
#include "osdcore.h"
#include "ioprocs.h"
#include "corefile.h"
diff --git a/src/lib/formats/ioprocs.h b/src/lib/formats/ioprocs.h
index c569e52dd2b..5b45b4a1450 100644
--- a/src/lib/formats/ioprocs.h
+++ b/src/lib/formats/ioprocs.h
@@ -12,8 +12,8 @@
#pragma once
-#include <stdint.h>
-#include <stdlib.h>
+#include <cstdint>
+#include <cstdlib>
diff --git a/src/lib/formats/ipf_dsk.cpp b/src/lib/formats/ipf_dsk.cpp
index da50e850ea8..ed6505fd385 100644
--- a/src/lib/formats/ipf_dsk.cpp
+++ b/src/lib/formats/ipf_dsk.cpp
@@ -1,6 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
-#include <assert.h>
+#include <cassert>
#include "ipf_dsk.h"
const floppy_format_type FLOPPY_IPF_FORMAT = &floppy_image_format_creator<ipf_format>;
diff --git a/src/lib/formats/iq151_dsk.cpp b/src/lib/formats/iq151_dsk.cpp
index dcffad85751..b085cca0d37 100644
--- a/src/lib/formats/iq151_dsk.cpp
+++ b/src/lib/formats/iq151_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/iq151_dsk.h"
diff --git a/src/lib/formats/itt3030_dsk.cpp b/src/lib/formats/itt3030_dsk.cpp
index 305ab644233..4a4a795c7d3 100644
--- a/src/lib/formats/itt3030_dsk.cpp
+++ b/src/lib/formats/itt3030_dsk.cpp
@@ -10,7 +10,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/itt3030_dsk.h"
diff --git a/src/lib/formats/jvc_dsk.cpp b/src/lib/formats/jvc_dsk.cpp
index 5035e989f22..f5de872c672 100644
--- a/src/lib/formats/jvc_dsk.cpp
+++ b/src/lib/formats/jvc_dsk.cpp
@@ -150,8 +150,8 @@ bool jvc_format::parse_header(io_generic *io, int &header_size, int &tracks, int
switch (header_size)
{
- case 5: emu_fatalerror("jvc_format: sector attribute flag unsupported\n");
- break;
+ case 5:
+ throw emu_fatalerror("jvc_format: sector attribute flag unsupported\n");
case 4: base_sector_id = header[3];
// no break
case 3: sector_size = 128 << header[2];
@@ -184,7 +184,7 @@ bool jvc_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
// safety check
if (sector_count * sector_size > 10000)
- emu_fatalerror("jvc_format: incorrect track layout\n");
+ throw emu_fatalerror("jvc_format: incorrect track layout\n");
int file_offset = header_size;
@@ -253,7 +253,7 @@ bool jvc_format::save(io_generic *io, floppy_image *image)
for (int i = 0; i < 18; i++)
{
if (sectors[1 + i].size != 256)
- emu_fatalerror("jvc_format: invalid sector size: %d\n", sectors[1 + i].size);
+ throw emu_fatalerror("jvc_format: invalid sector size: %d\n", sectors[1 + i].size);
io_generic_write(io, sectors[1 + i].data, file_offset, sectors[1 + i].size);
file_offset += sectors[1 + i].size;
diff --git a/src/lib/formats/kaypro_dsk.cpp b/src/lib/formats/kaypro_dsk.cpp
index e9924ce11c9..6b3996d842c 100644
--- a/src/lib/formats/kaypro_dsk.cpp
+++ b/src/lib/formats/kaypro_dsk.cpp
@@ -16,7 +16,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/kaypro_dsk.h"
diff --git a/src/lib/formats/kc85_dsk.cpp b/src/lib/formats/kc85_dsk.cpp
index 84111ff1171..0648289af71 100644
--- a/src/lib/formats/kc85_dsk.cpp
+++ b/src/lib/formats/kc85_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/kc85_dsk.h"
diff --git a/src/lib/formats/kc_cas.cpp b/src/lib/formats/kc_cas.cpp
index 713def9ac83..ee3d392e86f 100644
--- a/src/lib/formats/kc_cas.cpp
+++ b/src/lib/formats/kc_cas.cpp
@@ -13,7 +13,7 @@
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "kc_cas.h"
diff --git a/src/lib/formats/kim1_cas.cpp b/src/lib/formats/kim1_cas.cpp
index 1bfccc7f8a0..b7853ee967e 100644
--- a/src/lib/formats/kim1_cas.cpp
+++ b/src/lib/formats/kim1_cas.cpp
@@ -1,6 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol
-#include <assert.h>
+#include <cassert>
#include "kim1_cas.h"
diff --git a/src/lib/formats/lviv_lvt.cpp b/src/lib/formats/lviv_lvt.cpp
index 09e91eac9fd..3a94114d421 100644
--- a/src/lib/formats/lviv_lvt.cpp
+++ b/src/lib/formats/lviv_lvt.cpp
@@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:Krzysztof Strzecha
/* .LVT tape images */
-#include <assert.h>
+#include <cassert>
#include "lviv_lvt.h"
diff --git a/src/lib/formats/m5_dsk.cpp b/src/lib/formats/m5_dsk.cpp
index 9652eedbb72..764dfeea6f1 100644
--- a/src/lib/formats/m5_dsk.cpp
+++ b/src/lib/formats/m5_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/m5_dsk.h"
diff --git a/src/lib/formats/mbee_cas.cpp b/src/lib/formats/mbee_cas.cpp
index 24024f66f5d..181bca6aac0 100644
--- a/src/lib/formats/mbee_cas.cpp
+++ b/src/lib/formats/mbee_cas.cpp
@@ -56,7 +56,7 @@ TAP - has an ID header of TAP_DGOS_BEE or MBEE, null terminated.
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "mbee_cas.h"
diff --git a/src/lib/formats/mfi_dsk.cpp b/src/lib/formats/mfi_dsk.cpp
index b6a8a18460a..0f118ce620f 100644
--- a/src/lib/formats/mfi_dsk.cpp
+++ b/src/lib/formats/mfi_dsk.cpp
@@ -1,6 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
-#include <assert.h>
+#include <cassert>
#include "mfi_dsk.h"
#include <zlib.h>
diff --git a/src/lib/formats/mm_dsk.cpp b/src/lib/formats/mm_dsk.cpp
index 0634c0e3ede..0268b46bf89 100644
--- a/src/lib/formats/mm_dsk.cpp
+++ b/src/lib/formats/mm_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/mm_dsk.h"
diff --git a/src/lib/formats/ms0515_dsk.cpp b/src/lib/formats/ms0515_dsk.cpp
index d16e8dbbf73..c89dae8018f 100644
--- a/src/lib/formats/ms0515_dsk.cpp
+++ b/src/lib/formats/ms0515_dsk.cpp
@@ -10,7 +10,7 @@
#include "formats/ms0515_dsk.h"
-#include <assert.h>
+#include <cassert>
ms0515_format::ms0515_format() : wd177x_format(formats)
{
diff --git a/src/lib/formats/mz_cas.cpp b/src/lib/formats/mz_cas.cpp
index cfcf9f36ed8..e7af23aafb4 100644
--- a/src/lib/formats/mz_cas.cpp
+++ b/src/lib/formats/mz_cas.cpp
@@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
-#include <string.h>
-#include <assert.h>
+#include <cstring>
+#include <cassert>
#include "mz_cas.h"
#ifndef VERBOSE
diff --git a/src/lib/formats/nanos_dsk.cpp b/src/lib/formats/nanos_dsk.cpp
index 1536d0677c8..ef466f024a0 100644
--- a/src/lib/formats/nanos_dsk.cpp
+++ b/src/lib/formats/nanos_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/nanos_dsk.h"
diff --git a/src/lib/formats/naslite_dsk.cpp b/src/lib/formats/naslite_dsk.cpp
index cea109c2dc2..fdd63ca0ecc 100644
--- a/src/lib/formats/naslite_dsk.cpp
+++ b/src/lib/formats/naslite_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/naslite_dsk.h"
diff --git a/src/lib/formats/nes_dsk.cpp b/src/lib/formats/nes_dsk.cpp
index 60dbba5dafa..dd311862ca7 100644
--- a/src/lib/formats/nes_dsk.cpp
+++ b/src/lib/formats/nes_dsk.cpp
@@ -9,8 +9,8 @@
*********************************************************************/
-#include <string.h>
-#include <assert.h>
+#include <cstring>
+#include <cassert>
#include "formats/nes_dsk.h"
#include "formats/basicdsk.h"
diff --git a/src/lib/formats/nfd_dsk.cpp b/src/lib/formats/nfd_dsk.cpp
index 4d9d8fab980..e677f4ff6f5 100644
--- a/src/lib/formats/nfd_dsk.cpp
+++ b/src/lib/formats/nfd_dsk.cpp
@@ -77,7 +77,7 @@
*********************************************************************/
- #include <assert.h>
+ #include <cassert>
#include "nfd_dsk.h"
diff --git a/src/lib/formats/orao_cas.cpp b/src/lib/formats/orao_cas.cpp
index 2d0f96b2a14..9a2ac05547e 100644
--- a/src/lib/formats/orao_cas.cpp
+++ b/src/lib/formats/orao_cas.cpp
@@ -5,7 +5,7 @@
Tape support for Orao TAP format
*/
-#include <assert.h>
+#include <cassert>
#include "orao_cas.h"
diff --git a/src/lib/formats/oric_tap.cpp b/src/lib/formats/oric_tap.cpp
index c9f84dc7c2a..dcee2f0bd2d 100644
--- a/src/lib/formats/oric_tap.cpp
+++ b/src/lib/formats/oric_tap.cpp
@@ -1,6 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Kevin Thacker
-#include <assert.h>
+#include <cassert>
#include "oric_tap.h"
diff --git a/src/lib/formats/p6001_cas.cpp b/src/lib/formats/p6001_cas.cpp
index 37e1ffcfa2c..3319e377b3d 100644
--- a/src/lib/formats/p6001_cas.cpp
+++ b/src/lib/formats/p6001_cas.cpp
@@ -4,7 +4,7 @@
* NEC PC-6001 cassette format handling
*/
-#include <assert.h>
+#include <cassert>
#include "p6001_cas.h"
diff --git a/src/lib/formats/pc98_dsk.cpp b/src/lib/formats/pc98_dsk.cpp
index 3d85a4380dd..1add267da8f 100644
--- a/src/lib/formats/pc98_dsk.cpp
+++ b/src/lib/formats/pc98_dsk.cpp
@@ -8,8 +8,8 @@
*********************************************************************/
-#include <string.h>
-#include <assert.h>
+#include <cstring>
+#include <cassert>
#include "formats/pc98_dsk.h"
diff --git a/src/lib/formats/pc98fdi_dsk.cpp b/src/lib/formats/pc98fdi_dsk.cpp
index 5b37b1ede37..37cdae18ff7 100644
--- a/src/lib/formats/pc98fdi_dsk.cpp
+++ b/src/lib/formats/pc98fdi_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "pc98fdi_dsk.h"
pc98fdi_format::pc98fdi_format()
diff --git a/src/lib/formats/pc_dsk.cpp b/src/lib/formats/pc_dsk.cpp
index e4d7e02f47d..193291c8265 100644
--- a/src/lib/formats/pc_dsk.cpp
+++ b/src/lib/formats/pc_dsk.cpp
@@ -8,8 +8,8 @@
*********************************************************************/
-#include <string.h>
-#include <assert.h>
+#include <cstring>
+#include <cassert>
#include "formats/pc_dsk.h"
#include "formats/basicdsk.h"
diff --git a/src/lib/formats/phc25_cas.cpp b/src/lib/formats/phc25_cas.cpp
index 2cc9ea013e6..197c3db50ae 100644
--- a/src/lib/formats/phc25_cas.cpp
+++ b/src/lib/formats/phc25_cas.cpp
@@ -29,7 +29,7 @@ enough to make it work.
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "phc25_cas.h"
diff --git a/src/lib/formats/pmd_cas.cpp b/src/lib/formats/pmd_cas.cpp
index 79e8820b4bb..a046580bc17 100644
--- a/src/lib/formats/pmd_cas.cpp
+++ b/src/lib/formats/pmd_cas.cpp
@@ -10,7 +10,7 @@
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "pmd_cas.h"
diff --git a/src/lib/formats/ppg_dsk.cpp b/src/lib/formats/ppg_dsk.cpp
index dd08a841e00..0c844a753fc 100644
--- a/src/lib/formats/ppg_dsk.cpp
+++ b/src/lib/formats/ppg_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/ppg_dsk.h"
diff --git a/src/lib/formats/primoptp.cpp b/src/lib/formats/primoptp.cpp
index 5c6779b6613..906a08239a6 100644
--- a/src/lib/formats/primoptp.cpp
+++ b/src/lib/formats/primoptp.cpp
@@ -3,7 +3,7 @@
/* .PTP Microkey Primo tape images */
-#include <assert.h>
+#include <cassert>
#include "primoptp.h"
diff --git a/src/lib/formats/pyldin_dsk.cpp b/src/lib/formats/pyldin_dsk.cpp
index de43ab1947b..89a75ce5555 100644
--- a/src/lib/formats/pyldin_dsk.cpp
+++ b/src/lib/formats/pyldin_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/pyldin_dsk.h"
pyldin_format::pyldin_format() : upd765_format(formats)
diff --git a/src/lib/formats/ql_dsk.cpp b/src/lib/formats/ql_dsk.cpp
index b3ceb233218..6be088439cc 100644
--- a/src/lib/formats/ql_dsk.cpp
+++ b/src/lib/formats/ql_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/ql_dsk.h"
diff --git a/src/lib/formats/rk_cas.cpp b/src/lib/formats/rk_cas.cpp
index 18504fcb130..b522fea2f3b 100644
--- a/src/lib/formats/rk_cas.cpp
+++ b/src/lib/formats/rk_cas.cpp
@@ -5,7 +5,7 @@
Tape support for RK format
*/
-#include <assert.h>
+#include <cassert>
#include "rk_cas.h"
diff --git a/src/lib/formats/rx50_dsk.cpp b/src/lib/formats/rx50_dsk.cpp
index a58a8c5e59c..18bac995146 100644
--- a/src/lib/formats/rx50_dsk.cpp
+++ b/src/lib/formats/rx50_dsk.cpp
@@ -29,7 +29,7 @@
FORMAT A: /F:160 on DOS; turn MEDIACHK ON
************************************************************************/
-#include <assert.h>
+#include <cassert>
#include "flopimg.h"
#include "formats/rx50_dsk.h"
diff --git a/src/lib/formats/sc3000_bit.cpp b/src/lib/formats/sc3000_bit.cpp
index c656b54ee95..6e3600b7aeb 100644
--- a/src/lib/formats/sc3000_bit.cpp
+++ b/src/lib/formats/sc3000_bit.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "sc3000_bit.h"
diff --git a/src/lib/formats/sdf_dsk.cpp b/src/lib/formats/sdf_dsk.cpp
index b2cd4a4e7ab..a1a0c921da7 100644
--- a/src/lib/formats/sdf_dsk.cpp
+++ b/src/lib/formats/sdf_dsk.cpp
@@ -12,7 +12,7 @@
*********************************************************************/
#include "sdf_dsk.h"
-#include <assert.h>
+#include <cassert>
sdf_format::sdf_format()
{
diff --git a/src/lib/formats/sf7000_dsk.cpp b/src/lib/formats/sf7000_dsk.cpp
index 31d0c37ab15..8e063ceba35 100644
--- a/src/lib/formats/sf7000_dsk.cpp
+++ b/src/lib/formats/sf7000_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/sf7000_dsk.h"
diff --git a/src/lib/formats/smx_dsk.cpp b/src/lib/formats/smx_dsk.cpp
index 9158a586c13..7ddcc1ae35f 100644
--- a/src/lib/formats/smx_dsk.cpp
+++ b/src/lib/formats/smx_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/smx_dsk.h"
diff --git a/src/lib/formats/sol_cas.cpp b/src/lib/formats/sol_cas.cpp
index ac668535b51..4672ff95080 100644
--- a/src/lib/formats/sol_cas.cpp
+++ b/src/lib/formats/sol_cas.cpp
@@ -34,7 +34,7 @@ SVT - The full explanation may be found on the Solace web site,
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "sol_cas.h"
diff --git a/src/lib/formats/sorc_cas.cpp b/src/lib/formats/sorc_cas.cpp
index 10fb26197f1..50585d444c7 100644
--- a/src/lib/formats/sorc_cas.cpp
+++ b/src/lib/formats/sorc_cas.cpp
@@ -25,7 +25,7 @@ header and leader bytes.
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "sorc_cas.h"
diff --git a/src/lib/formats/sorc_dsk.cpp b/src/lib/formats/sorc_dsk.cpp
index 7a1b734f780..35d293be3fc 100644
--- a/src/lib/formats/sorc_dsk.cpp
+++ b/src/lib/formats/sorc_dsk.cpp
@@ -8,8 +8,8 @@
*********************************************************************/
-#include <string.h>
-#include <assert.h>
+#include <cstring>
+#include <cassert>
#include "sorc_dsk.h"
#include "basicdsk.h"
diff --git a/src/lib/formats/sord_cas.cpp b/src/lib/formats/sord_cas.cpp
index bc11c388915..145cd3c3221 100644
--- a/src/lib/formats/sord_cas.cpp
+++ b/src/lib/formats/sord_cas.cpp
@@ -8,8 +8,8 @@
**************************************************************************/
-#include <string.h>
-#include <assert.h>
+#include <cstring>
+#include <cassert>
#include "sord_cas.h"
#define SORDM5_WAVESAMPLES_HEADER 1
diff --git a/src/lib/formats/spc1000_cas.cpp b/src/lib/formats/spc1000_cas.cpp
index d13021b0047..2e48980da3d 100644
--- a/src/lib/formats/spc1000_cas.cpp
+++ b/src/lib/formats/spc1000_cas.cpp
@@ -21,7 +21,7 @@ IPL: This seems a quickload format containing RAM dump, not a real tape
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "spc1000_cas.h"
diff --git a/src/lib/formats/st_dsk.cpp b/src/lib/formats/st_dsk.cpp
index 9808dc56ff9..36fe9a01970 100644
--- a/src/lib/formats/st_dsk.cpp
+++ b/src/lib/formats/st_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/st_dsk.h"
diff --git a/src/lib/formats/svi_cas.cpp b/src/lib/formats/svi_cas.cpp
index c681c36d9dd..fcb2142c4e3 100644
--- a/src/lib/formats/svi_cas.cpp
+++ b/src/lib/formats/svi_cas.cpp
@@ -1,6 +1,6 @@
// license:BSD-3-Clause
// copyright-holders:Sean Young
-#include <assert.h>
+#include <cassert>
#include "svi_cas.h"
diff --git a/src/lib/formats/tandy2k_dsk.cpp b/src/lib/formats/tandy2k_dsk.cpp
index e08865c9493..f811483251d 100644
--- a/src/lib/formats/tandy2k_dsk.cpp
+++ b/src/lib/formats/tandy2k_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/tandy2k_dsk.h"
diff --git a/src/lib/formats/td0_dsk.cpp b/src/lib/formats/td0_dsk.cpp
index b7c418af53c..4dc3ed53cbf 100644
--- a/src/lib/formats/td0_dsk.cpp
+++ b/src/lib/formats/td0_dsk.cpp
@@ -14,8 +14,8 @@
* Edited and translated to English by Kenji RIKITAKE
*/
-#include <string.h>
-#include <assert.h>
+#include <cstring>
+#include <cassert>
#include "pool.h"
#include "flopimg.h"
diff --git a/src/lib/formats/thom_cas.cpp b/src/lib/formats/thom_cas.cpp
index 45f89ac2a29..a00c2c3234b 100644
--- a/src/lib/formats/thom_cas.cpp
+++ b/src/lib/formats/thom_cas.cpp
@@ -8,8 +8,8 @@
**********************************************************************/
-#include <math.h>
-#include <assert.h>
+#include <cmath>
+#include <cassert>
#include "pool.h"
#include "cassimg.h"
diff --git a/src/lib/formats/thom_dsk.cpp b/src/lib/formats/thom_dsk.cpp
index c8563fc1135..d525641c29f 100644
--- a/src/lib/formats/thom_dsk.cpp
+++ b/src/lib/formats/thom_dsk.cpp
@@ -10,8 +10,8 @@
*********************************************************************/
-#include <string.h>
-#include <assert.h>
+#include <cstring>
+#include <cassert>
#include "thom_dsk.h"
#include "basicdsk.h"
diff --git a/src/lib/formats/ti99_dsk.cpp b/src/lib/formats/ti99_dsk.cpp
index b248c9dd594..a82600feaa6 100644
--- a/src/lib/formats/ti99_dsk.cpp
+++ b/src/lib/formats/ti99_dsk.cpp
@@ -40,9 +40,9 @@
********************************************************************/
-#include <string.h>
-#include <time.h>
-#include <assert.h>
+#include <cstring>
+#include <ctime>
+#include <cassert>
#include <iomanip>
#include "emu.h" // osd_printf_* (in osdcore.h)
diff --git a/src/lib/formats/tiki100_dsk.cpp b/src/lib/formats/tiki100_dsk.cpp
index 2258f29c47a..9dd6555c9ff 100644
--- a/src/lib/formats/tiki100_dsk.cpp
+++ b/src/lib/formats/tiki100_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/tiki100_dsk.h"
diff --git a/src/lib/formats/trd_dsk.cpp b/src/lib/formats/trd_dsk.cpp
index 4766a3426e3..fd823e4aaba 100644
--- a/src/lib/formats/trd_dsk.cpp
+++ b/src/lib/formats/trd_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/trd_dsk.h"
diff --git a/src/lib/formats/trs_cas.cpp b/src/lib/formats/trs_cas.cpp
index a6701ed1263..582abf8869c 100644
--- a/src/lib/formats/trs_cas.cpp
+++ b/src/lib/formats/trs_cas.cpp
@@ -6,7 +6,7 @@ Support for TRS80 .cas cassette images
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/trs_cas.h"
diff --git a/src/lib/formats/tvc_cas.cpp b/src/lib/formats/tvc_cas.cpp
index 9177491278c..3cea37cc1bf 100644
--- a/src/lib/formats/tvc_cas.cpp
+++ b/src/lib/formats/tvc_cas.cpp
@@ -8,7 +8,7 @@
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "tvc_cas.h"
diff --git a/src/lib/formats/tvc_dsk.cpp b/src/lib/formats/tvc_dsk.cpp
index 8a2254cb7cc..303a5c2c09d 100644
--- a/src/lib/formats/tvc_dsk.cpp
+++ b/src/lib/formats/tvc_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/tvc_dsk.h"
diff --git a/src/lib/formats/tzx_cas.cpp b/src/lib/formats/tzx_cas.cpp
index 28d363df433..a4b2b30ed81 100644
--- a/src/lib/formats/tzx_cas.cpp
+++ b/src/lib/formats/tzx_cas.cpp
@@ -27,7 +27,7 @@ TODO:
*/
-#include <assert.h>
+#include <cassert>
#include "tzx_cas.h"
#include "formats/imageutl.h"
diff --git a/src/lib/formats/uef_cas.cpp b/src/lib/formats/uef_cas.cpp
index 78247887eb5..d19eb9b2e47 100644
--- a/src/lib/formats/uef_cas.cpp
+++ b/src/lib/formats/uef_cas.cpp
@@ -18,9 +18,9 @@ Not nice, but it works...
*/
-#include <string.h>
-#include <math.h>
-#include <assert.h>
+#include <cstring>
+#include <cmath>
+#include <cassert>
#include <zlib.h>
#include "uef_cas.h"
diff --git a/src/lib/formats/vg5k_cas.cpp b/src/lib/formats/vg5k_cas.cpp
index 898507e7139..cb8ab9636c5 100644
--- a/src/lib/formats/vg5k_cas.cpp
+++ b/src/lib/formats/vg5k_cas.cpp
@@ -5,7 +5,7 @@
Support for VG-5000 .k7 cassette images
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "vg5k_cas.h"
diff --git a/src/lib/formats/vt_cas.cpp b/src/lib/formats/vt_cas.cpp
index 9dbc68f8074..a8c30f8d25f 100644
--- a/src/lib/formats/vt_cas.cpp
+++ b/src/lib/formats/vt_cas.cpp
@@ -1,6 +1,6 @@
// license:GPL-2.0+
// copyright-holders:Juergen Buchmueller
-#include <assert.h>
+#include <cassert>
#include "formats/vt_cas.h"
diff --git a/src/lib/formats/wavfile.cpp b/src/lib/formats/wavfile.cpp
index 072be6c92a2..1408984079c 100644
--- a/src/lib/formats/wavfile.cpp
+++ b/src/lib/formats/wavfile.cpp
@@ -8,8 +8,8 @@
*********************************************************************/
-#include <stdio.h>
-#include <assert.h>
+#include <cstdio>
+#include <cassert>
#include "wavfile.h"
#include "cassimg.h"
diff --git a/src/lib/formats/x07_cas.cpp b/src/lib/formats/x07_cas.cpp
index b49d7c8d643..131693f2da1 100644
--- a/src/lib/formats/x07_cas.cpp
+++ b/src/lib/formats/x07_cas.cpp
@@ -6,7 +6,7 @@
********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "x07_cas.h"
diff --git a/src/lib/formats/x1_tap.cpp b/src/lib/formats/x1_tap.cpp
index b4fe65b8e8c..88c962bf53b 100644
--- a/src/lib/formats/x1_tap.cpp
+++ b/src/lib/formats/x1_tap.cpp
@@ -21,7 +21,7 @@
*
*/
-#include <assert.h>
+#include <cassert>
#include "x1_tap.h"
diff --git a/src/lib/formats/xdf_dsk.cpp b/src/lib/formats/xdf_dsk.cpp
index c77d685d9be..698b8799abc 100644
--- a/src/lib/formats/xdf_dsk.cpp
+++ b/src/lib/formats/xdf_dsk.cpp
@@ -8,7 +8,7 @@
*********************************************************************/
-#include <assert.h>
+#include <cassert>
#include "formats/xdf_dsk.h"
diff --git a/src/lib/formats/zx81_p.cpp b/src/lib/formats/zx81_p.cpp
index 9fa5814385f..709bdccfc4c 100644
--- a/src/lib/formats/zx81_p.cpp
+++ b/src/lib/formats/zx81_p.cpp
@@ -31,7 +31,7 @@ medium transfer rate is approx. 307 bps (38 bytes/sec) for files that contain
*****************************************************************************/
-#include <assert.h>
+#include <cassert>
#include "zx81_p.h"
#include "tzx_cas.h"