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.cpp30
-rw-r--r--src/lib/formats/ace_tap.cpp14
-rw-r--r--src/lib/formats/ace_tap.h16
-rw-r--r--src/lib/formats/acorn_dsk.cpp80
-rw-r--r--src/lib/formats/acorn_dsk.h28
-rw-r--r--src/lib/formats/adam_cas.cpp6
-rw-r--r--src/lib/formats/afs_dsk.cpp2
-rw-r--r--src/lib/formats/afs_dsk.h2
-rw-r--r--src/lib/formats/ami_dsk.cpp28
-rw-r--r--src/lib/formats/ami_dsk.h8
-rw-r--r--src/lib/formats/ap2_dsk.cpp266
-rw-r--r--src/lib/formats/ap2_dsk.h22
-rw-r--r--src/lib/formats/ap_dsk35.cpp324
-rw-r--r--src/lib/formats/ap_dsk35.h12
-rw-r--r--src/lib/formats/apf_apt.cpp34
-rw-r--r--src/lib/formats/apollo_dsk.cpp6
-rw-r--r--src/lib/formats/apollo_dsk.h2
-rw-r--r--src/lib/formats/apridisk.cpp34
-rw-r--r--src/lib/formats/apridisk.h4
-rw-r--r--src/lib/formats/atom_tap.cpp10
-rw-r--r--src/lib/formats/basicdsk.cpp22
-rw-r--r--src/lib/formats/basicdsk.h8
-rw-r--r--src/lib/formats/c3040_dsk.cpp2
-rw-r--r--src/lib/formats/c3040_dsk.h2
-rw-r--r--src/lib/formats/c4040_dsk.cpp2
-rw-r--r--src/lib/formats/c4040_dsk.h2
-rw-r--r--src/lib/formats/camplynx_cas.cpp20
-rw-r--r--src/lib/formats/cassimg.cpp122
-rw-r--r--src/lib/formats/cassimg.h38
-rw-r--r--src/lib/formats/cbm_crt.cpp20
-rw-r--r--src/lib/formats/cbm_crt.h30
-rw-r--r--src/lib/formats/cbm_tap.cpp18
-rw-r--r--src/lib/formats/ccvf_dsk.cpp16
-rw-r--r--src/lib/formats/ccvf_dsk.h8
-rw-r--r--src/lib/formats/cgen_cas.cpp8
-rw-r--r--src/lib/formats/coco_cas.cpp24
-rw-r--r--src/lib/formats/concept_dsk.cpp18
-rw-r--r--src/lib/formats/concept_dsk.h6
-rw-r--r--src/lib/formats/coupedsk.cpp12
-rw-r--r--src/lib/formats/coupedsk.h4
-rw-r--r--src/lib/formats/cqm_dsk.cpp44
-rw-r--r--src/lib/formats/cqm_dsk.h4
-rw-r--r--src/lib/formats/csw_cas.cpp52
-rw-r--r--src/lib/formats/d64_dsk.cpp40
-rw-r--r--src/lib/formats/d64_dsk.h34
-rw-r--r--src/lib/formats/d80_dsk.cpp6
-rw-r--r--src/lib/formats/d80_dsk.h6
-rw-r--r--src/lib/formats/d88_dsk.cpp90
-rw-r--r--src/lib/formats/d88_dsk.h4
-rw-r--r--src/lib/formats/dcp_dsk.cpp14
-rw-r--r--src/lib/formats/dcp_dsk.h4
-rw-r--r--src/lib/formats/dfi_dsk.cpp36
-rw-r--r--src/lib/formats/dfi_dsk.h4
-rw-r--r--src/lib/formats/dim_dsk.cpp20
-rw-r--r--src/lib/formats/dim_dsk.h4
-rw-r--r--src/lib/formats/dip_dsk.cpp8
-rw-r--r--src/lib/formats/dip_dsk.h4
-rw-r--r--src/lib/formats/dmk_dsk.cpp18
-rw-r--r--src/lib/formats/dmk_dsk.h4
-rw-r--r--src/lib/formats/dsk_dsk.cpp86
-rw-r--r--src/lib/formats/dsk_dsk.h4
-rw-r--r--src/lib/formats/esq16_dsk.cpp18
-rw-r--r--src/lib/formats/esq16_dsk.h6
-rw-r--r--src/lib/formats/esq8_dsk.cpp10
-rw-r--r--src/lib/formats/esq8_dsk.h4
-rw-r--r--src/lib/formats/fc100_cas.cpp20
-rw-r--r--src/lib/formats/fdd_dsk.cpp26
-rw-r--r--src/lib/formats/fdd_dsk.h4
-rw-r--r--src/lib/formats/fdi_dsk.cpp64
-rw-r--r--src/lib/formats/flex_dsk.cpp6
-rw-r--r--src/lib/formats/flex_dsk.h34
-rw-r--r--src/lib/formats/flopimg.cpp294
-rw-r--r--src/lib/formats/flopimg.h160
-rw-r--r--src/lib/formats/fm7_cas.cpp10
-rw-r--r--src/lib/formats/fmsx_cas.cpp6
-rw-r--r--src/lib/formats/fsd_dsk.cpp22
-rw-r--r--src/lib/formats/fsd_dsk.h4
-rw-r--r--src/lib/formats/g64_dsk.cpp38
-rw-r--r--src/lib/formats/g64_dsk.h8
-rw-r--r--src/lib/formats/gtp_cas.cpp20
-rw-r--r--src/lib/formats/hect_tap.cpp22
-rw-r--r--src/lib/formats/hxchfe_dsk.cpp76
-rw-r--r--src/lib/formats/hxchfe_dsk.h8
-rw-r--r--src/lib/formats/hxcmfm_dsk.cpp32
-rw-r--r--src/lib/formats/hxcmfm_dsk.h4
-rw-r--r--src/lib/formats/imageutl.h108
-rw-r--r--src/lib/formats/imd_dsk.cpp86
-rw-r--r--src/lib/formats/imd_dsk.h4
-rw-r--r--src/lib/formats/ioprocs.cpp32
-rw-r--r--src/lib/formats/ioprocs.h14
-rw-r--r--src/lib/formats/ipf_dsk.cpp174
-rw-r--r--src/lib/formats/ipf_dsk.h88
-rw-r--r--src/lib/formats/jvc_dsk.cpp18
-rw-r--r--src/lib/formats/jvc_dsk.h14
-rw-r--r--src/lib/formats/kc_cas.cpp32
-rw-r--r--src/lib/formats/kim1_cas.cpp16
-rw-r--r--src/lib/formats/lviv_lvt.cpp12
-rw-r--r--src/lib/formats/m20_dsk.cpp6
-rw-r--r--src/lib/formats/m20_dsk.h4
-rw-r--r--src/lib/formats/mbee_cas.cpp24
-rw-r--r--src/lib/formats/mfi_dsk.cpp18
-rw-r--r--src/lib/formats/mfi_dsk.h4
-rw-r--r--src/lib/formats/mfm_hd.cpp30
-rw-r--r--src/lib/formats/mfm_hd.h20
-rw-r--r--src/lib/formats/mz_cas.cpp24
-rw-r--r--src/lib/formats/naslite_dsk.cpp2
-rw-r--r--src/lib/formats/naslite_dsk.h2
-rw-r--r--src/lib/formats/nes_dsk.cpp4
-rw-r--r--src/lib/formats/nfd_dsk.cpp42
-rw-r--r--src/lib/formats/nfd_dsk.h4
-rw-r--r--src/lib/formats/orao_cas.cpp12
-rw-r--r--src/lib/formats/oric_dsk.cpp12
-rw-r--r--src/lib/formats/oric_dsk.h4
-rw-r--r--src/lib/formats/oric_tap.cpp42
-rw-r--r--src/lib/formats/p6001_cas.cpp8
-rw-r--r--src/lib/formats/pasti_dsk.cpp74
-rw-r--r--src/lib/formats/pasti_dsk.h30
-rw-r--r--src/lib/formats/pc98fdi_dsk.cpp34
-rw-r--r--src/lib/formats/pc98fdi_dsk.h4
-rw-r--r--src/lib/formats/pc_dsk.cpp8
-rw-r--r--src/lib/formats/phc25_cas.cpp20
-rw-r--r--src/lib/formats/pmd_cas.cpp22
-rw-r--r--src/lib/formats/primoptp.cpp36
-rw-r--r--src/lib/formats/rk_cas.cpp30
-rw-r--r--src/lib/formats/rx50_dsk.cpp18
-rw-r--r--src/lib/formats/rx50_dsk.h6
-rw-r--r--src/lib/formats/sc3000_bit.cpp6
-rw-r--r--src/lib/formats/sol_cas.cpp46
-rw-r--r--src/lib/formats/sorc_cas.cpp18
-rw-r--r--src/lib/formats/sorc_dsk.cpp14
-rw-r--r--src/lib/formats/sord_cas.cpp16
-rw-r--r--src/lib/formats/spc1000_cas.cpp24
-rw-r--r--src/lib/formats/st_dsk.cpp50
-rw-r--r--src/lib/formats/st_dsk.h16
-rw-r--r--src/lib/formats/svi_cas.cpp6
-rw-r--r--src/lib/formats/svi_dsk.cpp16
-rw-r--r--src/lib/formats/svi_dsk.h4
-rw-r--r--src/lib/formats/td0_dsk.cpp128
-rw-r--r--src/lib/formats/td0_dsk.h4
-rw-r--r--src/lib/formats/thom_cas.cpp30
-rw-r--r--src/lib/formats/thom_dsk.cpp40
-rw-r--r--src/lib/formats/ti99_dsk.cpp50
-rw-r--r--src/lib/formats/ti99_dsk.h50
-rw-r--r--src/lib/formats/trs_cas.cpp10
-rw-r--r--src/lib/formats/tvc_cas.cpp22
-rw-r--r--src/lib/formats/tzx_cas.cpp98
-rw-r--r--src/lib/formats/uef_cas.cpp32
-rw-r--r--src/lib/formats/upd765_dsk.cpp26
-rw-r--r--src/lib/formats/upd765_dsk.h14
-rw-r--r--src/lib/formats/vdk_dsk.cpp18
-rw-r--r--src/lib/formats/vdk_dsk.h4
-rw-r--r--src/lib/formats/vg5k_cas.cpp18
-rw-r--r--src/lib/formats/victor9k_dsk.cpp28
-rw-r--r--src/lib/formats/victor9k_dsk.h24
-rw-r--r--src/lib/formats/vt_cas.cpp16
-rw-r--r--src/lib/formats/wavfile.cpp68
-rw-r--r--src/lib/formats/wd177x_dsk.cpp26
-rw-r--r--src/lib/formats/wd177x_dsk.h14
-rw-r--r--src/lib/formats/x07_cas.cpp12
-rw-r--r--src/lib/formats/x1_tap.cpp10
-rw-r--r--src/lib/formats/zx81_p.cpp36
161 files changed, 2414 insertions, 2414 deletions
diff --git a/src/lib/formats/a26_cas.cpp b/src/lib/formats/a26_cas.cpp
index 2e76eea73a0..5030c2bfe0f 100644
--- a/src/lib/formats/a26_cas.cpp
+++ b/src/lib/formats/a26_cas.cpp
@@ -17,16 +17,16 @@ Atari 2600 SuperCharger support
#define BIT_ONE_LENGTH 15
#define ZEROS_ONES 2755
-static const UINT16 one_wave[BIT_ONE_LENGTH] = {
+static const uint16_t one_wave[BIT_ONE_LENGTH] = {
0x2AE5, 0x4E60, 0x644E, 0x68E4, 0x5B56, 0x3DFE, 0x15ED, 0xEA13, 0xC202, 0xA4AA,
0x971C, 0x9BB2, 0xB1A0, 0xD51B, 0x0000
};
-static const UINT16 zero_wave[BIT_ZERO_LENGTH] = {
+static const uint16_t zero_wave[BIT_ZERO_LENGTH] = {
0x3DFE, 0x644E, 0x644E, 0x3DFE, 0x0000, 0xC202, 0x9BB2, 0x9BB2, 0xC202, 0x0000
};
-static int a26_cas_output_wave( INT16 **buffer, INT16 wave_data, int length ) {
+static int a26_cas_output_wave( int16_t **buffer, int16_t wave_data, int length ) {
int i;
if ( buffer ) {
@@ -38,10 +38,10 @@ static int a26_cas_output_wave( INT16 **buffer, INT16 wave_data, int length ) {
return length;
}
-static int a26_cas_output_bit( INT16 **buffer, int bit ) {
+static int a26_cas_output_bit( int16_t **buffer, int bit ) {
int size = 0;
int bit_size = bit ? BIT_ONE_LENGTH : BIT_ZERO_LENGTH;
- const INT16 *p = bit ? (const INT16 *)one_wave : (const INT16 *)zero_wave;
+ const int16_t *p = bit ? (const int16_t *)one_wave : (const int16_t *)zero_wave;
int i;
for ( i = 0; i < bit_size; i++ ) {
@@ -51,7 +51,7 @@ static int a26_cas_output_bit( INT16 **buffer, int bit ) {
return size;
}
-static int a26_cas_output_byte( INT16 **buffer, UINT8 byte ) {
+static int a26_cas_output_byte( int16_t **buffer, uint8_t byte ) {
int size = 0;
int i;
@@ -61,14 +61,14 @@ static int a26_cas_output_byte( INT16 **buffer, UINT8 byte ) {
return size;
}
-static int a26_cas_clearing_tone( INT16 **buffer ) {
+static int a26_cas_clearing_tone( int16_t **buffer ) {
int size = 0;
size += a26_cas_output_wave( buffer, 0, 44100 );
return size;
}
-static int a26_cas_zeros_ones( INT16 **buffer ) {
+static int a26_cas_zeros_ones( int16_t **buffer ) {
int size = 0;
int i;
@@ -81,7 +81,7 @@ static int a26_cas_zeros_ones( INT16 **buffer ) {
return size;
}
-static int a26_cas_output_contents( INT16 **buffer, const UINT8 *bytes ) {
+static int a26_cas_output_contents( int16_t **buffer, const uint8_t *bytes ) {
int size = 0;
int i, pages, j;
@@ -104,7 +104,7 @@ static int a26_cas_output_contents( INT16 **buffer, const UINT8 *bytes ) {
return size;
}
-static int a26_cas_do_work( INT16 **buffer, const UINT8 *bytes ) {
+static int a26_cas_do_work( int16_t **buffer, const uint8_t *bytes ) {
int size = 0;
/* Output clearing tone */
@@ -122,13 +122,13 @@ static int a26_cas_do_work( INT16 **buffer, const UINT8 *bytes ) {
return size;
}
-static int a26_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
- INT16 *p = buffer;
+static int a26_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
+ int16_t *p = buffer;
- return a26_cas_do_work( &p, (const UINT8 *)bytes );
+ return a26_cas_do_work( &p, (const uint8_t *)bytes );
}
-static int a26_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int a26_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
return a26_cas_do_work( nullptr, casdata );
}
@@ -143,7 +143,7 @@ static const struct CassetteLegacyWaveFiller a26_legacy_fill_wave = {
};
static cassette_image::error a26_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) {
- UINT64 size;
+ uint64_t size;
size = cassette_image_size( cassette );
if ( size == A26_CAS_SIZE ) {
diff --git a/src/lib/formats/ace_tap.cpp b/src/lib/formats/ace_tap.cpp
index 6d0e4ad2c6e..56b4bd877c8 100644
--- a/src/lib/formats/ace_tap.cpp
+++ b/src/lib/formats/ace_tap.cpp
@@ -26,7 +26,7 @@ static int cas_size;
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-static inline int ace_tap_cycle(INT16 *buffer, int sample_pos, int high, int low)
+static inline int ace_tap_cycle(int16_t *buffer, int sample_pos, int high, int low)
{
int i = 0;
@@ -48,7 +48,7 @@ static inline int ace_tap_cycle(INT16 *buffer, int sample_pos, int high, int low
}
-static inline int ace_tap_silence(INT16 *buffer, int sample_pos, int samples)
+static inline int ace_tap_silence(int16_t *buffer, int sample_pos, int samples)
{
int i = 0;
@@ -64,7 +64,7 @@ static inline int ace_tap_silence(INT16 *buffer, int sample_pos, int samples)
}
-static inline int ace_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
+static inline int ace_tap_byte(int16_t *buffer, int sample_pos, uint8_t data)
{
int i, samples;
@@ -82,7 +82,7 @@ static inline int ace_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
}
-static int ace_handle_tap(INT16 *buffer, const UINT8 *casdata)
+static int ace_handle_tap(int16_t *buffer, const uint8_t *casdata)
{
int data_pos, sample_count;
@@ -97,7 +97,7 @@ static int ace_handle_tap(INT16 *buffer, const UINT8 *casdata)
while( data_pos < cas_size )
{
- UINT16 block_size;
+ uint16_t block_size;
int i;
/* Handle a block of tape data */
@@ -138,7 +138,7 @@ static int ace_handle_tap(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int ace_tap_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int ace_tap_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return ace_handle_tap( buffer, bytes );
}
@@ -147,7 +147,7 @@ static int ace_tap_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int ace_tap_to_wav_size(const UINT8 *casdata, int caslen)
+static int ace_tap_to_wav_size(const uint8_t *casdata, int caslen)
{
cas_size = caslen;
diff --git a/src/lib/formats/ace_tap.h b/src/lib/formats/ace_tap.h
index 27a1e93129d..0113fdf6484 100644
--- a/src/lib/formats/ace_tap.h
+++ b/src/lib/formats/ace_tap.h
@@ -16,14 +16,14 @@
#if 0
struct ace_tape_t
{
- UINT8 hdr_type;
- UINT8 hdr_name[10];
- UINT16 hdr_len;
- UINT16 hdr_addr;
- UINT8 hdr_vars[8];
- UINT8 hdr_3c4c;
- UINT8 hdr_3c4d;
- UINT16 dat_len;
+ uint8_t hdr_type;
+ uint8_t hdr_name[10];
+ uint16_t hdr_len;
+ uint16_t hdr_addr;
+ uint8_t hdr_vars[8];
+ uint8_t hdr_3c4c;
+ uint8_t hdr_3c4d;
+ uint16_t dat_len;
};
#endif
diff --git a/src/lib/formats/acorn_dsk.cpp b/src/lib/formats/acorn_dsk.cpp
index e8e0289ead1..b880b28018f 100644
--- a/src/lib/formats/acorn_dsk.cpp
+++ b/src/lib/formats/acorn_dsk.cpp
@@ -29,23 +29,23 @@ const char *acorn_ssd_format::extensions() const
return "ssd,bbc,img";
}
-int acorn_ssd_format::find_size(io_generic *io, UINT32 form_factor)
+int acorn_ssd_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT8 cat[8];
- UINT32 sectors0, sectors2;
+ uint8_t cat[8];
+ uint32_t sectors0, sectors2;
// read sector count from side 0 catalogue
io_generic_read(io, cat, 0x100, 8);
sectors0 = ((cat[6] & 3) << 8) + cat[7];
LOG_FORMATS("ssd: sector count 0: %d %s\n", sectors0, sectors0 % 10 != 0 ? "invalid" : "");
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].form_factor; i++) {
const format &f = formats[i];
if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
- if ((size <= (UINT64)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
+ if ((size <= (uint64_t)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
if (f.head_count == 2)
{
// read sector count from side 2 catalogue
@@ -66,7 +66,7 @@ int acorn_ssd_format::find_size(io_generic *io, UINT32 form_factor)
return -1;
}
-int acorn_ssd_format::identify(io_generic *io, UINT32 form_factor)
+int acorn_ssd_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -124,23 +124,23 @@ const char *acorn_dsd_format::extensions() const
return "dsd";
}
-int acorn_dsd_format::find_size(io_generic *io, UINT32 form_factor)
+int acorn_dsd_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT8 cat[8];
- UINT32 sectors0, sectors2;
+ uint8_t cat[8];
+ uint32_t sectors0, sectors2;
// read sector count from side 0 catalogue
io_generic_read(io, cat, 0x100, 8);
sectors0 = ((cat[6] & 3) << 8) + cat[7];
LOG_FORMATS("dsd: sector count 0: %d %s\n", sectors0, sectors0 % 10 != 0 ? "invalid" : "");
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for (int i = 0; formats[i].form_factor; i++) {
const format &f = formats[i];
if (form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
- if ((size <= (UINT64)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
+ if ((size <= (uint64_t)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
// read sector count from side 2 catalogue
io_generic_read(io, cat, 0xb00, 8); // interleaved
sectors2 = ((cat[6] & 3) << 8) + cat[7];
@@ -154,7 +154,7 @@ int acorn_dsd_format::find_size(io_generic *io, UINT32 form_factor)
return -1;
}
-int acorn_dsd_format::identify(io_generic *io, UINT32 form_factor)
+int acorn_dsd_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -204,23 +204,23 @@ const char *opus_ddos_format::extensions() const
return "dds";
}
-int opus_ddos_format::find_size(io_generic *io, UINT32 form_factor)
+int opus_ddos_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT8 cat[8];
- UINT32 sectors0, sectors2;
+ uint8_t cat[8];
+ uint32_t sectors0, sectors2;
// read sector count from side 0 catalogue
io_generic_read(io, cat, 0x1000, 8);
sectors0 = (cat[1] << 8) + cat[2];
LOG_FORMATS("ddos: sector count 0: %d %s\n", sectors0, sectors0 % 18 != 0 ? "invalid" : "");
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for (int i = 0; formats[i].form_factor; i++) {
const format &f = formats[i];
if (form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
- if ((size <= (UINT64)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
+ if ((size <= (uint64_t)compute_track_size(f) * f.track_count * f.head_count) && (sectors0 <= f.track_count * f.sector_count)) {
if (f.head_count == 2)
{
// read sector count from side 2 catalogue
@@ -241,7 +241,7 @@ int opus_ddos_format::find_size(io_generic *io, UINT32 form_factor)
return -1;
}
-int opus_ddos_format::identify(io_generic *io, UINT32 form_factor)
+int opus_ddos_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -299,11 +299,11 @@ const char *acorn_adfs_old_format::extensions() const
return "adf,ads,adm,adl";
}
-int acorn_adfs_old_format::find_size(io_generic *io, UINT32 form_factor)
+int acorn_adfs_old_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT8 map[3];
- UINT32 sectors;
- UINT8 oldmap[4];
+ uint8_t map[3];
+ uint32_t sectors;
+ uint8_t oldmap[4];
// read sector count from free space map
io_generic_read(io, map, 0xfc, 3);
@@ -314,14 +314,14 @@ int acorn_adfs_old_format::find_size(io_generic *io, UINT32 form_factor)
io_generic_read(io, oldmap, 0x201, 4);
LOG_FORMATS("adfs_o: map identifier %s %s\n", oldmap, memcmp(oldmap, "Hugo", 4) != 0 ? "invalid" : "");
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].form_factor; i++) {
const format &f = formats[i];
if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
// valid images will have map identifier 'Hugo' and sector counts adfs-s = 0x280; adfs-m = 0x500; adfs-l = 0xa00; though many adfs-s images are incorrect
- if ((size <= (UINT64)compute_track_size(f) * f.track_count * f.head_count) && memcmp(oldmap, "Hugo", 4) == 0 && (sectors == 0x280 || sectors == 0x500 || sectors == 0xa00 || size == 819200)) {
+ if ((size <= (uint64_t)compute_track_size(f) * f.track_count * f.head_count) && memcmp(oldmap, "Hugo", 4) == 0 && (sectors == 0x280 || sectors == 0x500 || sectors == 0xa00 || size == 819200)) {
return i;
}
}
@@ -329,7 +329,7 @@ int acorn_adfs_old_format::find_size(io_generic *io, UINT32 form_factor)
return -1;
}
-int acorn_adfs_old_format::identify(io_generic *io, UINT32 form_factor)
+int acorn_adfs_old_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -395,10 +395,10 @@ const char *acorn_adfs_new_format::extensions() const
return "adf";
}
-int acorn_adfs_new_format::find_size(io_generic *io, UINT32 form_factor)
+int acorn_adfs_new_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT8 dform[4];
- UINT8 eform[4];
+ uint8_t dform[4];
+ uint8_t eform[4];
// read map identifiers for D and E formats
io_generic_read(io, dform, 0x401, 4);
@@ -406,14 +406,14 @@ int acorn_adfs_new_format::find_size(io_generic *io, UINT32 form_factor)
io_generic_read(io, eform, 0x801, 4);
LOG_FORMATS("adfs_n: map identifier (E format) %s %s\n", eform, memcmp(eform, "Nick", 4) != 0 ? "invalid" : "");
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for (int i = 0; formats[i].form_factor; i++) {
const format &f = formats[i];
if (form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
// valid images will have map identifier Nick
- if ((size == (UINT64)compute_track_size(f) * f.track_count * f.head_count) && (memcmp(dform, "Nick", 4) == 0 || memcmp(eform, "Nick", 4) == 0)) {
+ if ((size == (uint64_t)compute_track_size(f) * f.track_count * f.head_count) && (memcmp(dform, "Nick", 4) == 0 || memcmp(eform, "Nick", 4) == 0)) {
return i;
}
}
@@ -421,7 +421,7 @@ int acorn_adfs_new_format::find_size(io_generic *io, UINT32 form_factor)
return -1;
}
-int acorn_adfs_new_format::identify(io_generic *io, UINT32 form_factor)
+int acorn_adfs_new_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -471,18 +471,18 @@ const char *acorn_dos_format::extensions() const
return "img,adl";
}
-int acorn_dos_format::find_size(io_generic *io, UINT32 form_factor)
+int acorn_dos_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT8 cat[3];
- UINT32 sectors;
+ uint8_t cat[3];
+ uint32_t sectors;
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].form_factor; i++) {
const format &f = formats[i];
if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
- if (size == (UINT64)compute_track_size(f) * f.track_count * f.head_count) {
+ if (size == (uint64_t)compute_track_size(f) * f.track_count * f.head_count) {
switch (size)
{
case 640 * 1024: // 640K Acorn (Bootable) DOS Format
@@ -513,7 +513,7 @@ int acorn_dos_format::find_size(io_generic *io, UINT32 form_factor)
return -1;
}
-int acorn_dos_format::identify(io_generic *io, UINT32 form_factor)
+int acorn_dos_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -567,9 +567,9 @@ const char *acorn_cpm_format::extensions() const
return "img,ssd,dsd";
}
-int acorn_cpm_format::identify(io_generic *io, UINT32 form_factor)
+int acorn_cpm_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[8];
+ uint8_t h[8];
io_generic_read(io, h, 0, 8);
@@ -627,7 +627,7 @@ const char *torch_cpn_format::extensions() const
return "dsd";
}
-int torch_cpn_format::identify(io_generic *io, UINT32 form_factor)
+int torch_cpn_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
diff --git a/src/lib/formats/acorn_dsk.h b/src/lib/formats/acorn_dsk.h
index 8982169a31b..76d4462b01d 100644
--- a/src/lib/formats/acorn_dsk.h
+++ b/src/lib/formats/acorn_dsk.h
@@ -20,8 +20,8 @@ class acorn_ssd_format : public wd177x_format
public:
acorn_ssd_format();
- virtual int find_size(io_generic *io, UINT32 form_factor) override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int find_size(io_generic *io, uint32_t form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -36,8 +36,8 @@ class acorn_dsd_format : public wd177x_format
public:
acorn_dsd_format();
- virtual int find_size(io_generic *io, UINT32 form_factor) override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int find_size(io_generic *io, uint32_t form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -52,8 +52,8 @@ class opus_ddos_format : public wd177x_format
public:
opus_ddos_format();
- virtual int find_size(io_generic *io, UINT32 form_factor) override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int find_size(io_generic *io, uint32_t form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -68,8 +68,8 @@ class acorn_adfs_old_format : public wd177x_format
public:
acorn_adfs_old_format();
- virtual int find_size(io_generic *io, UINT32 form_factor) override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int find_size(io_generic *io, uint32_t form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -84,8 +84,8 @@ class acorn_adfs_new_format : public wd177x_format
public:
acorn_adfs_new_format();
- virtual int find_size(io_generic *io, UINT32 form_factor) override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int find_size(io_generic *io, uint32_t form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -100,8 +100,8 @@ class acorn_dos_format : public wd177x_format
public:
acorn_dos_format();
- virtual int find_size(io_generic *io, UINT32 form_factor) override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int find_size(io_generic *io, uint32_t form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -116,7 +116,7 @@ class acorn_cpm_format : public wd177x_format
public:
acorn_cpm_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
@@ -131,7 +131,7 @@ class torch_cpn_format : public wd177x_format
public:
torch_cpn_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/adam_cas.cpp b/src/lib/formats/adam_cas.cpp
index 30deb27a1a9..3de9413cb90 100644
--- a/src/lib/formats/adam_cas.cpp
+++ b/src/lib/formats/adam_cas.cpp
@@ -83,10 +83,10 @@ cassette_image::error coladam_put_byte(cassette_image *cass, int channel, double
return err;
}
-cassette_image::error coladam_put_block(cassette_image *cass, int channel, double *time_index, int *prev_sign, int block_index, UINT8 *buffer, int layout_type)
+cassette_image::error coladam_put_block(cassette_image *cass, int channel, double *time_index, int *prev_sign, int block_index, uint8_t *buffer, int layout_type)
{
int i, checksum_16=0;
- UINT8 header[] = { 0x16, 0x48, 0x45, 0x00, static_cast<UINT8>(block_index), 0xff, static_cast<UINT8>(0xff - block_index), 0x00, 0x80, 0xf4 };
+ uint8_t header[] = { 0x16, 0x48, 0x45, 0x00, static_cast<uint8_t>(block_index), 0xff, static_cast<uint8_t>(0xff - block_index), 0x00, 0x80, 0xf4 };
cassette_image::error err;
if (layout_type == TYPE_GW)
{
@@ -130,7 +130,7 @@ static cassette_image::error coladam_ddp_load( cassette_image *cass )
{
double time = 0.;
int i, block, prev_sign=-1;
- UINT8 buffer[0x400];
+ uint8_t buffer[0x400];
cassette_image::error err = cassette_image::error::SUCCESS;
// It would appear that data packs that originally had the type GW data layout and headers work fine when converted to type
diff --git a/src/lib/formats/afs_dsk.cpp b/src/lib/formats/afs_dsk.cpp
index 5e1ff5aa66c..dc952b60181 100644
--- a/src/lib/formats/afs_dsk.cpp
+++ b/src/lib/formats/afs_dsk.cpp
@@ -30,7 +30,7 @@ const char *afs_format::extensions() const
return "adl,img";
}
-int afs_format::identify(io_generic *io, UINT32 form_factor)
+int afs_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
diff --git a/src/lib/formats/afs_dsk.h b/src/lib/formats/afs_dsk.h
index e8e7190f7cd..e9afc3e699f 100644
--- a/src/lib/formats/afs_dsk.h
+++ b/src/lib/formats/afs_dsk.h
@@ -21,7 +21,7 @@ class afs_format : public wd177x_format
public:
afs_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual int get_image_offset(const format &f, int head, int track) override;
virtual const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/ami_dsk.cpp b/src/lib/formats/ami_dsk.cpp
index a222208d46d..8a757e6a4c9 100644
--- a/src/lib/formats/ami_dsk.cpp
+++ b/src/lib/formats/ami_dsk.cpp
@@ -36,9 +36,9 @@ bool adf_format::supports_save() const
return true;
}
-int adf_format::identify(io_generic *io, UINT32 form_factor)
+int adf_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
if ((size == 901120) || (size == 912384) || (size == 1802240))
{
return 50;
@@ -46,10 +46,10 @@ int adf_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool adf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool adf_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
desc_s sectors[22];
- UINT8 sectdata[512*22];
+ uint8_t sectdata[512*22];
bool is_hd = false;
int tracks = 80;
@@ -59,7 +59,7 @@ bool adf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sectors[i].sector_id = i;
}
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
if(size == 901120)
{
is_hd = false;
@@ -97,7 +97,7 @@ bool adf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
return true;
}
-UINT32 adf_format::g32(const UINT8 *trackbuf, int track_size, int pos)
+uint32_t adf_format::g32(const uint8_t *trackbuf, int track_size, int pos)
{
if(pos >= 0 && track_size-pos >= 40) {
int pp = pos >> 3;
@@ -109,7 +109,7 @@ UINT32 adf_format::g32(const UINT8 *trackbuf, int track_size, int pos)
(trackbuf[pp+3] << dp) |
(trackbuf[pp+4] >> (8-dp));
} else {
- UINT32 res = 0;
+ uint32_t res = 0;
for(int i=0; i<32; i++) {
int pp = (pos+i) % track_size;
if(trackbuf[pp>>3] & (0x80 >> (pp & 7)))
@@ -119,9 +119,9 @@ UINT32 adf_format::g32(const UINT8 *trackbuf, int track_size, int pos)
}
}
-UINT32 adf_format::checksum(const UINT8 *trackbuf, int track_size, int pos, int long_count)
+uint32_t adf_format::checksum(const uint8_t *trackbuf, int track_size, int pos, int long_count)
{
- UINT32 check = 0;
+ uint32_t check = 0;
for(int i=0; i<long_count; i++)
check ^= g32(trackbuf, track_size, pos+32*i);
return check & 0x55555555;
@@ -129,8 +129,8 @@ UINT32 adf_format::checksum(const UINT8 *trackbuf, int track_size, int pos, int
bool adf_format::save(io_generic *io, floppy_image *image)
{
- UINT8 sectdata[512*22];
- UINT8 trackbuf[300000/8];
+ uint8_t sectdata[512*22];
+ uint8_t trackbuf[300000/8];
bool hd = image->get_variant() == floppy_image::DSHD;
@@ -145,14 +145,14 @@ bool adf_format::save(io_generic *io, floppy_image *image)
if(g32(trackbuf, track_size, i) == 0x44894489 &&
(g32(trackbuf, track_size, i+384) & 0x55555555) == checksum(trackbuf, track_size, i+32, 10) &&
(g32(trackbuf, track_size, i+448) & 0x55555555) == checksum(trackbuf, track_size, i+480, 256)) {
- UINT32 head = ((g32(trackbuf, track_size, i+32) & 0x55555555) << 1) | (g32(trackbuf, track_size, i+64) & 0x55555555);
+ uint32_t head = ((g32(trackbuf, track_size, i+32) & 0x55555555) << 1) | (g32(trackbuf, track_size, i+64) & 0x55555555);
int sect = (head >> 8) & 0xff;
if(sect > (hd ? 22 : 11))
continue;
- UINT8 *dest = sectdata + 512*sect;
+ uint8_t *dest = sectdata + 512*sect;
for(int j=0; j<128; j++) {
- UINT32 val = ((g32(trackbuf, track_size, i+480+32*j) & 0x55555555) << 1) | (g32(trackbuf, track_size, i+4576+32*j) & 0x55555555);
+ uint32_t val = ((g32(trackbuf, track_size, i+480+32*j) & 0x55555555) << 1) | (g32(trackbuf, track_size, i+4576+32*j) & 0x55555555);
*dest++ = val >> 24;
*dest++ = val >> 16;
*dest++ = val >> 8;
diff --git a/src/lib/formats/ami_dsk.h b/src/lib/formats/ami_dsk.h
index f10ac007d71..3fcddff023e 100644
--- a/src/lib/formats/ami_dsk.h
+++ b/src/lib/formats/ami_dsk.h
@@ -18,8 +18,8 @@ class adf_format : public floppy_image_format_t
public:
adf_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
@@ -28,8 +28,8 @@ public:
virtual bool supports_save() const override;
private:
- static UINT32 g32(const UINT8 *trackbuf, int track_size, int pos);
- static UINT32 checksum(const UINT8 *trackbuf, int track_size, int pos, int long_count);
+ static uint32_t g32(const uint8_t *trackbuf, int track_size, int pos);
+ static uint32_t checksum(const uint8_t *trackbuf, int track_size, int pos, int long_count);
};
extern const floppy_format_type FLOPPY_ADF_FORMAT;
diff --git a/src/lib/formats/ap2_dsk.cpp b/src/lib/formats/ap2_dsk.cpp
index 774d4785735..6cba1db6757 100644
--- a/src/lib/formats/ap2_dsk.cpp
+++ b/src/lib/formats/ap2_dsk.cpp
@@ -22,25 +22,25 @@
/* used in for all Apple II images */
-static UINT32 apple2_get_track_size(floppy_image_legacy *floppy, int head, int track);
-static int disk_decode_nib(UINT8 *data, const UINT8 *nibble, int *volume, int *track, int *sector);
-static void disk_encode_nib(UINT8 *nibble, const UINT8 *data, int volume, int track, int sector);
+static uint32_t apple2_get_track_size(floppy_image_legacy *floppy, int head, int track);
+static int disk_decode_nib(uint8_t *data, const uint8_t *nibble, int *volume, int *track, int *sector);
+static void disk_encode_nib(uint8_t *nibble, const uint8_t *data, int volume, int track, int sector);
/* used in DOS/ProDOS order images */
static int apple2_do_translate_sector(floppy_image_legacy *floppy, int sector);
static int apple2_po_translate_sector(floppy_image_legacy *floppy, int sector);
-static floperr_t apple2_dsk_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen);
-static floperr_t apple2_dsk_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen);
+static floperr_t apple2_dsk_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen);
+static floperr_t apple2_dsk_write_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buflen);
/* used in nibble order images */
-static floperr_t apple2_nib_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen);
-static floperr_t apple2_nib_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen);
+static floperr_t apple2_nib_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen);
+static floperr_t apple2_nib_write_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buflen);
static floperr_t apple2_nib_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen);
static floperr_t apple2_nib_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam);
-static floperr_t apple2_nib_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length);
+static floperr_t apple2_nib_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length);
-static const UINT8 translate6[0x40] =
+static const uint8_t translate6[0x40] =
{
0x96, 0x97, 0x9a, 0x9b, 0x9d, 0x9e, 0x9f, 0xa6,
0xa7, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb2, 0xb3,
@@ -58,11 +58,11 @@ static const UINT8 translate6[0x40] =
* Utility code
* ----------------------------------------------------------------------- */
-static const UINT8 *get_untranslate6_map(void)
+static const uint8_t *get_untranslate6_map(void)
{
- static UINT8 map[256];
+ static uint8_t map[256];
static int map_inited = 0;
- UINT8 i;
+ uint8_t i;
if (!map_inited)
{
@@ -133,8 +133,8 @@ static floperr_t apple2_general_construct(floppy_image_legacy *floppy, int flopp
static FLOPPY_IDENTIFY(apple2_dsk_identify)
{
- UINT64 size;
- UINT64 expected_size;
+ uint64_t size;
+ uint64_t expected_size;
size = floppy_image_size(floppy);
expected_size = APPLE2_TRACK_COUNT * APPLE2_SECTOR_COUNT * APPLE2_SECTOR_SIZE;
@@ -154,7 +154,7 @@ static FLOPPY_IDENTIFY(apple2_dsk_identify)
static int apple2_do_translate_sector(floppy_image_legacy *floppy, int sector)
{
- static const UINT8 skewing[] =
+ static const uint8_t skewing[] =
{
/* DOS order (*.do) */
0x00, 0x07, 0x0E, 0x06, 0x0D, 0x05, 0x0C, 0x04,
@@ -167,7 +167,7 @@ static int apple2_do_translate_sector(floppy_image_legacy *floppy, int sector)
static int apple2_po_translate_sector(floppy_image_legacy *floppy, int sector)
{
- static const UINT8 skewing[] =
+ static const uint8_t skewing[] =
{
/* ProDOS order (*.po) */
0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B,
@@ -192,11 +192,11 @@ static FLOPPY_CONSTRUCT(apple2_po_construct)
-static floperr_t apple2_dsk_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen)
+static floperr_t apple2_dsk_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen)
{
- UINT8 sector_buffer[APPLE2_SECTOR_SIZE];
+ uint8_t sector_buffer[APPLE2_SECTOR_SIZE];
int sector;
- UINT8 *nibble;
+ uint8_t *nibble;
if (buflen < APPLE2_NIBBLE_SIZE*APPLE2_SECTOR_COUNT)
return FLOPPY_ERROR_INTERNAL;
@@ -207,7 +207,7 @@ static floperr_t apple2_dsk_read_track(floppy_image_legacy *floppy, int head, in
for (sector = 0; sector < APPLE2_SECTOR_COUNT; sector++)
{
- nibble = (UINT8 *)buffer;
+ nibble = (uint8_t *)buffer;
nibble += sector * APPLE2_SMALL_NIBBLE_SIZE;
floppy_read_sector(floppy, head, track, sector, 0, sector_buffer, sizeof(sector_buffer));
@@ -218,18 +218,18 @@ static floperr_t apple2_dsk_read_track(floppy_image_legacy *floppy, int head, in
-static floperr_t apple2_dsk_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen)
+static floperr_t apple2_dsk_write_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buflen)
{
int sector;
- UINT8 sector_buffer[APPLE2_SECTOR_SIZE];
- const UINT8 *nibble;
+ uint8_t sector_buffer[APPLE2_SECTOR_SIZE];
+ const uint8_t *nibble;
if (offset != 0)
return FLOPPY_ERROR_UNSUPPORTED;
for (sector = 0; sector < APPLE2_SECTOR_COUNT; sector++)
{
- nibble = (UINT8 *)buffer;
+ nibble = (uint8_t *)buffer;
nibble += sector * APPLE2_SMALL_NIBBLE_SIZE;
disk_decode_nib(sector_buffer, nibble, nullptr, nullptr, nullptr);
@@ -247,7 +247,7 @@ static floperr_t apple2_dsk_write_track(floppy_image_legacy *floppy, int head, i
static FLOPPY_IDENTIFY(apple2_nib_identify)
{
- UINT64 size;
+ uint64_t size;
size = floppy_image_size(floppy);
*vote = ((size == APPLE2_TRACK_COUNT * APPLE2_SECTOR_COUNT * APPLE2_NIBBLE_SIZE) || (size == (APPLE2_TRACK_COUNT + 1) * APPLE2_SECTOR_COUNT * APPLE2_NIBBLE_SIZE)) ? 100 : 0;
return FLOPPY_ERROR_SUCCESS;
@@ -262,7 +262,7 @@ static FLOPPY_CONSTRUCT(apple2_nib_construct)
-static floperr_t apple2_nib_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen)
+static floperr_t apple2_nib_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen)
{
if ((head != 0) || (track < 0) || (track > APPLE2_TRACK_COUNT))
return FLOPPY_ERROR_SEEKERROR;
@@ -274,7 +274,7 @@ static floperr_t apple2_nib_read_track(floppy_image_legacy *floppy, int head, in
-static floperr_t apple2_nib_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen)
+static floperr_t apple2_nib_write_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buflen)
{
if ((head != 0) || (track < 0) || (track > APPLE2_TRACK_COUNT))
return FLOPPY_ERROR_SEEKERROR;
@@ -290,7 +290,7 @@ static floperr_t apple2_nib_write_track(floppy_image_legacy *floppy, int head, i
* Track conversion
* ----------------------------------------------------------------------- */
-static int decode_nibbyte(UINT8 *nibint, const UINT8 *nibdata)
+static int decode_nibbyte(uint8_t *nibint, const uint8_t *nibdata)
{
if ((nibdata[0] & 0xAA) != 0xAA)
return 1;
@@ -304,16 +304,16 @@ static int decode_nibbyte(UINT8 *nibint, const UINT8 *nibdata)
-static int disk_decode_nib(UINT8 *data, const UINT8 *nibble, int *volume, int *track, int *sector)
+static int disk_decode_nib(uint8_t *data, const uint8_t *nibble, int *volume, int *track, int *sector)
{
- UINT8 read_volume;
- UINT8 read_track;
- UINT8 read_sector;
- UINT8 read_checksum;
+ uint8_t read_volume;
+ uint8_t read_track;
+ uint8_t read_sector;
+ uint8_t read_checksum;
int i;
- UINT8 b, xorvalue, newvalue;
+ uint8_t b, xorvalue, newvalue;
- const UINT8 *untranslate6 = get_untranslate6_map();
+ const uint8_t *untranslate6 = get_untranslate6_map();
/* pick apart the volume/track/sector info and checksum */
if (decode_nibbyte(&read_volume, &nibble[10]))
@@ -367,8 +367,8 @@ static int disk_decode_nib(UINT8 *data, const UINT8 *nibble, int *volume, int *t
static floperr_t apple2_nib_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
{
floperr_t err;
- const UINT8 *nibble;
- UINT8 *track_data;
+ const uint8_t *nibble;
+ uint8_t *track_data;
void *track_data_v;
if ((sector < 0) || (sector >= APPLE2_SECTOR_COUNT))
@@ -379,11 +379,11 @@ static floperr_t apple2_nib_read_sector(floppy_image_legacy *floppy, int head, i
err = floppy_load_track(floppy, head, track, FALSE, &track_data_v, nullptr);
if (err)
return err;
- track_data = (UINT8 *) track_data_v;
+ track_data = (uint8_t *) track_data_v;
nibble = track_data + (sector * APPLE2_NIBBLE_SIZE);
- if (disk_decode_nib((UINT8 *)buffer, nibble, nullptr, nullptr, nullptr))
+ if (disk_decode_nib((uint8_t *)buffer, nibble, nullptr, nullptr, nullptr))
return FLOPPY_ERROR_INVALIDIMAGE;
return FLOPPY_ERROR_SUCCESS;
@@ -391,7 +391,7 @@ static floperr_t apple2_nib_read_sector(floppy_image_legacy *floppy, int head, i
-static void disk_encode_nib(UINT8 *nibble, const UINT8 *data, int volume, int track, int sector)
+static void disk_encode_nib(uint8_t *nibble, const uint8_t *data, int volume, int track, int sector)
{
int checksum, oldvalue, xorvalue, i;
@@ -457,7 +457,7 @@ static void disk_encode_nib(UINT8 *nibble, const UINT8 *data, int volume, int tr
static floperr_t apple2_nib_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
{
floperr_t err;
- UINT8 *track_data;
+ uint8_t *track_data;
void *track_data_v;
if ((sector < 0) || (sector >= APPLE2_SECTOR_COUNT))
@@ -468,15 +468,15 @@ static floperr_t apple2_nib_write_sector(floppy_image_legacy *floppy, int head,
err = floppy_load_track(floppy, head, track, TRUE, &track_data_v, nullptr);
if (err)
return err;
- track_data = (UINT8 *) track_data_v;
+ track_data = (uint8_t *) track_data_v;
- disk_encode_nib(track_data + sector * APPLE2_NIBBLE_SIZE, (const UINT8 *)buffer, 254, track, sector);
+ disk_encode_nib(track_data + sector * APPLE2_NIBBLE_SIZE, (const uint8_t *)buffer, 254, track, sector);
return FLOPPY_ERROR_SUCCESS;
}
-static floperr_t apple2_nib_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t apple2_nib_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
*sector_length = APPLE2_SECTOR_SIZE;
return FLOPPY_ERROR_SUCCESS;
@@ -484,7 +484,7 @@ static floperr_t apple2_nib_get_sector_length(floppy_image_legacy *floppy, int h
-static UINT32 apple2_get_track_size(floppy_image_legacy *floppy, int head, int track)
+static uint32_t apple2_get_track_size(floppy_image_legacy *floppy, int head, int track)
{
return APPLE2_NIBBLE_SIZE * APPLE2_SECTOR_COUNT;
}
@@ -522,13 +522,13 @@ LEGACY_FLOPPY_OPTIONS_END
****************************************************************************/
-static const UINT8 dos_skewing[] =
+static const uint8_t dos_skewing[] =
{
0x00, 0x07, 0x0E, 0x06, 0x0D, 0x05, 0x0C, 0x04,
0x0B, 0x03, 0x0A, 0x02, 0x09, 0x01, 0x08, 0x0F
};
-static const UINT8 prodos_skewing[] =
+static const uint8_t prodos_skewing[] =
{
0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B,
0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F
@@ -559,10 +559,10 @@ bool a2_16sect_format::supports_save() const
return true;
}
-int a2_16sect_format::identify(io_generic *io, UINT32 form_factor)
+int a2_16sect_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
- UINT32 expected_size = 35 * 16 * 256;
+ uint64_t size = io_generic_size(io);
+ uint32_t expected_size = 35 * 16 * 256;
// check standard size plus some oddball sizes in our softlist
if ((size == expected_size) || (size == 143403) || (size == 143363) || (size == 143358))
@@ -603,14 +603,14 @@ const floppy_image_format_t::desc_e a2_16sect_format::mac_gcr[] = {
{ END },
};
-bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool a2_16sect_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
m_prodos_order = false;
int fpos = 0;
for(int track=0; track < 35; track++) {
- std::vector<UINT32> track_data;
- UINT8 sector_data[256*16];
+ std::vector<uint32_t> track_data;
+ uint8_t sector_data[256*16];
static const unsigned char pascal_block1[4] = { 0x08, 0xa5, 0x0f, 0x29 };
static const unsigned char pascal2_block1[4] = { 0xff, 0xa2, 0x00, 0x8e };
static const unsigned char dos33_block1[4] = { 0xa2, 0x02, 0x8e, 0x52 };
@@ -682,7 +682,7 @@ bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
sector = dos_skewing[i];
}
- const UINT8 *sdata = sector_data + 256 * sector;
+ const uint8_t *sdata = sector_data + 256 * sector;
for(int j=0; j<20; j++)
raw_w(track_data, 10, 0x3fc);
raw_w(track_data, 8, 0xff);
@@ -700,9 +700,9 @@ bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
raw_w(track_data, 24, 0xd5aaad);
raw_w(track_data, 1, 0);
- UINT8 pval = 0x00;
+ uint8_t pval = 0x00;
for(int i=0; i<342; i++) {
- UINT8 nval;
+ uint8_t nval;
if(i >= 0x56)
nval = sdata[i - 0x56] >> 2;
else {
@@ -730,9 +730,9 @@ bool a2_16sect_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
return true;
}
-UINT8 a2_16sect_format::gb(const UINT8 *buf, int ts, int &pos, int &wrap)
+uint8_t a2_16sect_format::gb(const uint8_t *buf, int ts, int &pos, int &wrap)
{
- UINT8 v = 0;
+ uint8_t v = 0;
int w1 = wrap;
while(wrap != w1+2 && !(v & 0x80)) {
v = v << 1 | ((buf[pos >> 3] >> (7-(pos & 7))) & 1);
@@ -745,7 +745,7 @@ UINT8 a2_16sect_format::gb(const UINT8 *buf, int ts, int &pos, int &wrap)
return v;
}
-void a2_16sect_format::update_chk(const UINT8 *data, int size, UINT32 &chk)
+void a2_16sect_format::update_chk(const uint8_t *data, int size, uint32_t &chk)
{
}
@@ -786,10 +786,10 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
int pos_data = 0;
for(int track=0; track < 35; track++) {
- UINT8 sectdata[(256)*16];
+ uint8_t sectdata[(256)*16];
memset(sectdata, 0, sizeof(sectdata));
int nsect = 16;
- UINT8 buf[10000]; // normal is 51090 cells, e.g. 6387 bytes, add 50% and round up for denser than normal disks
+ uint8_t buf[10000]; // normal is 51090 cells, e.g. 6387 bytes, add 50% and round up for denser than normal disks
int ts;
#ifdef VERBOSE_SAVE
fprintf(stderr,"DEBUG: a2_16sect_format::save() about to generate bitstream from track %d...", track);
@@ -803,7 +803,7 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
int hb = 0;
int dosver = 0; // apple dos version; 0 = >=3.3, 1 = <3.3
for(;;) {
- UINT8 v = gb(buf, ts, pos, wrap);
+ uint8_t v = gb(buf, ts, pos, wrap);
if(v == 0xff) {
hb = 1;
}
@@ -821,16 +821,16 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
hb = 0;
if(hb == 4) {
- UINT8 h[11];
+ uint8_t h[11];
for(auto & elem : h)
elem = gb(buf, ts, pos, wrap);
- //UINT8 v2 = gcr6bw_tb[h[2]];
- UINT8 vl = gcr4_decode(h[0],h[1]);
- UINT8 tr = gcr4_decode(h[2],h[3]);
- UINT8 se = gcr4_decode(h[4],h[5]);
- UINT8 chk = gcr4_decode(h[6],h[7]);
+ //uint8_t v2 = gcr6bw_tb[h[2]];
+ uint8_t vl = gcr4_decode(h[0],h[1]);
+ uint8_t tr = gcr4_decode(h[2],h[3]);
+ uint8_t se = gcr4_decode(h[4],h[5]);
+ uint8_t chk = gcr4_decode(h[6],h[7]);
#ifdef VERBOSE_SAVE
- UINT32 post = (h[8]<<16)|(h[9]<<8)|h[10];
+ uint32_t post = (h[8]<<16)|(h[9]<<8)|h[10];
printf("Address Mark:\tVolume %d, Track %d, Sector %2d, Checksum %02X: %s, Postamble %03X: %s\n", vl, tr, se, chk, (chk ^ vl ^ tr ^ se)==0?"OK":"BAD", post, (post&0xFFFF00)==0xDEAA00?"OK":"BAD");
#endif
// sanity check
@@ -860,10 +860,10 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
}
if((hb == 4)&&(dosver == 0)) {
visualgrid[se][track] |= DATAFOUND;
- UINT8 *dest;
- UINT8 data[0x157];
- UINT32 dpost = 0;
- UINT8 c = 0;
+ uint8_t *dest;
+ uint8_t data[0x157];
+ uint32_t dpost = 0;
+ uint8_t c = 0;
if (m_prodos_order)
{
@@ -889,7 +889,7 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
dpost |= gb(buf, ts, pos, wrap);
}
// next combine in the upper 2 bits of each byte
- UINT8 bit_swap[4] = { 0, 2, 1, 3 };
+ uint8_t bit_swap[4] = { 0, 2, 1, 3 };
for(int i=0; i<0x56; i++)
data[i+0x056] = data[i+0x056]<<2 | bit_swap[data[i]&3];
for(int i=0; i<0x56; i++)
@@ -913,7 +913,7 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
(((data[0x156] != c) && (dpost&0xFFFF00)!=0xDEAA00) && (((visualgrid[se][track]&DATAGOOD)==0)&&(visualgrid[se][track]&DATAPOST)==0))
) {
for(int i=0x56; i<0x156; i++) {
- UINT8 dv = data[i];
+ uint8_t dv = data[i];
*dest++ = dv;
}
}
@@ -921,7 +921,7 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
#else
if ((visualgrid[se][track]&DATAGOOD)==0) {
for(int i=0x56; i<0x156; i++) {
- UINT8 dv = data[i];
+ uint8_t dv = data[i];
*dest++ = dv;
}
}
@@ -948,7 +948,7 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
}
for(int i=0; i<nsect; i++) {
//if(nsect>0) printf("t%d,", track);
- UINT8 *data = sectdata + (256)*i;
+ uint8_t *data = sectdata + (256)*i;
io_generic_write(io, data, pos_data, 256);
pos_data += 256;
}
@@ -1029,10 +1029,10 @@ bool a2_rwts18_format::supports_save() const
return true;
}
-int a2_rwts18_format::identify(io_generic *io, UINT32 form_factor)
+int a2_rwts18_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
- UINT32 expected_size = 35 * 16 * 256;
+ uint64_t size = io_generic_size(io);
+ uint32_t expected_size = 35 * 16 * 256;
return size == expected_size;
}
@@ -1067,10 +1067,10 @@ const floppy_image_format_t::desc_e a2_rwts18_format::mac_gcr[] = {
};
-bool a2_rwts18_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool a2_rwts18_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
/* TODO: rewrite me properly
- UINT8 sector_data[(256)*16];
+ uint8_t sector_data[(256)*16];
memset(sector_data, 0, sizeof(sector_data));
desc_s sectors[16];
@@ -1082,7 +1082,7 @@ bool a2_rwts18_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
for(int track=0; track < 35; track++) {
for(int head=0; head < head_count; head++) {
for(int si=0; si<16; si++) {
- UINT8 *data = sector_data + (256)*si;
+ uint8_t *data = sector_data + (256)*si;
sectors[si].data = data;
sectors[si].size = 256;
sectors[si].sector_id = si;
@@ -1097,9 +1097,9 @@ bool a2_rwts18_format::load(io_generic *io, UINT32 form_factor, floppy_image *im
return false; // I hope that throws an error...
}
-UINT8 a2_rwts18_format::gb(const UINT8 *buf, int ts, int &pos, int &wrap)
+uint8_t a2_rwts18_format::gb(const uint8_t *buf, int ts, int &pos, int &wrap)
{
- UINT8 v = 0;
+ uint8_t v = 0;
int w1 = wrap;
while(wrap != w1+2 && !(v & 0x80)) {
v = v << 1 | ((buf[pos >> 3] >> (7-(pos & 7))) & 1);
@@ -1112,7 +1112,7 @@ UINT8 a2_rwts18_format::gb(const UINT8 *buf, int ts, int &pos, int &wrap)
return v;
}
-void a2_rwts18_format::update_chk(const UINT8 *data, int size, UINT32 &chk)
+void a2_rwts18_format::update_chk(const uint8_t *data, int size, uint32_t &chk)
{
}
@@ -1152,10 +1152,10 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
int pos_data = 0;
// for track 0 ONLY:
- UINT8 sectdata[(768)*6];
+ uint8_t sectdata[(768)*6];
memset(sectdata, 0, sizeof(sectdata));
int nsect = 18;
- UINT8 buf[130000]; // originally 13000, multiread dfi disks need larger
+ uint8_t buf[130000]; // originally 13000, multiread dfi disks need larger
int ts;
//fprintf(stderr,"DEBUG: a2_rwts18_format::save() about to generate bitstream from physical track %d (logical %d)...", track, track/2);
//~332 samples per cell, times 3+8+3 (14) for address mark, 24 for sync, 3+343+3 (349) for data mark, 24 for sync is around 743, near 776 expected
@@ -1166,7 +1166,7 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
int hb = 0;
int dosver = 0; // apple dos version; 0 = >=3.3, 1 = <3.3
for(;;) {
- UINT8 v = gb(buf, ts, pos, wrap);
+ uint8_t v = gb(buf, ts, pos, wrap);
if(v == 0xff)
hb = 1;
else if(hb == 1 && v == 0xd5)
@@ -1181,15 +1181,15 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
hb = 0;
if(hb == 4) {
- UINT8 h[11];
+ uint8_t h[11];
for(auto & elem : h)
elem = gb(buf, ts, pos, wrap);
- //UINT8 v2 = gcr6bw_tb[h[2]];
- UINT8 vl = gcr4_decode(h[0],h[1]);
- UINT8 tr = gcr4_decode(h[2],h[3]);
- UINT8 se = gcr4_decode(h[4],h[5]);
- UINT8 chk = gcr4_decode(h[6],h[7]);
- UINT32 post = (h[8]<<16)|(h[9]<<8)|h[10];
+ //uint8_t v2 = gcr6bw_tb[h[2]];
+ uint8_t vl = gcr4_decode(h[0],h[1]);
+ uint8_t tr = gcr4_decode(h[2],h[3]);
+ uint8_t se = gcr4_decode(h[4],h[5]);
+ uint8_t chk = gcr4_decode(h[6],h[7]);
+ uint32_t post = (h[8]<<16)|(h[9]<<8)|h[10];
printf("Address Mark:\tVolume %d, Track %d, Sector %2d, Checksum %02X: %s, Postamble %03X: %s\n", vl, tr, se, chk, (chk ^ vl ^ tr ^ se)==0?"OK":"BAD", post, (post&0xFFFF00)==0xDEAA00?"OK":"BAD");
// sanity check
if (tr == 0 && se < nsect) {
@@ -1233,10 +1233,10 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F
#endif
};
- UINT8 *dest = sectdata+(256)*sector_translate[se];
- UINT8 data[0x157];
- UINT32 dpost = 0;
- UINT8 c = 0;
+ uint8_t *dest = sectdata+(256)*sector_translate[se];
+ uint8_t data[0x157];
+ uint32_t dpost = 0;
+ uint8_t c = 0;
// first read in sector and decode to 6bit form
for(int i=0; i<0x156; i++) {
data[i] = gcr6bw_tb[gb(buf, ts, pos, wrap)] ^ c;
@@ -1252,7 +1252,7 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
dpost |= gb(buf, ts, pos, wrap);
}
// next combine in the upper 2 bits of each byte
- UINT8 bit_swap[4] = { 0, 2, 1, 3 };
+ uint8_t bit_swap[4] = { 0, 2, 1, 3 };
for(int i=0; i<0x56; i++)
data[i+0x056] = data[i+0x056]<<2 | bit_swap[data[i]&3];
for(int i=0; i<0x56; i++)
@@ -1276,7 +1276,7 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
(((data[0x156] != c) && (dpost&0xFFFF00)!=0xDEAA00) && (((visualgrid[se][0]&DATAGOOD)==0)&&(visualgrid[se][0]&DATAPOST)==0))
) {
for(int i=0x56; i<0x156; i++) {
- UINT8 dv = data[i];
+ uint8_t dv = data[i];
*dest++ = dv;
}
}
@@ -1284,7 +1284,7 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
#else
if ((visualgrid[se][0]&DATAGOOD)==0) {
for(int i=0x56; i<0x156; i++) {
- UINT8 dv = data[i];
+ uint8_t dv = data[i];
*dest++ = dv;
}
}
@@ -1309,17 +1309,17 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
}
for(int i=0; i<nsect; i++) {
//if(nsect>0) printf("t%d,", track);
- UINT8 *data = sectdata + (256)*i;
+ uint8_t *data = sectdata + (256)*i;
io_generic_write(io, data, pos_data, 256);
pos_data += 256;
}
// for the rest of the tracks
for(int track=2; track < 70; track+=2) {
- UINT8 sectdata[(768)*6];
+ uint8_t sectdata[(768)*6];
memset(sectdata, 0, sizeof(sectdata));
int nsect = 18;
- UINT8 buf[130000]; // originally 13000, multiread dfi disks need larger
+ uint8_t buf[130000]; // originally 13000, multiread dfi disks need larger
int ts;
//fprintf(stderr,"DEBUG: a2_rwts18_format::save() about to generate bitstream from physical track %d (logical %d)...", track, track/2);
//~332 samples per cell, times 3+8+3 (14) for address mark, 24 for sync, 3+343+3 (349) for data mark, 24 for sync is around 743, near 776 expected
@@ -1330,7 +1330,7 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
int wrap = 0;
int hb = 0;
for(;;) {
- UINT8 v = gb(buf, ts, pos, wrap);
+ uint8_t v = gb(buf, ts, pos, wrap);
if((v == 0xff) || (v == 0x9a)) // note 0x9a varies per title! this is an LFSR? generated value intended to throw off copiers, and only appears after the track splice (before sector 5)
hb = 1;
else if(hb == 1 && v == 0xd5)
@@ -1343,15 +1343,15 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
if(hb == 3) {
printf("AM at offset: %d, relative: %d\n", pos, pos-oldpos);
oldpos=pos;
- UINT8 h[7];
+ uint8_t h[7];
// grab exactly 7 bytes: should be Track, Sector, Checksum, AA, FF and FF and the Br0derbund Title ID
for(auto & elem : h)
elem = gb(buf, ts, pos, wrap);
- UINT8 tr = gcr6bw_tb[h[0]];
- UINT8 se = gcr6bw_tb[h[1]];
- UINT8 chk = gcr6bw_tb[h[2]];
- UINT32 post = (h[3]<<16)|(h[4]<<8)|h[5];
- UINT8 bbundid = h[6];
+ uint8_t tr = gcr6bw_tb[h[0]];
+ uint8_t se = gcr6bw_tb[h[1]];
+ uint8_t chk = gcr6bw_tb[h[2]];
+ uint32_t post = (h[3]<<16)|(h[4]<<8)|h[5];
+ uint8_t bbundid = h[6];
printf("RWTS18 AM:\t Track %d, Sector %2d, Checksum %02X: %s, Postamble %03X: %s, BBUNDID %02x\n", tr, se, chk, (chk ^ tr ^ se)==0?"OK":"BAD", post, post==0xAAFFFF?"OK":"BAD", bbundid);
// sanity check
if (tr == track/2 && se < nsect) {
@@ -1366,10 +1366,10 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
//int owrap = wrap;
// RWTS18 doesn't have a true data mark, its part of the address header
visualgrid[se][track/2] |= DATAFOUND;
- UINT8 *dest = sectdata+(256)*se;
- UINT8 data[0x401];
- UINT32 dpost = 0;
- UINT8 c = 0;
+ uint8_t *dest = sectdata+(256)*se;
+ uint8_t data[0x401];
+ uint32_t dpost = 0;
+ uint8_t c = 0;
//dest = sectdata+(768)*se;
// now read in the sector and decode to 6bit form
for(int i=0; i<0x400; i++) {
@@ -1429,21 +1429,21 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
data[(4*i)+1] |= (data[4*i]&0x30)<<2;
//printf("%c", (data[4*i]&0x3F)+0x40);
//if (((i&0xf)+1)==0x10) printf("\n");
- UINT8 dv = data[(4*i)+1];
+ uint8_t dv = data[(4*i)+1];
*dest++ = dv;
}
// second sector:
dest = sectdata+(256)*(se+6);
for(int i=0; i<0x100; i++) {
data[(4*i)+2] |= (data[4*i]&0x0c)<<4;
- UINT8 dv = data[(4*i)+2];
+ uint8_t dv = data[(4*i)+2];
*dest++ = dv;
}
// third sector:
dest = sectdata+(256)*(se+12);
for(int i=0; i<0x100; i++) {
data[(4*i)+3] |= (data[4*i]&0x03)<<6;
- UINT8 dv = data[(4*i)+3];
+ uint8_t dv = data[(4*i)+3];
*dest++ = dv;
}
}
@@ -1459,21 +1459,21 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
data[(4*i)+1] |= (data[4*i]&0x30)<<2;
//printf("%c", (data[4*i]&0x3F)+0x40);
//if (((i&0xf)+1)==0x10) printf("\n");
- UINT8 dv = data[(4*i)+1];
+ uint8_t dv = data[(4*i)+1];
*dest++ = dv;
}
// second sector:
dest = sectdata+(256)*(se+6);
for(int i=0; i<0x100; i++) {
data[(4*i)+2] |= (data[4*i]&0x0c)<<4;
- UINT8 dv = data[(4*i)+2];
+ uint8_t dv = data[(4*i)+2];
*dest++ = dv;
}
// third sector:
dest = sectdata+(256)*(se+12);
for(int i=0; i<0x100; i++) {
data[(4*i)+3] |= (data[4*i]&0x03)<<6;
- UINT8 dv = data[(4*i)+3];
+ uint8_t dv = data[(4*i)+3];
*dest++ = dv;
}
}
@@ -1492,7 +1492,7 @@ bool a2_rwts18_format::save(io_generic *io, floppy_image *image)
}
for(int i=0; i<nsect; i++) {
//if(nsect>0) printf("t%d,", track);
- UINT8 *data = sectdata + (256)*i;
+ uint8_t *data = sectdata + (256)*i;
io_generic_write(io, data, pos_data, 256);
pos_data += 256;
}
@@ -1545,23 +1545,23 @@ bool a2_edd_format::supports_save() const
return true;
}
-int a2_edd_format::identify(io_generic *io, UINT32 form_factor)
+int a2_edd_format::identify(io_generic *io, uint32_t form_factor)
{
return ((io_generic_size(io) == 2244608) || (io_generic_size(io) == 2310144)) ? 50 : 0;
}
-UINT8 a2_edd_format::pick(const UINT8 *data, int pos)
+uint8_t a2_edd_format::pick(const uint8_t *data, int pos)
{
return ((data[pos>>3] << 8) | data[(pos>>3)+1]) >> (8-(pos & 7));
}
-bool a2_edd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool a2_edd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 *img;
- UINT8 nibble[16384], stream[16384];
+ uint8_t *img;
+ uint8_t nibble[16384], stream[16384];
int npos[16384];
- img = (UINT8 *) malloc(2244608);
+ img = (uint8_t *) malloc(2244608);
if (!img)
{
@@ -1571,11 +1571,11 @@ bool a2_edd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image
io_generic_read(io, img, 0, 2244608);
for(int i=0; i<137; i++) {
- const UINT8 *trk = img + 16384*i;
+ const uint8_t *trk = img + 16384*i;
int pos = 0;
int wpos = 0;
while(pos < 16383*8) {
- UINT8 acc = pick(trk, pos);
+ uint8_t acc = pick(trk, pos);
pos += 8;
while(!(acc & 0x80) && pos < 16384*8) {
acc <<= 1;
@@ -1633,7 +1633,7 @@ bool a2_edd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image
stream[splice >> 3] ^= 0x80 >> (splice & 7);
generate_track_from_bitstream(i >> 2, 0, stream, len, image, i & 3);
- image->set_write_splice_position(i >> 2, 0, UINT32(U64(200000000)*splice/len), i & 3);
+ image->set_write_splice_position(i >> 2, 0, uint32_t(U64(200000000)*splice/len), i & 3);
}
free(img);
return true;
diff --git a/src/lib/formats/ap2_dsk.h b/src/lib/formats/ap2_dsk.h
index 19e55e05ff0..3d140ac86e9 100644
--- a/src/lib/formats/ap2_dsk.h
+++ b/src/lib/formats/ap2_dsk.h
@@ -39,8 +39,8 @@ class a2_16sect_format : public floppy_image_format_t
public:
a2_16sect_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
@@ -51,8 +51,8 @@ public:
private:
static const desc_e mac_gcr[];
- UINT8 gb(const UINT8 *buf, int ts, int &pos, int &wrap);
- void update_chk(const UINT8 *data, int size, UINT32 &chk);
+ uint8_t gb(const uint8_t *buf, int ts, int &pos, int &wrap);
+ void update_chk(const uint8_t *data, int size, uint32_t &chk);
bool m_prodos_order;
};
@@ -64,8 +64,8 @@ class a2_rwts18_format : public floppy_image_format_t
public:
a2_rwts18_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
@@ -76,8 +76,8 @@ public:
private:
static const desc_e mac_gcr[];
- UINT8 gb(const UINT8 *buf, int ts, int &pos, int &wrap);
- void update_chk(const UINT8 *data, int size, UINT32 &chk);
+ uint8_t gb(const uint8_t *buf, int ts, int &pos, int &wrap);
+ void update_chk(const uint8_t *data, int size, uint32_t &chk);
};
extern const floppy_format_type FLOPPY_RWTS18_FORMAT;
@@ -88,8 +88,8 @@ class a2_edd_format : public floppy_image_format_t
public:
a2_edd_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 supports_save() const override;
virtual const char *name() const override;
@@ -97,7 +97,7 @@ public:
virtual const char *extensions() const override;
private:
- static UINT8 pick(const UINT8 *data, int pos);
+ static uint8_t pick(const uint8_t *data, int pos);
};
extern const floppy_format_type FLOPPY_EDD_FORMAT;
diff --git a/src/lib/formats/ap_dsk35.cpp b/src/lib/formats/ap_dsk35.cpp
index baa60254b4b..38a36a956ec 100644
--- a/src/lib/formats/ap_dsk35.cpp
+++ b/src/lib/formats/ap_dsk35.cpp
@@ -106,21 +106,21 @@
struct apple35_tag
{
- UINT32 data_offset;
- UINT32 data_size;
- UINT8 format_byte;
- UINT8 sides;
+ uint32_t data_offset;
+ uint32_t data_size;
+ uint8_t format_byte;
+ uint8_t sides;
unsigned int is_1440k : 1;
/* stuff used in DiskCopy images */
- UINT32 tag_offset;
- UINT32 tag_size;
+ uint32_t tag_offset;
+ uint32_t tag_size;
};
/* normal number of sector for each track */
-static const UINT8 apple35_tracklen_800kb[80] =
+static const uint8_t apple35_tracklen_800kb[80] =
{
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
@@ -130,7 +130,7 @@ static const UINT8 apple35_tracklen_800kb[80] =
};
/* blocks of data used to nibblize tracks */
-static const UINT8 diskbytes[] =
+static const uint8_t diskbytes[] =
{
0x96, 0x97, 0x9A, 0x9B, 0x9D, 0x9E, 0x9F, 0xA6, /* 0x00 */
0xA7, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB2, 0xB3,
@@ -143,7 +143,7 @@ static const UINT8 diskbytes[] =
};
/* reverse lookup of diskbytes */
-static const INT16 rev_diskbytes[] =
+static const int16_t rev_diskbytes[] =
{
-1, -1, -1, -1, -1, -1, -1, -1, /* 0x00 */
-1, -1, -1, -1, -1, -1, -1, -1,
@@ -179,7 +179,7 @@ static const INT16 rev_diskbytes[] =
-1, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F
};
-static const UINT8 blk1[] =
+static const uint8_t blk1[] =
{
/*0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
@@ -200,11 +200,11 @@ static const UINT8 blk1[] =
0xFF, 0x3F, 0xCF, 0xF3, 0xFC, 0xFF,
0xD5, 0xAA, 0x96
};
-static const UINT8 blk2[] =
+static const uint8_t blk2[] =
{
0xDE, 0xAA, 0xFF, 0xFF, 0x3F, 0xCF, 0xF3, 0xFC, 0xFF, 0xD5, 0xAA, 0xAD
};
-static const UINT8 blk3[] =
+static const uint8_t blk3[] =
{
0xDE, 0xAA, 0xFF
};
@@ -243,13 +243,13 @@ int apple35_sectors_per_track(floppy_image_legacy *image, int track)
tag data IS important, since it allows data recovery when the catalog is trashed
*/
-static void sony_nibblize35(const UINT8 *in, UINT8 *nib_ptr, UINT8 *csum)
+static void sony_nibblize35(const uint8_t *in, uint8_t *nib_ptr, uint8_t *csum)
{
int i, j;
- UINT32 c1, c2, c3, c4;
- UINT8 val;
- UINT8 w1, w2, w3, w4;
- UINT8 b1[175], b2[175], b3[175];
+ uint32_t c1, c2, c3, c4;
+ uint8_t val;
+ uint8_t w1, w2, w3, w4;
+ uint8_t b1[175], b2[175], b3[175];
/* Copy from the user's buffer to our buffer, while computing
* the three-byte data checksum
@@ -327,13 +327,13 @@ static void sony_nibblize35(const UINT8 *in, UINT8 *nib_ptr, UINT8 *csum)
/*
does the reverse process of sony_nibblize35
*/
-static void sony_denibblize35(UINT8 *out, const UINT8 *nib_ptr, UINT8 *checksum)
+static void sony_denibblize35(uint8_t *out, const uint8_t *nib_ptr, uint8_t *checksum)
{
int i, j;
- UINT32 c1,c2,c3,c4;
- UINT8 val;
- UINT8 w1,w2,w3=0,w4;
- UINT8 b1[175],b2[175],b3[175];
+ uint32_t c1,c2,c3,c4;
+ uint8_t val;
+ uint8_t w1,w2,w3=0,w4;
+ uint8_t b1[175],b2[175],b3[175];
j = 0;
for (i=0; i<=174; i++)
@@ -405,7 +405,7 @@ static void sony_denibblize35(UINT8 *out, const UINT8 *nib_ptr, UINT8 *checksum)
-void sony_filltrack(UINT8 *buffer, size_t buffer_len, size_t *pos, UINT8 data)
+void sony_filltrack(uint8_t *buffer, size_t buffer_len, size_t *pos, uint8_t data)
{
buffer[*pos / 8] &= 0xFF << (8 - (*pos % 8));
buffer[*pos / 8] |= data >> (*pos % 8);
@@ -419,9 +419,9 @@ void sony_filltrack(UINT8 *buffer, size_t buffer_len, size_t *pos, UINT8 data)
-UINT8 sony_fetchtrack(const UINT8 *buffer, size_t buffer_len, size_t *pos)
+uint8_t sony_fetchtrack(const uint8_t *buffer, size_t buffer_len, size_t *pos)
{
- UINT8 data;
+ uint8_t data;
data = buffer[*pos / 8] << (*pos % 8);
*pos += 8;
@@ -446,10 +446,10 @@ UINT8 sony_fetchtrack(const UINT8 *buffer, size_t buffer_len, size_t *pos)
-static UINT32 apple35_get_offset(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *tag_offset)
+static uint32_t apple35_get_offset(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *tag_offset)
{
int i;
- UINT32 sector_index = 0;
+ uint32_t sector_index = 0;
struct apple35_tag *tag;
tag = get_apple35_tag(floppy);
@@ -487,7 +487,7 @@ static UINT32 apple35_get_offset(floppy_image_legacy *floppy, int head, int trac
static floperr_t apple35_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
{
- UINT32 data_offset;
+ uint32_t data_offset;
data_offset = apple35_get_offset(floppy, head, track, sector, nullptr);
if (data_offset == ~0)
{
@@ -501,7 +501,7 @@ static floperr_t apple35_read_sector(floppy_image_legacy *floppy, int head, int
static floperr_t apple35_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
{
- UINT32 data_offset;
+ uint32_t data_offset;
data_offset = apple35_get_offset(floppy, head, track, sector, nullptr);
if (data_offset == ~0)
@@ -515,12 +515,12 @@ static floperr_t apple35_write_sector(floppy_image_legacy *floppy, int head, int
static floperr_t apple35_read_sector_td(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
{
floperr_t err;
- UINT32 tag_offset = 0;
+ uint32_t tag_offset = 0;
assert(buflen == 524);
/* first read the sector */
- err = apple35_read_sector(floppy, head, track, sector, ((UINT8 *) buffer) + 12, 512);
+ err = apple35_read_sector(floppy, head, track, sector, ((uint8_t *) buffer) + 12, 512);
if (err)
{
return err;
@@ -542,12 +542,12 @@ static floperr_t apple35_read_sector_td(floppy_image_legacy *floppy, int head, i
static floperr_t apple35_write_sector_td(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
{
floperr_t err;
- UINT32 tag_offset = 0;
+ uint32_t tag_offset = 0;
assert(buflen == 524);
/* first write the sector */
- err = apple35_write_sector(floppy, head, track, sector, ((const UINT8 *) buffer) + 12, 512, 0);
+ err = apple35_write_sector(floppy, head, track, sector, ((const uint8_t *) buffer) + 12, 512, 0);
if (err)
return err;
@@ -561,7 +561,7 @@ static floperr_t apple35_write_sector_td(floppy_image_legacy *floppy, int head,
-static floperr_t apple35_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t apple35_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
*sector_length = 512;
return FLOPPY_ERROR_SUCCESS;
@@ -583,7 +583,7 @@ static int apple35_get_tracks_per_disk(floppy_image_legacy *floppy)
-static UINT32 apple35_get_track_size(floppy_image_legacy *floppy, int head, int track)
+static uint32_t apple35_get_track_size(floppy_image_legacy *floppy, int head, int track)
{
if ((track < 0) || (track >= 80))
return 0;
@@ -592,9 +592,9 @@ static UINT32 apple35_get_track_size(floppy_image_legacy *floppy, int head, int
-static UINT8 calculate_side(int head, int track)
+static uint8_t calculate_side(int head, int track)
{
- UINT8 side;
+ uint8_t side;
side = head ? 0x20 : 0x00;
if (track & 0x40)
side |= 0x01;
@@ -603,16 +603,16 @@ static UINT8 calculate_side(int head, int track)
-static floperr_t apple35_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen)
+static floperr_t apple35_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen)
{
floperr_t err;
size_t pos = 0;
int sector_count, sector, i;
- UINT8 sum, side;
+ uint8_t sum, side;
struct apple35_tag *tag;
- UINT8 sector_data[524];
- UINT8 nibble_data[699];
- UINT8 checksum[4];
+ uint8_t sector_data[524];
+ uint8_t nibble_data[699];
+ uint8_t checksum[4];
tag = get_apple35_tag(floppy);
@@ -637,29 +637,29 @@ static floperr_t apple35_read_track(floppy_image_legacy *floppy, int head, int t
sony_nibblize35(sector_data, nibble_data, checksum);
for (i = 0; i < ARRAY_LENGTH(blk1); i++)
- sony_filltrack((UINT8*)buffer, buflen, &pos, blk1[i]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, blk1[i]);
sum = (track ^ sector ^ side ^ tag->format_byte) & 0x3F;
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[track & 0x3f]);
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[sector]);
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[side]);
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[tag->format_byte]);
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[sum]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[track & 0x3f]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[sector]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[side]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[tag->format_byte]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[sum]);
for (i = 0; i < ARRAY_LENGTH(blk2); i++)
- sony_filltrack((UINT8*)buffer, buflen, &pos, blk2[i]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, blk2[i]);
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[sector]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[sector]);
for (i = 0; i < ARRAY_LENGTH(nibble_data); i++)
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[nibble_data[i]]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[nibble_data[i]]);
for (i = 3; i >= 0; i--)
- sony_filltrack((UINT8*)buffer, buflen, &pos, diskbytes[checksum[i]]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, diskbytes[checksum[i]]);
for (i = 0; i < ARRAY_LENGTH(blk3); i++)
- sony_filltrack((UINT8*)buffer, buflen, &pos, blk3[i]);
+ sony_filltrack((uint8_t*)buffer, buflen, &pos, blk3[i]);
}
return FLOPPY_ERROR_SUCCESS;
@@ -667,17 +667,17 @@ static floperr_t apple35_read_track(floppy_image_legacy *floppy, int head, int t
-static floperr_t apple35_write_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen)
+static floperr_t apple35_write_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buflen)
{
floperr_t err;
size_t pos = 0;
int sector_count, sector, i, j;
struct apple35_tag *tag;
- UINT8 sum, format_byte, val, side;
- UINT32 found_sectors = 0;
- UINT8 sector_data[524];
- UINT8 nibble_data[699];
- UINT8 checksum[4];
+ uint8_t sum, format_byte, val, side;
+ uint32_t found_sectors = 0;
+ uint8_t sector_data[524];
+ uint8_t nibble_data[699];
+ uint8_t checksum[4];
tag = get_apple35_tag(floppy);
@@ -692,32 +692,32 @@ static floperr_t apple35_write_track(floppy_image_legacy *floppy, int head, int
/* do 2 rotations, in case the bit slip stuff prevent us to read the first sector */
for (j = 0; j < (buflen * 2); j++)
{
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0xD5)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0xD5)
continue;
j++;
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0xAA)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0xAA)
continue;
j++;
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0x96)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0x96)
continue;
j++;
- if (rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)] != (track & 0x3F))
+ if (rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)] != (track & 0x3F))
continue;
j++;
- sector = rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)];
+ sector = rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)];
if ((sector < 0) || (sector >= sector_count))
continue;
j++;
- if (rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)] != side)
+ if (rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)] != side)
continue;
j++;
- format_byte = rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)];
+ format_byte = rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)];
if (format_byte != tag->format_byte)
{
/* this is an error, but not THAT critical, I guess */
@@ -725,52 +725,52 @@ static floperr_t apple35_write_track(floppy_image_legacy *floppy, int head, int
j++;
sum = track ^ sector ^ side ^ format_byte;
- if (rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)] != sum)
+ if (rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)] != sum)
continue;
j++;
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0xDE)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0xDE)
continue;
j++;
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0xAA)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0xAA)
continue;
j++;
- while((val = sony_fetchtrack((UINT8*)buffer, buflen, &pos)) == 0xFF)
+ while((val = sony_fetchtrack((uint8_t*)buffer, buflen, &pos)) == 0xFF)
j++;
if (val != 0xD5)
continue; /* lost bit slip mark! */
j++;
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0xAA)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0xAA)
continue;
j++;
- if (sony_fetchtrack((UINT8*)buffer, buflen, &pos) != 0xAD)
+ if (sony_fetchtrack((uint8_t*)buffer, buflen, &pos) != 0xAD)
continue;
j++;
/* should this be regarded as a critical error ??? */
- if (rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)] != sector)
+ if (rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)] != sector)
continue;
j++;
for (i = 0; i < ARRAY_LENGTH(nibble_data); i++)
{
- nibble_data[i] = rev_diskbytes[sony_fetchtrack((UINT8*)buffer, buflen, &pos)];
+ nibble_data[i] = rev_diskbytes[sony_fetchtrack((uint8_t*)buffer, buflen, &pos)];
j++;
}
for (i = 3; i >= 0; i--)
{
/* should be checking checksum */
- sony_fetchtrack((UINT8*)buffer, buflen, &pos);
+ sony_fetchtrack((uint8_t*)buffer, buflen, &pos);
}
- sony_fetchtrack((UINT8*)buffer, buflen, &pos); /* should get 0xDE */
- sony_fetchtrack((UINT8*)buffer, buflen, &pos); /* should get 0xAA */
- sony_fetchtrack((UINT8*)buffer, buflen, &pos); /* should get 0xFF */
+ sony_fetchtrack((uint8_t*)buffer, buflen, &pos); /* should get 0xDE */
+ sony_fetchtrack((uint8_t*)buffer, buflen, &pos); /* should get 0xAA */
+ sony_fetchtrack((uint8_t*)buffer, buflen, &pos); /* should get 0xFF */
/* did we already write this sector? */
if ((found_sectors & (1 << sector)) == 0)
@@ -790,8 +790,8 @@ static floperr_t apple35_write_track(floppy_image_legacy *floppy, int head, int
-static floperr_t apple35_construct(floppy_image_legacy *floppy, UINT32 data_offset, UINT32 data_size,
- UINT32 tag_offset, UINT32 tag_size, INT16 format_byte, UINT8 sides, int is_1440k)
+static floperr_t apple35_construct(floppy_image_legacy *floppy, uint32_t data_offset, uint32_t data_size,
+ uint32_t tag_offset, uint32_t tag_size, int16_t format_byte, uint8_t sides, int is_1440k)
{
struct apple35_tag *tag;
struct FloppyCallbacks *format;
@@ -820,7 +820,7 @@ static floperr_t apple35_construct(floppy_image_legacy *floppy, UINT32 data_offs
tag->data_size = data_size;
tag->tag_offset = tag_offset;
tag->tag_size = tag_size;
- tag->format_byte = (UINT8) format_byte;
+ tag->format_byte = (uint8_t) format_byte;
tag->sides = sides;
tag->is_1440k = is_1440k ? 1 : 0;
@@ -843,7 +843,7 @@ static floperr_t apple35_construct(floppy_image_legacy *floppy, UINT32 data_offs
static FLOPPY_IDENTIFY(apple35_raw_identify)
{
- UINT64 size;
+ uint64_t size;
size = floppy_image_size(floppy);
*vote = ((size == 80*1*10*512) || (size == 80*2*10*512) || (size == (80*2*18*512)+84)
|| (size == 80*2*18*512)) ? 100 : 0;
@@ -855,8 +855,8 @@ static FLOPPY_IDENTIFY(apple35_raw_identify)
static FLOPPY_CONSTRUCT(apple35_raw_construct)
{
- UINT64 size;
- UINT8 sides;
+ uint64_t size;
+ uint8_t sides;
int is_1440k;
if (params)
@@ -884,7 +884,7 @@ static FLOPPY_CONSTRUCT(apple35_raw_construct)
return FLOPPY_ERROR_INVALIDIMAGE;
}
- return apple35_construct(floppy, 0, (UINT32) size, 0, 0, -1, sides, is_1440k);
+ return apple35_construct(floppy, 0, (uint32_t) size, 0, 0, -1, sides, is_1440k);
}
@@ -893,25 +893,25 @@ static FLOPPY_CONSTRUCT(apple35_raw_construct)
struct header_diskcopy
{
- UINT8 disk_name[64]; /* name of the disk */
- UINT32 data_size; /* total size of data for all sectors (512*number_of_sectors) */
- UINT32 tag_size; /* total size of tag data for all sectors (12*number_of_sectors for GCR 3.5" floppies, 20*number_of_sectors for HD20, 0 otherwise) */
- UINT32 data_checksum; /* CRC32 checksum of all sector data */
- UINT32 tag_checksum; /* CRC32 checksum of all tag data */
- UINT8 disk_format; /* 0 = 400K, 1 = 800K, 2 = 720K, 3 = 1440K (other values reserved) */
- UINT8 format_byte; /* should be $00 Apple II, $01 Lisa, $02 Mac MFS ??? */
+ uint8_t disk_name[64]; /* name of the disk */
+ uint32_t data_size; /* total size of data for all sectors (512*number_of_sectors) */
+ uint32_t tag_size; /* total size of tag data for all sectors (12*number_of_sectors for GCR 3.5" floppies, 20*number_of_sectors for HD20, 0 otherwise) */
+ uint32_t data_checksum; /* CRC32 checksum of all sector data */
+ uint32_t tag_checksum; /* CRC32 checksum of all tag data */
+ uint8_t disk_format; /* 0 = 400K, 1 = 800K, 2 = 720K, 3 = 1440K (other values reserved) */
+ uint8_t format_byte; /* should be $00 Apple II, $01 Lisa, $02 Mac MFS ??? */
/* $12 = 400K, $22 = >400K Macintosh (DiskCopy uses this value for
all Apple II disks not 800K in size, and even for some of those),
$24 = 800K Apple II disk */
- UINT16 magic; /* always $0100 (otherwise, the file may be in a different format. */
+ uint16_t magic; /* always $0100 (otherwise, the file may be in a different format. */
};
-static floperr_t apple35_diskcopy_headerdecode(floppy_image_legacy *floppy, UINT32 *data_offset,
- UINT32 *data_size, UINT32 *tag_offset, UINT32 *tag_size, UINT8 *format_byte, UINT8 *sides)
+static floperr_t apple35_diskcopy_headerdecode(floppy_image_legacy *floppy, uint32_t *data_offset,
+ uint32_t *data_size, uint32_t *tag_offset, uint32_t *tag_size, uint8_t *format_byte, uint8_t *sides)
{
- UINT64 size;
+ uint64_t size;
struct header_diskcopy header;
if (data_offset)
@@ -986,10 +986,10 @@ static FLOPPY_IDENTIFY(apple35_diskcopy_identify)
static FLOPPY_CONSTRUCT(apple35_diskcopy_construct)
{
floperr_t err;
- UINT8 format_byte, sides;
- UINT32 data_offset, data_size;
- UINT32 tag_offset, tag_size;
- INT16 format_byte_param = -1;
+ uint8_t format_byte, sides;
+ uint32_t data_offset, data_size;
+ uint32_t tag_offset, tag_size;
+ int16_t format_byte_param = -1;
struct header_diskcopy header;
if (params)
@@ -1030,18 +1030,18 @@ struct header_2img
{
char magic[4]; /* '2IMG' */
char creator[4]; /* signature; 'MESS' for MESS */
- UINT16 header_length;
- UINT16 version;
- UINT32 image_format;
- UINT32 flags;
- UINT32 block_count;
- UINT32 data_offset;
- UINT32 data_length;
- UINT32 comment_offset;
- UINT32 comment_length;
- UINT32 creator_offset;
- UINT32 creator_length;
- UINT32 padding[4];
+ uint16_t header_length;
+ uint16_t version;
+ uint32_t image_format;
+ uint32_t flags;
+ uint32_t block_count;
+ uint32_t data_offset;
+ uint32_t data_length;
+ uint32_t comment_offset;
+ uint32_t comment_length;
+ uint32_t creator_offset;
+ uint32_t creator_length;
+ uint32_t padding[4];
};
#define IMAGE_FORMAT_DO 0
@@ -1051,11 +1051,11 @@ struct header_2img
-static floperr_t apple35_2img_decode(floppy_image_legacy *floppy, UINT32 *image_format,
- UINT32 *data_offset, UINT32 *data_length)
+static floperr_t apple35_2img_decode(floppy_image_legacy *floppy, uint32_t *image_format,
+ uint32_t *data_offset, uint32_t *data_length)
{
struct header_2img header;
- UINT64 size;
+ uint64_t size;
if (image_format)
*image_format = 0;
@@ -1097,11 +1097,11 @@ static floperr_t apple35_2img_decode(floppy_image_legacy *floppy, UINT32 *image_
header.data_length = 0x0c8000;
}
- if ((((UINT64) header.data_offset) + header.data_length) > size)
+ if ((((uint64_t) header.data_offset) + header.data_length) > size)
return FLOPPY_ERROR_INVALIDIMAGE;
- if ((((UINT64) header.comment_offset) + header.comment_length) > size)
+ if ((((uint64_t) header.comment_offset) + header.comment_length) > size)
return FLOPPY_ERROR_INVALIDIMAGE;
- if ((((UINT64) header.creator_offset) + header.creator_length) > size)
+ if ((((uint64_t) header.creator_offset) + header.creator_length) > size)
return FLOPPY_ERROR_INVALIDIMAGE;
if ((header.image_format != IMAGE_FORMAT_DO) &&
(header.image_format != IMAGE_FORMAT_PO) &&
@@ -1130,10 +1130,10 @@ static FLOPPY_IDENTIFY(apple35_2img_identify)
static FLOPPY_CONSTRUCT(apple35_2img_construct)
{
floperr_t err;
- UINT32 image_format;
- UINT32 data_offset;
- UINT32 data_size;
- UINT8 sides = 2;
+ uint32_t image_format;
+ uint32_t data_offset;
+ uint32_t data_size;
+ uint8_t sides = 2;
struct header_2img header;
if (params)
@@ -1232,16 +1232,16 @@ bool dc42_format::supports_save() const
return true;
}
-int dc42_format::identify(io_generic *io, UINT32 form_factor)
+int dc42_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[0x54];
- UINT64 size = io_generic_size(io);
+ uint8_t h[0x54];
+ uint64_t size = io_generic_size(io);
if(size < 0x54)
return 0;
io_generic_read(io, h, 0, 0x54);
- UINT32 dsize = (h[0x40] << 24) | (h[0x41] << 16) | (h[0x42] << 8) | h[0x43];
- UINT32 tsize = (h[0x44] << 24) | (h[0x45] << 16) | (h[0x46] << 8) | h[0x47];
+ uint32_t dsize = (h[0x40] << 24) | (h[0x41] << 16) | (h[0x42] << 8) | h[0x43];
+ uint32_t tsize = (h[0x44] << 24) | (h[0x45] << 16) | (h[0x46] << 8) | h[0x47];
return size == 0x54+tsize+dsize && h[0] < 64 && h[0x52] == 1 && h[0x53] == 0 ? 100 : 0;
}
@@ -1276,22 +1276,22 @@ const floppy_image_format_t::desc_e dc42_format::mac_gcr[] = {
};
-bool dc42_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dc42_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 h[0x54];
+ uint8_t h[0x54];
io_generic_read(io, h, 0, 0x54);
int dsize = (h[0x40] << 24) | (h[0x41] << 16) | (h[0x42] << 8) | h[0x43];
int tsize = (h[0x44] << 24) | (h[0x45] << 16) | (h[0x46] << 8) | h[0x47];
- UINT8 encoding = h[0x50];
- UINT8 format = h[0x51];
+ uint8_t encoding = h[0x50];
+ uint8_t format = h[0x51];
if((encoding != 0x00 || format != 0x02) && (encoding != 0x01 || format != 0x22)) {
osd_printf_error("dc42: Unsupported encoding/format combination %02x/%02x\n", encoding, format);
return false;
}
- UINT8 sector_data[(512+12)*12];
+ uint8_t sector_data[(512+12)*12];
memset(sector_data, 0, sizeof(sector_data));
desc_s sectors[12];
@@ -1306,7 +1306,7 @@ bool dc42_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int ns = 12 - (track/16);
int si = 0;
for(int i=0; i<ns; i++) {
- UINT8 *data = sector_data + (512+12)*i;
+ uint8_t *data = sector_data + (512+12)*i;
sectors[si].data = data;
sectors[si].size = 512+12;
sectors[si].sector_id = i;
@@ -1327,9 +1327,9 @@ bool dc42_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
return true;
}
-UINT8 dc42_format::gb(const UINT8 *buf, int ts, int &pos, int &wrap)
+uint8_t dc42_format::gb(const uint8_t *buf, int ts, int &pos, int &wrap)
{
- UINT8 v = 0;
+ uint8_t v = 0;
int w1 = wrap;
while(wrap != w1+2 && !(v & 0x80)) {
v = v << 1 | ((buf[pos >> 3] >> (7-(pos & 7))) & 1);
@@ -1342,7 +1342,7 @@ UINT8 dc42_format::gb(const UINT8 *buf, int ts, int &pos, int &wrap)
return v;
}
-void dc42_format::update_chk(const UINT8 *data, int size, UINT32 &chk)
+void dc42_format::update_chk(const uint8_t *data, int size, uint32_t &chk)
{
for(int i=0; i<size; i+=2) {
chk += (data[i] << 8) | data[i+1];
@@ -1358,13 +1358,13 @@ bool dc42_format::save(io_generic *io, floppy_image *image)
if(g_heads == 0)
g_heads = 1;
- UINT8 h[0x54];
+ uint8_t h[0x54];
memset(h, 0, 0x54);
strcpy((char *)h+1, "Unnamed");
h[0] = 7;
int nsect = 16*(12+11+10+9+8)*g_heads;
- UINT32 dsize = nsect*512;
- UINT32 tsize = nsect*12;
+ uint32_t dsize = nsect*512;
+ uint32_t tsize = nsect*12;
h[0x40] = dsize >> 24;
h[0x41] = dsize >> 16;
h[0x42] = dsize >> 8;
@@ -1378,25 +1378,25 @@ bool dc42_format::save(io_generic *io, floppy_image *image)
h[0x52] = 0x01;
h[0x53] = 0x00;
- UINT32 dchk = 0;
- UINT32 tchk = 0;
+ uint32_t dchk = 0;
+ uint32_t tchk = 0;
int pos_data = 0x54;
int pos_tag = 0x54+dsize;
for(int track=0; track < 80; track++) {
for(int head=0; head < g_heads; head++) {
- UINT8 sectdata[(512+12)*12];
+ uint8_t sectdata[(512+12)*12];
memset(sectdata, 0, sizeof(sectdata));
int nsect = 12-(track/16);
- UINT8 buf[13000];
+ uint8_t buf[13000];
int ts;
generate_bitstream_from_track(track, head, 200000000/(6208*nsect), buf, ts, image);
int pos = 0;
int wrap = 0;
int hb = 0;
for(;;) {
- UINT8 v = gb(buf, ts, pos, wrap);
+ uint8_t v = gb(buf, ts, pos, wrap);
if(v == 0xff)
hb = 1;
else if(hb == 1 && v == 0xd5)
@@ -1409,18 +1409,18 @@ bool dc42_format::save(io_generic *io, floppy_image *image)
hb = 0;
if(hb == 4) {
- UINT8 h[7];
+ uint8_t h[7];
for(auto & elem : h)
elem = gb(buf, ts, pos, wrap);
- UINT8 v2 = gcr6bw_tb[h[2]];
- UINT8 v3 = gcr6bw_tb[h[3]];
- UINT8 tr = gcr6bw_tb[h[0]] | (v2 & 1 ? 0x40 : 0x00);
- UINT8 se = gcr6bw_tb[h[1]];
- UINT8 si = v2 & 0x20 ? 1 : 0;
- // UINT8 ds = v3 & 0x20 ? 1 : 0;
- // UINT8 fmt = v3 & 0x1f;
- UINT8 c1 = (tr^se^v2^v3) & 0x3f;
- UINT8 chk = gcr6bw_tb[h[4]];
+ uint8_t v2 = gcr6bw_tb[h[2]];
+ uint8_t v3 = gcr6bw_tb[h[3]];
+ uint8_t tr = gcr6bw_tb[h[0]] | (v2 & 1 ? 0x40 : 0x00);
+ uint8_t se = gcr6bw_tb[h[1]];
+ uint8_t si = v2 & 0x20 ? 1 : 0;
+ // uint8_t ds = v3 & 0x20 ? 1 : 0;
+ // uint8_t fmt = v3 & 0x1f;
+ uint8_t c1 = (tr^se^v2^v3) & 0x3f;
+ uint8_t chk = gcr6bw_tb[h[4]];
if(chk == c1 && tr == track && si == head && se < nsect) {
int opos = pos;
int owrap = wrap;
@@ -1439,15 +1439,15 @@ bool dc42_format::save(io_generic *io, floppy_image *image)
hb = 0;
}
if(hb == 4) {
- UINT8 *dest = sectdata+(512+12)*se;
+ uint8_t *dest = sectdata+(512+12)*se;
gb(buf, ts, pos, wrap); // Ignore the sector byte
- UINT8 ca = 0, cb = 0, cc = 0;
+ uint8_t ca = 0, cb = 0, cc = 0;
for(int i=0; i<522/3+1; i++) {
- UINT8 e0 = gb(buf, ts, pos, wrap);
- UINT8 e1 = gb(buf, ts, pos, wrap);
- UINT8 e2 = gb(buf, ts, pos, wrap);
- UINT8 e3 = i == 522/3 ? 0x96 : gb(buf, ts, pos, wrap);
- UINT8 va, vb, vc;
+ uint8_t e0 = gb(buf, ts, pos, wrap);
+ uint8_t e1 = gb(buf, ts, pos, wrap);
+ uint8_t e2 = gb(buf, ts, pos, wrap);
+ uint8_t e3 = i == 522/3 ? 0x96 : gb(buf, ts, pos, wrap);
+ uint8_t va, vb, vc;
gcr6_decode(e0, e1, e2, e3, va, vb, vc);
cc = (cc << 1) | (cc >> 7);
va = va ^ cc;
@@ -1474,7 +1474,7 @@ bool dc42_format::save(io_generic *io, floppy_image *image)
break;
}
for(int i=0; i<nsect; i++) {
- UINT8 *data = sectdata + (512+12)*i;
+ uint8_t *data = sectdata + (512+12)*i;
io_generic_write(io, data, pos_tag, 12);
io_generic_write(io, data+12, pos_data, 512);
pos_tag += 12;
diff --git a/src/lib/formats/ap_dsk35.h b/src/lib/formats/ap_dsk35.h
index 533307e2708..6e7b2d583c5 100644
--- a/src/lib/formats/ap_dsk35.h
+++ b/src/lib/formats/ap_dsk35.h
@@ -13,8 +13,8 @@
#include "flopimg.h"
-void sony_filltrack(UINT8 *buffer, size_t buffer_len, size_t *pos, UINT8 data);
-UINT8 sony_fetchtrack(const UINT8 *buffer, size_t buffer_len, size_t *pos);
+void sony_filltrack(uint8_t *buffer, size_t buffer_len, size_t *pos, uint8_t data);
+uint8_t sony_fetchtrack(const uint8_t *buffer, size_t buffer_len, size_t *pos);
int apple35_sectors_per_track(floppy_image_legacy *image, int track);
@@ -28,8 +28,8 @@ class dc42_format : public floppy_image_format_t
public:
dc42_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
@@ -40,8 +40,8 @@ public:
private:
static const desc_e mac_gcr[];
- UINT8 gb(const UINT8 *buf, int ts, int &pos, int &wrap);
- void update_chk(const UINT8 *data, int size, UINT32 &chk);
+ uint8_t gb(const uint8_t *buf, int ts, int &pos, int &wrap);
+ void update_chk(const uint8_t *data, int size, uint32_t &chk);
};
extern const floppy_format_type FLOPPY_DC42_FORMAT;
diff --git a/src/lib/formats/apf_apt.cpp b/src/lib/formats/apf_apt.cpp
index d2064122d82..de919b0bddd 100644
--- a/src/lib/formats/apf_apt.cpp
+++ b/src/lib/formats/apf_apt.cpp
@@ -47,7 +47,7 @@ e. A checksum byte (8-bit addition)
/* 500 microsecond of bit 0 and 1000 microsecond of bit 1 */
static int apf_image_size;
-static int apf_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int apf_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -58,7 +58,7 @@ static int apf_put_samples(INT16 *buffer, int sample_pos, int count, int level)
return count;
}
-static int apf_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int apf_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -76,10 +76,10 @@ static int apf_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int apf_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int apf_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* data */
for (i = 0; i<8; i++)
@@ -88,12 +88,12 @@ static int apf_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int apf_apt_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int apf_apt_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 i;
- UINT8 cksm = 0;
- UINT32 temp = 0;
+ uint32_t sample_count = 0;
+ uint32_t i;
+ uint8_t cksm = 0;
+ uint32_t temp = 0;
// silence
sample_count += apf_put_samples(buffer, 0, 12000, 0);
@@ -121,11 +121,11 @@ static int apf_apt_handle_cassette(INT16 *buffer, const UINT8 *bytes)
return sample_count;
}
-static int apf_cpf_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int apf_cpf_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 i;
- UINT8 cksm = 0;
+ uint32_t sample_count = 0;
+ uint32_t i;
+ uint8_t cksm = 0;
// silence
sample_count += apf_put_samples(buffer, 0, 12000, 0);
@@ -154,12 +154,12 @@ static int apf_cpf_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int apf_apt_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int apf_apt_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return apf_apt_handle_cassette(buffer, bytes);
}
-static int apf_cpf_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int apf_cpf_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return apf_cpf_handle_cassette(buffer, bytes);
}
@@ -168,14 +168,14 @@ static int apf_cpf_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int apf_apt_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int apf_apt_calculate_size_in_samples(const uint8_t *bytes, int length)
{
apf_image_size = length;
return apf_apt_handle_cassette(nullptr, bytes);
}
-static int apf_cpf_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int apf_cpf_calculate_size_in_samples(const uint8_t *bytes, int length)
{
apf_image_size = length;
diff --git a/src/lib/formats/apollo_dsk.cpp b/src/lib/formats/apollo_dsk.cpp
index 29dbe23b0b5..b2fef28be71 100644
--- a/src/lib/formats/apollo_dsk.cpp
+++ b/src/lib/formats/apollo_dsk.cpp
@@ -46,10 +46,10 @@ const apollo_format::format apollo_format::formats[] = {
const floppy_format_type FLOPPY_APOLLO_FORMAT = &floppy_image_format_creator<apollo_format>;
-int apollo_format::identify(io_generic *io, UINT32 form_factor)
+int apollo_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
- UINT32 expected_size = 77*2*8*1024;
+ uint64_t size = io_generic_size(io);
+ uint32_t expected_size = 77*2*8*1024;
return ((size == expected_size) || (size == 0)) ? 1 : 0;
}
diff --git a/src/lib/formats/apollo_dsk.h b/src/lib/formats/apollo_dsk.h
index 51f9eb4aebc..47de0373d23 100644
--- a/src/lib/formats/apollo_dsk.h
+++ b/src/lib/formats/apollo_dsk.h
@@ -17,7 +17,7 @@ class apollo_format : public upd765_format {
public:
apollo_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
+ virtual int identify(io_generic *io, uint32_t form_factor) override;
virtual const char *name() const override;
virtual const char *description() const override;
virtual const char *extensions() const override;
diff --git a/src/lib/formats/apridisk.cpp b/src/lib/formats/apridisk.cpp
index a004d54ccd0..a42aa9fa4d4 100644
--- a/src/lib/formats/apridisk.cpp
+++ b/src/lib/formats/apridisk.cpp
@@ -31,9 +31,9 @@ const char *apridisk_format::extensions() const
return "dsk";
}
-int apridisk_format::identify(io_generic *io, UINT32 form_factor)
+int apridisk_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 header[APR_HEADER_SIZE];
+ uint8_t header[APR_HEADER_SIZE];
io_generic_read(io, header, 0, APR_HEADER_SIZE);
const char magic[] = "ACT Apricot disk image\x1a\x04";
@@ -44,35 +44,35 @@ int apridisk_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool apridisk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool apridisk_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
desc_pc_sector sectors[80][2][18];
- UINT8 sector_data[MAX_SECTORS * SECTOR_SIZE];
- UINT8 *data_ptr = sector_data;
+ uint8_t sector_data[MAX_SECTORS * SECTOR_SIZE];
+ uint8_t *data_ptr = sector_data;
int track_count = 0, head_count = 0, sector_count = 0;
- UINT64 file_size = io_generic_size(io);
- UINT64 file_offset = APR_HEADER_SIZE;
+ uint64_t file_size = io_generic_size(io);
+ uint64_t file_offset = APR_HEADER_SIZE;
while (file_offset < file_size)
{
// read sector header
- UINT8 sector_header[16];
+ uint8_t sector_header[16];
io_generic_read(io, sector_header, file_offset, 16);
- UINT32 type = pick_integer_le(&sector_header, 0, 4);
- UINT16 compression = pick_integer_le(&sector_header, 4, 2);
- UINT16 header_size = pick_integer_le(&sector_header, 6, 2);
- UINT32 data_size = pick_integer_le(&sector_header, 8, 4);
+ uint32_t type = pick_integer_le(&sector_header, 0, 4);
+ uint16_t compression = pick_integer_le(&sector_header, 4, 2);
+ uint16_t header_size = pick_integer_le(&sector_header, 6, 2);
+ uint32_t data_size = pick_integer_le(&sector_header, 8, 4);
file_offset += header_size;
switch (type)
{
case APR_SECTOR:
- UINT8 head = pick_integer_le(&sector_header, 12, 1);
- UINT8 sector = pick_integer_le(&sector_header, 13, 1);
- UINT8 track = (UINT8) pick_integer_le(&sector_header, 14, 2);
+ uint8_t head = pick_integer_le(&sector_header, 12, 1);
+ uint8_t sector = pick_integer_le(&sector_header, 13, 1);
+ uint8_t track = (uint8_t) pick_integer_le(&sector_header, 14, 2);
track_count = std::max(track_count, int(unsigned(track)));
head_count = std::max(head_count, int(unsigned(head)));
@@ -92,9 +92,9 @@ bool apridisk_format::load(io_generic *io, UINT32 form_factor, floppy_image *ima
{
case APR_COMPRESSED:
{
- UINT8 comp[3];
+ uint8_t comp[3];
io_generic_read(io, comp, file_offset, 3);
- UINT16 length = pick_integer_le(comp, 0, 2);
+ uint16_t length = pick_integer_le(comp, 0, 2);
if (length != SECTOR_SIZE)
fatalerror("apridisk_format: Invalid compression length %04x\n", length);
diff --git a/src/lib/formats/apridisk.h b/src/lib/formats/apridisk.h
index 4faf756fd5a..81db4b41105 100644
--- a/src/lib/formats/apridisk.h
+++ b/src/lib/formats/apridisk.h
@@ -24,8 +24,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 bool supports_save() const override;
diff --git a/src/lib/formats/atom_tap.cpp b/src/lib/formats/atom_tap.cpp
index f3ab980a8fa..3c606901b90 100644
--- a/src/lib/formats/atom_tap.cpp
+++ b/src/lib/formats/atom_tap.cpp
@@ -69,9 +69,9 @@ static const struct CassetteModulation atom_tap_modulation =
cassette_image_read_uint8 - read tape data
-------------------------------------------------*/
-static UINT8 cassette_image_read_uint8(cassette_image *cassette, UINT64 offset)
+static uint8_t cassette_image_read_uint8(cassette_image *cassette, uint64_t offset)
{
- UINT8 data;
+ uint8_t data;
cassette_image_read(cassette, &data, offset, 1);
return data;
}
@@ -101,14 +101,14 @@ static cassette_image::error atom_tap_identify(cassette_image *cassette, struct
static cassette_image::error atom_tap_load(cassette_image *cassette)
{
cassette_image::error err;
- UINT64 image_size = cassette_image_size(cassette);
- UINT64 image_pos = 0;
+ uint64_t image_size = cassette_image_size(cassette);
+ uint64_t image_pos = 0;
double time_index = 0.0;
double time_displacement;
while (image_pos < image_size)
{
- UINT8 data = cassette_image_read_uint8(cassette, image_pos);
+ uint8_t data = cassette_image_read_uint8(cassette, image_pos);
/* start bit */
MODULATE(0);
diff --git a/src/lib/formats/basicdsk.cpp b/src/lib/formats/basicdsk.cpp
index 35207c0c86b..b24ca47346d 100644
--- a/src/lib/formats/basicdsk.cpp
+++ b/src/lib/formats/basicdsk.cpp
@@ -18,8 +18,8 @@ static floperr_t basicdsk_read_sector(floppy_image_legacy *floppy, int head, int
static floperr_t basicdsk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam);
static floperr_t basicdsk_read_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen);
static floperr_t basicdsk_write_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam);
-static floperr_t basicdsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length);
-static floperr_t basicdsk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags);
+static floperr_t basicdsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length);
+static floperr_t basicdsk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags);
static int basicdsk_get_heads_per_disk(floppy_image_legacy *floppy);
static int basicdsk_get_tracks_per_disk(floppy_image_legacy *floppy);
static floperr_t basicdsk_format_track(floppy_image_legacy *floppy, int head, int track, util::option_resolution *params);
@@ -77,10 +77,10 @@ floperr_t basicdsk_construct(floppy_image_legacy *floppy, const struct basicdsk_
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
const struct basicdsk_geometry *geom;
- UINT64 offs;
+ uint64_t offs;
geom = get_geometry(floppy);
@@ -131,7 +131,7 @@ static int internal_basicdsk_translate_sector_interleave(floppy_image_legacy *fl
static floperr_t internal_basicdsk_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
@@ -145,7 +145,7 @@ static floperr_t internal_basicdsk_read_sector(floppy_image_legacy *floppy, int
static floperr_t internal_basicdsk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
@@ -183,10 +183,10 @@ static floperr_t basicdsk_write_indexed_sector(floppy_image_legacy *floppy, int
static floperr_t basicdsk_format_track(floppy_image_legacy *floppy, int head, int track, util::option_resolution *params)
{
floperr_t err = FLOPPY_ERROR_SUCCESS;
- UINT8 local_buffer[512];
+ uint8_t local_buffer[512];
void *alloc_buffer = nullptr;
void *buffer;
- UINT32 sector_length;
+ uint32_t sector_length;
int sector;
const struct basicdsk_geometry *geometry;
@@ -241,7 +241,7 @@ static int basicdsk_get_tracks_per_disk(floppy_image_legacy *floppy)
-static floperr_t basicdsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t basicdsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
@@ -256,7 +256,7 @@ static floperr_t basicdsk_get_sector_length(floppy_image_legacy *floppy, int hea
-static floperr_t basicdsk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t basicdsk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
const struct basicdsk_geometry *geom = get_geometry(floppy);
@@ -338,7 +338,7 @@ FLOPPY_CONSTRUCT(basicdsk_construct_default)
FLOPPY_IDENTIFY(basicdsk_identify_default)
{
- UINT64 expected_size;
+ uint64_t expected_size;
struct basicdsk_geometry geometry;
basicdsk_default_geometry(format, &geometry);
diff --git a/src/lib/formats/basicdsk.h b/src/lib/formats/basicdsk.h
index 77f234da949..eae442993e3 100644
--- a/src/lib/formats/basicdsk.h
+++ b/src/lib/formats/basicdsk.h
@@ -21,12 +21,12 @@ struct basicdsk_geometry
int first_sector_id;
int interleave;
int sector_map[256];
- UINT32 sector_length;
- UINT64 offset;
+ uint32_t sector_length;
+ uint64_t offset;
int (*translate_sector)(floppy_image_legacy *floppy, int sector);
- UINT64 (*translate_offset)(floppy_image_legacy *floppy, const struct basicdsk_geometry *geom, int track, int head, int sector);
- UINT64 (*get_ddam)(floppy_image_legacy *floppy, const struct basicdsk_geometry *geom, int track, int head, int sector);
+ uint64_t (*translate_offset)(floppy_image_legacy *floppy, const struct basicdsk_geometry *geom, int track, int head, int sector);
+ uint64_t (*get_ddam)(floppy_image_legacy *floppy, const struct basicdsk_geometry *geom, int track, int head, int sector);
};
floperr_t basicdsk_construct(floppy_image_legacy *floppy, const struct basicdsk_geometry *geometry);
diff --git a/src/lib/formats/c3040_dsk.cpp b/src/lib/formats/c3040_dsk.cpp
index 9fb6669ab20..78786979953 100644
--- a/src/lib/formats/c3040_dsk.cpp
+++ b/src/lib/formats/c3040_dsk.cpp
@@ -56,7 +56,7 @@ const int c3040_format::c3040_gap2[] =
12, 12, 12, 12, 12 // 31-35
};
-floppy_image_format_t::desc_e* c3040_format::get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2)
+floppy_image_format_t::desc_e* c3040_format::get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2)
{
static floppy_image_format_t::desc_e desc[] = {
/* 00 */ { SECTOR_LOOP_START, 0, -1 },
diff --git a/src/lib/formats/c3040_dsk.h b/src/lib/formats/c3040_dsk.h
index 659b2748571..4a549abad13 100644
--- a/src/lib/formats/c3040_dsk.h
+++ b/src/lib/formats/c3040_dsk.h
@@ -23,7 +23,7 @@ public:
protected:
virtual int get_sectors_per_track(const format &f, int track) override { return c3040_sectors_per_track[track]; }
- virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2) override;
+ virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2) override;
virtual int get_gap2(const format &f, int head, int track) override { return c3040_gap2[track]; }
virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size) override;
diff --git a/src/lib/formats/c4040_dsk.cpp b/src/lib/formats/c4040_dsk.cpp
index 9e6dff7f627..e6314f69261 100644
--- a/src/lib/formats/c4040_dsk.cpp
+++ b/src/lib/formats/c4040_dsk.cpp
@@ -46,7 +46,7 @@ const int c4040_format::c4040_gap2[] =
12, 12, 12, 12, 12 // 31-35
};
-floppy_image_format_t::desc_e* c4040_format::get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2)
+floppy_image_format_t::desc_e* c4040_format::get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2)
{
static floppy_image_format_t::desc_e desc[] = {
/* 00 */ { SECTOR_LOOP_START, 0, -1 },
diff --git a/src/lib/formats/c4040_dsk.h b/src/lib/formats/c4040_dsk.h
index 591fcd42925..08d62ca3e23 100644
--- a/src/lib/formats/c4040_dsk.h
+++ b/src/lib/formats/c4040_dsk.h
@@ -22,7 +22,7 @@ public:
virtual const char *extensions() const override;
protected:
- virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2) override;
+ virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2) override;
virtual int get_gap2(const format &f, int head, int track) override { return c4040_gap2[track]; }
virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size) override;
diff --git a/src/lib/formats/camplynx_cas.cpp b/src/lib/formats/camplynx_cas.cpp
index 330df5601a1..d6181d845ff 100644
--- a/src/lib/formats/camplynx_cas.cpp
+++ b/src/lib/formats/camplynx_cas.cpp
@@ -37,7 +37,7 @@ Each byte is 8 bits (MSB first) with no start or stop bits.
// image size
static int camplynx_image_size;
-static int camplynx_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int camplynx_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -48,7 +48,7 @@ static int camplynx_put_samples(INT16 *buffer, int sample_pos, int count, int le
return count;
}
-static int camplynx_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int camplynx_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -66,10 +66,10 @@ static int camplynx_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int camplynx_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int camplynx_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* data */
for (i = 0; i<8; i++)
@@ -78,11 +78,11 @@ static int camplynx_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int camplynx_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int camplynx_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 byte_count = 0;
- UINT32 i;
+ uint32_t sample_count = 0;
+ uint32_t byte_count = 0;
+ uint32_t i;
/* header zeroes */
for (i=0; i<555; i++)
@@ -137,7 +137,7 @@ static int camplynx_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int camplynx_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int camplynx_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return camplynx_handle_cassette(buffer, bytes);
}
@@ -146,7 +146,7 @@ static int camplynx_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int camplynx_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int camplynx_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
camplynx_image_size = length;
diff --git a/src/lib/formats/cassimg.cpp b/src/lib/formats/cassimg.cpp
index 39e3176e121..87636b81349 100644
--- a/src/lib/formats/cassimg.cpp
+++ b/src/lib/formats/cassimg.cpp
@@ -33,7 +33,7 @@ CASSETTE_FORMATLIST_END
helper code
*********************************************************************/
-static double map_double(double d, UINT64 low, UINT64 high, UINT64 value)
+static double map_double(double d, uint64_t low, uint64_t high, uint64_t value)
{
return d * (value - low) / (high - low);
}
@@ -51,24 +51,24 @@ static size_t waveform_bytes_per_sample(int waveform_flags)
extrapolation and interpolation
*********************************************************************/
-static INT32 extrapolate8(INT8 value)
+static int32_t extrapolate8(int8_t value)
{
- return ((INT32) value) << 24;
+ return ((int32_t) value) << 24;
}
-static INT32 extrapolate16(INT16 value)
+static int32_t extrapolate16(int16_t value)
{
- return ((INT32) value) << 16;
+ return ((int32_t) value) << 16;
}
-static INT8 interpolate8(INT32 value)
+static int8_t interpolate8(int32_t value)
{
- return (INT8) (value >> 24);
+ return (int8_t) (value >> 24);
}
-static INT16 interpolate16(INT32 value)
+static int16_t interpolate16(int32_t value)
{
- return (INT16) (value >> 16);
+ return (int16_t) (value >> 16);
}
@@ -309,21 +309,21 @@ void cassette_change(cassette_image *cassette, void *file, const struct io_procs
calls for accessing the raw cassette image
*********************************************************************/
-void cassette_image_read(cassette_image *cassette, void *buffer, UINT64 offset, size_t length)
+void cassette_image_read(cassette_image *cassette, void *buffer, uint64_t offset, size_t length)
{
io_generic_read(&cassette->io, buffer, offset, length);
}
-void cassette_image_write(cassette_image *cassette, const void *buffer, UINT64 offset, size_t length)
+void cassette_image_write(cassette_image *cassette, const void *buffer, uint64_t offset, size_t length)
{
io_generic_write(&cassette->io, buffer, offset, length);
}
-UINT64 cassette_image_size(cassette_image *cassette)
+uint64_t cassette_image_size(cassette_image *cassette)
{
return io_generic_size(&cassette->io);
}
@@ -379,7 +379,7 @@ static cassette_image::error compute_manipulation_ranges(cassette_image *cassett
-static cassette_image::error lookup_sample(cassette_image *cassette, int channel, size_t sample, INT32 **ptr)
+static cassette_image::error lookup_sample(cassette_image *cassette, int channel, size_t sample, int32_t **ptr)
{
*ptr = nullptr;
size_t sample_blocknum = (sample / SAMPLES_PER_BLOCK) * cassette->channels + channel;
@@ -422,12 +422,12 @@ cassette_image::error cassette_get_samples(cassette_image *cassette, int channel
struct manipulation_ranges ranges;
size_t sample_index;
size_t cassette_sample_index;
- UINT8 *dest_ptr;
- const INT32 *source_ptr;
+ uint8_t *dest_ptr;
+ const int32_t *source_ptr;
double d;
- INT16 word;
- INT32 dword;
- INT64 sum;
+ int16_t word;
+ int32_t dword;
+ int64_t sum;
assert(cassette);
@@ -444,7 +444,7 @@ cassette_image::error cassette_get_samples(cassette_image *cassette, int channel
/* find the sample that we are putting */
d = map_double(ranges.sample_last + 1 - ranges.sample_first, 0, sample_count, sample_index) + ranges.sample_first;
cassette_sample_index = (size_t) d;
- err = lookup_sample(cassette, channel, cassette_sample_index, (INT32 **) &source_ptr);
+ err = lookup_sample(cassette, channel, cassette_sample_index, (int32_t **) &source_ptr);
if (err != cassette_image::error::SUCCESS)
return err;
@@ -455,24 +455,24 @@ cassette_image::error cassette_get_samples(cassette_image *cassette, int channel
sum /= (ranges.channel_last + 1 - ranges.channel_first);
/* and write out the result */
- dest_ptr = (UINT8*)samples;
+ dest_ptr = (uint8_t*)samples;
dest_ptr += waveform_bytes_per_sample(waveform_flags) * sample_index * cassette->channels;
switch(waveform_bytes_per_sample(waveform_flags))
{
case 1:
- *((INT8 *) dest_ptr) = interpolate8(sum);
+ *((int8_t *) dest_ptr) = interpolate8(sum);
break;
case 2:
word = interpolate16(sum);
if (waveform_flags & CASSETTE_WAVEFORM_ENDIAN_FLIP)
word = flipendian_int16(word);
- *((INT16 *) dest_ptr) = word;
+ *((int16_t *) dest_ptr) = word;
break;
case 4:
dword = sum;
if (waveform_flags & CASSETTE_WAVEFORM_ENDIAN_FLIP)
dword = flipendian_int32(dword);
- *((INT32 *) dest_ptr) = dword;
+ *((int32_t *) dest_ptr) = dword;
break;
}
}
@@ -488,11 +488,11 @@ cassette_image::error cassette_put_samples(cassette_image *cassette, int channel
cassette_image::error err;
struct manipulation_ranges ranges;
size_t sample_index;
- INT32 *dest_ptr;
- INT32 dest_value;
- INT16 word;
- INT32 dword;
- const UINT8 *source_ptr;
+ int32_t *dest_ptr;
+ int32_t dest_value;
+ int16_t word;
+ int32_t dword;
+ const uint8_t *source_ptr;
double d;
if (!cassette)
@@ -520,25 +520,25 @@ cassette_image::error cassette_put_samples(cassette_image *cassette, int channel
{
/* figure out the source pointer */
d = map_double(sample_count, ranges.sample_first, ranges.sample_last + 1, sample_index);
- source_ptr = (const UINT8*)samples;
+ source_ptr = (const uint8_t*)samples;
source_ptr += ((size_t) d) * sample_bytes;
/* compute the value that we are writing */
switch(waveform_bytes_per_sample(waveform_flags)) {
case 1:
if (waveform_flags & CASSETTE_WAVEFORM_UNSIGNED)
- dest_value = extrapolate8((INT8)(*source_ptr - 128));
+ dest_value = extrapolate8((int8_t)(*source_ptr - 128));
else
- dest_value = extrapolate8(*((INT8 *) source_ptr));
+ dest_value = extrapolate8(*((int8_t *) source_ptr));
break;
case 2:
- word = *((INT16 *) source_ptr);
+ word = *((int16_t *) source_ptr);
if (waveform_flags & CASSETTE_WAVEFORM_ENDIAN_FLIP)
word = flipendian_int16(word);
dest_value = extrapolate16(word);
break;
case 4:
- dword = *((INT32 *) source_ptr);
+ dword = *((int32_t *) source_ptr);
if (waveform_flags & CASSETTE_WAVEFORM_ENDIAN_FLIP)
dword = flipendian_int32(dword);
dest_value = dword;
@@ -562,7 +562,7 @@ cassette_image::error cassette_put_samples(cassette_image *cassette, int channel
cassette_image::error cassette_get_sample(cassette_image *cassette, int channel,
- double time_index, double sample_period, INT32 *sample)
+ double time_index, double sample_period, int32_t *sample)
{
return cassette_get_samples(cassette, channel, time_index,
sample_period, 1, 0, sample, CASSETTE_WAVEFORM_32BIT);
@@ -571,7 +571,7 @@ cassette_image::error cassette_get_sample(cassette_image *cassette, int channel,
cassette_image::error cassette_put_sample(cassette_image *cassette, int channel,
- double time_index, double sample_period, INT32 sample)
+ double time_index, double sample_period, int32_t sample)
{
return cassette_put_samples(cassette, channel, time_index,
sample_period, 1, 0, &sample, CASSETTE_WAVEFORM_32BIT);
@@ -584,7 +584,7 @@ cassette_image::error cassette_put_sample(cassette_image *cassette, int channel,
*********************************************************************/
cassette_image::error cassette_read_samples(cassette_image *cassette, int channels, double time_index,
- double sample_period, size_t sample_count, UINT64 offset, int waveform_flags)
+ double sample_period, size_t sample_count, uint64_t offset, int waveform_flags)
{
cassette_image::error err;
size_t chunk_sample_count;
@@ -594,7 +594,7 @@ cassette_image::error cassette_read_samples(cassette_image *cassette, int channe
double chunk_time_index;
double chunk_sample_period;
int channel;
- UINT8 buffer[8192];
+ uint8_t buffer[8192];
bytes_per_sample = waveform_bytes_per_sample(waveform_flags);
sample_bytes = bytes_per_sample * channels;
@@ -624,7 +624,7 @@ cassette_image::error cassette_read_samples(cassette_image *cassette, int channe
cassette_image::error cassette_write_samples(cassette_image *cassette, int channels, double time_index,
- double sample_period, size_t sample_count, UINT64 offset, int waveform_flags)
+ double sample_period, size_t sample_count, uint64_t offset, int waveform_flags)
{
cassette_image::error err;
size_t chunk_sample_count;
@@ -634,7 +634,7 @@ cassette_image::error cassette_write_samples(cassette_image *cassette, int chann
double chunk_time_index;
double chunk_sample_period;
int channel;
- UINT8 buffer[8192];
+ uint8_t buffer[8192];
bytes_per_sample = waveform_bytes_per_sample(waveform_flags);
sample_bytes = bytes_per_sample * channels;
@@ -667,10 +667,10 @@ cassette_image::error cassette_write_samples(cassette_image *cassette, int chann
waveform accesses to/from the raw image
*********************************************************************/
-static const INT8 *choose_wave(const struct CassetteModulation *modulation, size_t *wave_bytes_length)
+static const int8_t *choose_wave(const struct CassetteModulation *modulation, size_t *wave_bytes_length)
{
- static const INT8 square_wave[] = { -128, 127 };
- static const INT8 sine_wave[] = { 0, 48, 89, 117, 127, 117, 89, 48, 0, -48, -89, -117, -127, -117, -89, -48 };
+ static const int8_t square_wave[] = { -128, 127 };
+ static const int8_t sine_wave[] = { 0, 48, 89, 117, 127, 117, 89, 48, 0, -48, -89, -117, -127, -117, -89, -48 };
if (modulation->flags & CASSETTE_MODULATION_SINEWAVE)
{
@@ -693,7 +693,7 @@ cassette_image::error cassette_modulation_identify(cassette_image *cassette, con
choose_wave(modulation, &wave_bytes_length);
opts->bits_per_sample = 8;
opts->channels = 1;
- opts->sample_frequency = (UINT32) (std::max(modulation->zero_frequency_high, modulation->one_frequency_high) * wave_bytes_length * 2);
+ opts->sample_frequency = (uint32_t) (std::max(modulation->zero_frequency_high, modulation->one_frequency_high) * wave_bytes_length * 2);
return cassette_image::error::SUCCESS;
}
@@ -704,13 +704,13 @@ cassette_image::error cassette_put_modulated_data(cassette_image *cassette, int
double *time_displacement)
{
cassette_image::error err;
- const UINT8 *data_bytes = (const UINT8 *)data;
- const INT8 *wave_bytes;
+ const uint8_t *data_bytes = (const uint8_t *)data;
+ const int8_t *wave_bytes;
size_t wave_bytes_length;
double total_displacement = 0.0;
double pulse_period;
double pulse_frequency;
- UINT8 b;
+ uint8_t b;
int i;
wave_bytes = choose_wave(modulation, &wave_bytes_length);
@@ -740,7 +740,7 @@ done:
cassette_image::error cassette_put_modulated_filler(cassette_image *cassette, int channel, double time_index,
- UINT8 filler, size_t filler_length, const struct CassetteModulation *modulation,
+ uint8_t filler, size_t filler_length, const struct CassetteModulation *modulation,
double *time_displacement)
{
cassette_image::error err;
@@ -764,13 +764,13 @@ cassette_image::error cassette_put_modulated_filler(cassette_image *cassette, in
cassette_image::error cassette_read_modulated_data(cassette_image *cassette, int channel, double time_index,
- UINT64 offset, UINT64 length, const struct CassetteModulation *modulation,
+ uint64_t offset, uint64_t length, const struct CassetteModulation *modulation,
double *time_displacement)
{
cassette_image::error err;
- UINT8 buffer_stack[1024];
- UINT8 *buffer;
- UINT8 *alloc_buffer = nullptr;
+ uint8_t buffer_stack[1024];
+ uint8_t *buffer;
+ uint8_t *alloc_buffer = nullptr;
double delta;
double total_displacement = 0.0;
size_t this_length;
@@ -783,8 +783,8 @@ cassette_image::error cassette_read_modulated_data(cassette_image *cassette, int
}
else
{
- buffer_length = std::min<UINT64>(length, 100000);
- alloc_buffer = (UINT8*)malloc(buffer_length);
+ buffer_length = std::min<uint64_t>(length, 100000);
+ alloc_buffer = (uint8_t*)malloc(buffer_length);
if (!alloc_buffer)
{
err = cassette_image::error::OUT_OF_MEMORY;
@@ -795,7 +795,7 @@ cassette_image::error cassette_read_modulated_data(cassette_image *cassette, int
while(length > 0)
{
- this_length = (std::min<UINT64>)(length, buffer_length);
+ this_length = (std::min<uint64_t>)(length, buffer_length);
cassette_image_read(cassette, buffer, offset, this_length);
err = cassette_put_modulated_data(cassette, channel, time_index, buffer, this_length, modulation, &delta);
@@ -819,11 +819,11 @@ done:
cassette_image::error cassette_put_modulated_data_bit(cassette_image *cassette, int channel, double time_index,
- UINT8 data, const struct CassetteModulation *modulation,
+ uint8_t data, const struct CassetteModulation *modulation,
double *time_displacement)
{
cassette_image::error err;
- const INT8 *wave_bytes;
+ const int8_t *wave_bytes;
size_t wave_bytes_length;
double total_displacement = 0.0;
double pulse_period;
@@ -870,12 +870,12 @@ cassette_image::error cassette_legacy_construct(cassette_image *cassette,
cassette_image::error err;
int length;
int sample_count;
- std::vector<UINT8> bytes;
- std::vector<UINT8> chunk;
- std::vector<INT16> samples;
+ std::vector<uint8_t> bytes;
+ std::vector<uint8_t> chunk;
+ std::vector<int16_t> samples;
int pos = 0;
- UINT64 offset = 0;
- UINT64 size;
+ uint64_t offset = 0;
+ uint64_t size;
struct CassetteLegacyWaveFiller args;
/* sanity check the args */
diff --git a/src/lib/formats/cassimg.h b/src/lib/formats/cassimg.h
index 0bf8865e6ff..2f9ff01f1cb 100644
--- a/src/lib/formats/cassimg.h
+++ b/src/lib/formats/cassimg.h
@@ -66,20 +66,20 @@
***************************************************************************/
-typedef std::vector<INT32> sample_block;
+typedef std::vector<int32_t> sample_block;
struct CassetteOptions
{
int channels;
int bits_per_sample;
- UINT32 sample_frequency;
+ uint32_t sample_frequency;
};
struct CassetteInfo
{
int channels;
int bits_per_sample;
- UINT32 sample_frequency;
+ uint32_t sample_frequency;
size_t sample_count;
};
@@ -100,7 +100,7 @@ struct cassette_image
int channels;
int flags;
- UINT32 sample_frequency;
+ uint32_t sample_frequency;
std::vector<sample_block *> blocks;
size_t sample_count;
@@ -129,11 +129,11 @@ struct CassetteModulation
/* code to adapt existing legacy fill_wave functions */
struct CassetteLegacyWaveFiller
{
- int (*fill_wave)(INT16 *, int, UINT8 *);
+ int (*fill_wave)(int16_t *, int, uint8_t *);
int chunk_size;
int chunk_samples;
- int (*chunk_sample_calc)(const UINT8 *bytes, int length);
- UINT32 sample_frequency;
+ int (*chunk_sample_calc)(const uint8_t *bytes, int length);
+ uint32_t sample_frequency;
int header_samples;
int trailer_samples;
};
@@ -175,9 +175,9 @@ void cassette_change(cassette_image *cassette, void *file, const struct io_procs
void cassette_get_info(cassette_image *cassette, struct CassetteInfo *info);
/* calls for accessing the raw cassette image */
-void cassette_image_read(cassette_image *cassette, void *buffer, UINT64 offset, size_t length);
-void cassette_image_write(cassette_image *cassette, const void *buffer, UINT64 offset, size_t length);
-UINT64 cassette_image_size(cassette_image *cassette);
+void cassette_image_read(cassette_image *cassette, void *buffer, uint64_t offset, size_t length);
+void cassette_image_write(cassette_image *cassette, const void *buffer, uint64_t offset, size_t length);
+uint64_t cassette_image_size(cassette_image *cassette);
/* waveform accesses */
cassette_image::error cassette_get_samples(cassette_image *cassette, int channel,
@@ -187,15 +187,15 @@ cassette_image::error cassette_put_samples(cassette_image *cassette, int channel
double time_index, double sample_period, size_t sample_count, size_t sample_bytes,
const void *samples, int waveform_flags);
cassette_image::error cassette_get_sample(cassette_image *cassette, int channel,
- double time_index, double sample_period, INT32 *sample);
+ double time_index, double sample_period, int32_t *sample);
cassette_image::error cassette_put_sample(cassette_image *cassette, int channel,
- double time_index, double sample_period, INT32 sample);
+ double time_index, double sample_period, int32_t sample);
/* waveform accesses to/from the raw image */
cassette_image::error cassette_read_samples(cassette_image *cassette, int channels, double time_index,
- double sample_period, size_t sample_count, UINT64 offset, int waveform_flags);
+ double sample_period, size_t sample_count, uint64_t offset, int waveform_flags);
cassette_image::error cassette_write_samples(cassette_image *cassette, int channels, double time_index,
- double sample_period, size_t sample_count, UINT64 offset, int waveform_flags);
+ double sample_period, size_t sample_count, uint64_t offset, int waveform_flags);
/* modulation support */
cassette_image::error cassette_modulation_identify(cassette_image *cassette, const struct CassetteModulation *modulation,
@@ -204,21 +204,21 @@ cassette_image::error cassette_put_modulated_data(cassette_image *cassette, int
const void *data, size_t data_length, const struct CassetteModulation *modulation,
double *time_displacement);
cassette_image::error cassette_put_modulated_filler(cassette_image *cassette, int channel, double time_index,
- UINT8 filler, size_t filler_length, const struct CassetteModulation *modulation,
+ uint8_t filler, size_t filler_length, const struct CassetteModulation *modulation,
double *time_displacement);
cassette_image::error cassette_read_modulated_data(cassette_image *cassette, int channel, double time_index,
- UINT64 offset, UINT64 length, const struct CassetteModulation *modulation,
+ uint64_t offset, uint64_t length, const struct CassetteModulation *modulation,
double *time_displacement);
cassette_image::error cassette_put_modulated_data_bit(cassette_image *cassette, int channel, double time_index,
- UINT8 data, const struct CassetteModulation *modulation,
+ uint8_t data, const struct CassetteModulation *modulation,
double *time_displacement);
/* debug calls */
void cassette_dump(cassette_image *image, const char *filename);
/* legacy code support */
-#define CODE_HEADER ((UINT8*)-1)
-#define CODE_TRAILER ((UINT8*)-2)
+#define CODE_HEADER ((uint8_t*)-1)
+#define CODE_TRAILER ((uint8_t*)-2)
cassette_image::error cassette_legacy_identify(cassette_image *cassette, struct CassetteOptions *opts,
const struct CassetteLegacyWaveFiller *legacy_args);
cassette_image::error cassette_legacy_construct(cassette_image *cassette,
diff --git a/src/lib/formats/cbm_crt.cpp b/src/lib/formats/cbm_crt.cpp
index 43e440e725c..0da119c006f 100644
--- a/src/lib/formats/cbm_crt.cpp
+++ b/src/lib/formats/cbm_crt.cpp
@@ -130,7 +130,7 @@ std::string cbm_crt_get_card(util::core_file &file)
if (memcmp(header.signature, CRT_SIGNATURE, 16) == 0)
{
- UINT16 hardware = pick_integer_be(header.hardware, 0, 2);
+ uint16_t hardware = pick_integer_be(header.hardware, 0, 2);
return std::string(CRT_C64_SLOT_NAMES[hardware]);
}
@@ -152,7 +152,7 @@ bool cbm_crt_read_header(util::core_file &file, size_t *roml_size, size_t *romh_
if (memcmp(header.signature, CRT_SIGNATURE, 16) != 0)
return false;
- UINT16 hardware = pick_integer_be(header.hardware, 0, 2);
+ uint16_t hardware = pick_integer_be(header.hardware, 0, 2);
*exrom = header.exrom;
*game = header.game;
@@ -171,9 +171,9 @@ bool cbm_crt_read_header(util::core_file &file, size_t *roml_size, size_t *romh_
cbm_crt_chip chip;
file.read(&chip, CRT_CHIP_LENGTH);
- UINT16 address = pick_integer_be(chip.start_address, 0, 2);
- UINT16 size = pick_integer_be(chip.image_size, 0, 2);
- UINT16 type = pick_integer_be(chip.chip_type, 0, 2);
+ uint16_t address = pick_integer_be(chip.start_address, 0, 2);
+ uint16_t size = pick_integer_be(chip.image_size, 0, 2);
+ uint16_t type = pick_integer_be(chip.chip_type, 0, 2);
if (LOG)
{
@@ -201,10 +201,10 @@ bool cbm_crt_read_header(util::core_file &file, size_t *roml_size, size_t *romh_
// cbm_crt_read_data - read cartridge data
//-------------------------------------------------
-bool cbm_crt_read_data(util::core_file &file, UINT8 *roml, UINT8 *romh)
+bool cbm_crt_read_data(util::core_file &file, uint8_t *roml, uint8_t *romh)
{
- UINT32 roml_offset = 0;
- UINT32 romh_offset = 0;
+ uint32_t roml_offset = 0;
+ uint32_t romh_offset = 0;
file.seek(CRT_HEADER_LENGTH, SEEK_SET);
@@ -213,8 +213,8 @@ bool cbm_crt_read_data(util::core_file &file, UINT8 *roml, UINT8 *romh)
cbm_crt_chip chip;
file.read(&chip, CRT_CHIP_LENGTH);
- UINT16 address = pick_integer_be(chip.start_address, 0, 2);
- UINT16 size = pick_integer_be(chip.image_size, 0, 2);
+ uint16_t address = pick_integer_be(chip.start_address, 0, 2);
+ uint16_t size = pick_integer_be(chip.image_size, 0, 2);
switch (address)
{
diff --git a/src/lib/formats/cbm_crt.h b/src/lib/formats/cbm_crt.h
index 96d04cea2f6..2a5e5331a8a 100644
--- a/src/lib/formats/cbm_crt.h
+++ b/src/lib/formats/cbm_crt.h
@@ -108,25 +108,25 @@ enum
struct cbm_crt_header
{
- UINT8 signature[16];
- UINT8 header_length[4];
- UINT8 version[2];
- UINT8 hardware[2];
- UINT8 exrom;
- UINT8 game;
- UINT8 reserved[6];
- UINT8 name[32];
+ uint8_t signature[16];
+ uint8_t header_length[4];
+ uint8_t version[2];
+ uint8_t hardware[2];
+ uint8_t exrom;
+ uint8_t game;
+ uint8_t reserved[6];
+ uint8_t name[32];
};
struct cbm_crt_chip
{
- UINT8 signature[4];
- UINT8 packet_length[4];
- UINT8 chip_type[2];
- UINT8 bank[2];
- UINT8 start_address[2];
- UINT8 image_size[2];
+ uint8_t signature[4];
+ uint8_t packet_length[4];
+ uint8_t chip_type[2];
+ uint8_t bank[2];
+ uint8_t start_address[2];
+ uint8_t image_size[2];
};
@@ -137,7 +137,7 @@ struct cbm_crt_chip
std::string cbm_crt_get_card(util::core_file &file);
bool cbm_crt_read_header(util::core_file &file, size_t *roml_size, size_t *romh_size, int *exrom, int *game);
-bool cbm_crt_read_data(util::core_file &file, UINT8 *roml, UINT8 *romh);
+bool cbm_crt_read_data(util::core_file &file, uint8_t *roml, uint8_t *romh);
#endif
diff --git a/src/lib/formats/cbm_tap.cpp b/src/lib/formats/cbm_tap.cpp
index a7b28a8f8af..0b0950eebcc 100644
--- a/src/lib/formats/cbm_tap.cpp
+++ b/src/lib/formats/cbm_tap.cpp
@@ -130,7 +130,7 @@ below could be not working. FP ]
#define CBM_HEADER_SIZE 20
-static INT16 wave_data = 0;
+static int16_t wave_data = 0;
static int len;
@@ -155,7 +155,7 @@ static void toggle_wave_data(void )
wave_data = (wave_data == WAVE_HIGH) ? WAVE_LOW : WAVE_HIGH;
}
-static void cbm_output_wave( INT16 **buffer, int length )
+static void cbm_output_wave( int16_t **buffer, int length )
{
if (buffer == nullptr)
return;
@@ -168,7 +168,7 @@ static void cbm_output_wave( INT16 **buffer, int length )
}
-static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
+static int cbm_tap_do_work( int16_t **buffer, int length, const uint8_t *data )
{
int i, j = 0;
int size = 0;
@@ -179,7 +179,7 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
int tap_frequency = 0;
int byte_samples = 0;
- UINT8 over_pulse_bytes[3] = {0 , 0, 0 };
+ uint8_t over_pulse_bytes[3] = {0 , 0, 0 };
int over_pulse_length = 0;
/* These waveamp_* values are currently stored but not used.
Further investigations are needed to find real pulse amplitude
@@ -228,7 +228,7 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
for (i = CBM_HEADER_SIZE; i < length; i++)
{
- UINT8 byte = data[i];
+ uint8_t byte = data[i];
/* .TAP v0 */
/* Here is simple:
@@ -319,7 +319,7 @@ static int cbm_tap_do_work( INT16 **buffer, int length, const UINT8 *data )
}
-static int cbm_tap_to_wav_size( const UINT8 *tapdata, int taplen )
+static int cbm_tap_to_wav_size( const uint8_t *tapdata, int taplen )
{
int size = cbm_tap_do_work(nullptr, taplen, tapdata);
len = taplen;
@@ -327,11 +327,11 @@ static int cbm_tap_to_wav_size( const UINT8 *tapdata, int taplen )
return size;
}
-static int cbm_tap_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
+static int cbm_tap_fill_wave( int16_t *buffer, int length, uint8_t *bytes )
{
- INT16 *p = buffer;
+ int16_t *p = buffer;
- return cbm_tap_do_work(&p, len, (const UINT8 *)bytes);
+ return cbm_tap_do_work(&p, len, (const uint8_t *)bytes);
}
diff --git a/src/lib/formats/ccvf_dsk.cpp b/src/lib/formats/ccvf_dsk.cpp
index abce7fb55da..12acbeea37a 100644
--- a/src/lib/formats/ccvf_dsk.cpp
+++ b/src/lib/formats/ccvf_dsk.cpp
@@ -44,7 +44,7 @@ const ccvf_format::format ccvf_format::file_formats[] = {
{}
};
-int ccvf_format::identify(io_generic *io, UINT32 form_factor)
+int ccvf_format::identify(io_generic *io, uint32_t form_factor)
{
char h[36];
@@ -85,20 +85,20 @@ floppy_image_format_t::desc_e* ccvf_format::get_desc_8n1(const format &f, int &c
return desc;
}
-bool ccvf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool ccvf_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
const format &f = formats[0];
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> img(size);
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> img(size);
io_generic_read(io, &img[0], 0, size);
std::string ccvf = std::string((const char *)&img[0], size);
- std::vector<UINT8> bytes(78720);
+ std::vector<uint8_t> bytes(78720);
int start = 0, end = 0;
std::string line;
- UINT32 byteoffs = 0;
+ uint32_t byteoffs = 0;
char hex[3] = {0};
do {
@@ -115,11 +115,11 @@ bool ccvf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
start = end + 1;
} while (start > 0 && end != -1);
- UINT64 pos = 0;
+ uint64_t pos = 0;
int total_size = 200000000/f.cell_size;
for(int track=0; track < f.track_count; track++) {
- std::vector<UINT32> buffer;
+ std::vector<uint32_t> buffer;
int offset = 0;
for (int i=0; i<1920 && pos<size; i++, pos++) {
diff --git a/src/lib/formats/ccvf_dsk.h b/src/lib/formats/ccvf_dsk.h
index 671b0c0f88c..39922485b5c 100644
--- a/src/lib/formats/ccvf_dsk.h
+++ b/src/lib/formats/ccvf_dsk.h
@@ -16,8 +16,8 @@
class ccvf_format : public floppy_image_format_t {
public:
struct format {
- UINT32 form_factor; // See floppy_image for possible values
- UINT32 variant; // See floppy_image for possible values
+ uint32_t form_factor; // See floppy_image for possible values
+ uint32_t variant; // See floppy_image for possible values
int cell_size; // See floppy_image_format_t for details
int sector_count;
@@ -36,8 +36,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 supports_save() const override;
protected:
diff --git a/src/lib/formats/cgen_cas.cpp b/src/lib/formats/cgen_cas.cpp
index 17ad904c630..be4b9397f89 100644
--- a/src/lib/formats/cgen_cas.cpp
+++ b/src/lib/formats/cgen_cas.cpp
@@ -33,7 +33,7 @@ static int cas_size;
static int level;
-static int cgenie_output_byte(INT16 *buffer, int sample_count, UINT8 data)
+static int cgenie_output_byte(int16_t *buffer, int sample_count, uint8_t data)
{
int samples = 0;
@@ -58,7 +58,7 @@ static int cgenie_output_byte(INT16 *buffer, int sample_count, UINT8 data)
}
-static int cgenie_handle_cas(INT16 *buffer, const UINT8 *casdata)
+static int cgenie_handle_cas(int16_t *buffer, const uint8_t *casdata)
{
int data_pos, sample_count;
@@ -108,7 +108,7 @@ static int cgenie_handle_cas(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int cgenie_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int cgenie_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return cgenie_handle_cas(buffer, bytes);
}
@@ -117,7 +117,7 @@ static int cgenie_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int cgenie_cas_to_wav_size(const UINT8 *casdata, int caslen)
+static int cgenie_cas_to_wav_size(const uint8_t *casdata, int caslen)
{
cas_size = caslen;
diff --git a/src/lib/formats/coco_cas.cpp b/src/lib/formats/coco_cas.cpp
index cf711718a34..ba5186f539d 100644
--- a/src/lib/formats/coco_cas.cpp
+++ b/src/lib/formats/coco_cas.cpp
@@ -61,12 +61,12 @@ static cassette_image::error coco_cas_identify(cassette_image *cassette, struct
-static int get_cas_block(cassette_image *cassette, UINT64 *offset, UINT8 *block, int *block_len)
+static int get_cas_block(cassette_image *cassette, uint64_t *offset, uint8_t *block, int *block_len)
{
- UINT8 block_length = 0;
- UINT8 block_checksum = 0;
- UINT64 current_offset;
- UINT64 image_size;
+ uint8_t block_length = 0;
+ uint8_t block_checksum = 0;
+ uint64_t current_offset;
+ uint64_t image_size;
PAIR p;
int i;
int state = 0;
@@ -150,21 +150,21 @@ static int get_cas_block(cassette_image *cassette, UINT64 *offset, UINT8 *block,
-static cassette_image::error cas_load(cassette_image *cassette, UINT8 silence)
+static cassette_image::error cas_load(cassette_image *cassette, uint8_t silence)
{
cassette_image::error err;
- UINT64 offset;
- UINT64 image_size;
- UINT8 block[258]; /* 255 bytes per block + 3 (type, length, checksum) */
+ uint64_t offset;
+ uint64_t image_size;
+ uint8_t block[258]; /* 255 bytes per block + 3 (type, length, checksum) */
int block_length = 0;
- UINT8 last_blocktype;
+ uint8_t last_blocktype;
double time_index = 0.0;
double time_displacement;
- static const UINT8 magic_bytes[2] = { 0x55, 0x3C };
+ static const uint8_t magic_bytes[2] = { 0x55, 0x3C };
#if 0
{
- static const UINT8 dummy_bytes[] =
+ static const uint8_t dummy_bytes[] =
{
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
diff --git a/src/lib/formats/concept_dsk.cpp b/src/lib/formats/concept_dsk.cpp
index c23a3c35675..eea65064fc7 100644
--- a/src/lib/formats/concept_dsk.cpp
+++ b/src/lib/formats/concept_dsk.cpp
@@ -72,15 +72,15 @@ bool cc525dsdd_format::supports_save() const
return true;
}
-void cc525dsdd_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count)
+void cc525dsdd_format::find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
track_count = 77;
head_count = 2;
sector_count = 9;
- UINT32 expected_size = 512 * track_count*head_count*sector_count;
+ uint32_t expected_size = 512 * track_count*head_count*sector_count;
if (size == expected_size)
{
return;
@@ -89,9 +89,9 @@ void cc525dsdd_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head
track_count = head_count = sector_count = 0;
}
-int cc525dsdd_format::identify(io_generic *io, UINT32 form_factor)
+int cc525dsdd_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
if(track_count)
@@ -99,12 +99,12 @@ int cc525dsdd_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool cc525dsdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool cc525dsdd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
- UINT8 sectdata[10*512];
+ uint8_t sectdata[10*512];
desc_s sectors[10];
for(int i=0; i<sector_count; i++) {
sectors[i+1].data = sectdata + 512*i;
@@ -140,7 +140,7 @@ bool cc525dsdd_format::save(io_generic *io, floppy_image *image)
if(sector_count != 9)
sector_count = 9;
- UINT8 sectdata[9*512];
+ uint8_t sectdata[9*512];
int track_size = sector_count*512;
for(int track=0; track < track_count; track++) {
diff --git a/src/lib/formats/concept_dsk.h b/src/lib/formats/concept_dsk.h
index 87444c31ab0..d762bcb64c0 100644
--- a/src/lib/formats/concept_dsk.h
+++ b/src/lib/formats/concept_dsk.h
@@ -18,8 +18,8 @@ class cc525dsdd_format : public floppy_image_format_t
public:
cc525dsdd_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
@@ -30,7 +30,7 @@ public:
static const desc_e cc_9_desc[];
private:
- void find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count);
+ void find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count);
};
extern const floppy_format_type FLOPPY_CONCEPT_525DSDD_FORMAT;
diff --git a/src/lib/formats/coupedsk.cpp b/src/lib/formats/coupedsk.cpp
index f45222ae1ae..803f69bbbb7 100644
--- a/src/lib/formats/coupedsk.cpp
+++ b/src/lib/formats/coupedsk.cpp
@@ -64,9 +64,9 @@ bool mgt_format::supports_save() const
return true;
}
-int mgt_format::identify(io_generic *io, UINT32 form_factor)
+int mgt_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
if(/*size == 737280 || */ size == 819200)
return 50;
@@ -74,12 +74,12 @@ int mgt_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool mgt_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool mgt_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
int sector_count = size == 737280 ? 9 : 10;
- UINT8 sectdata[10*512];
+ uint8_t sectdata[10*512];
desc_s sectors[10];
for(int i=0; i<sector_count; i++) {
sectors[i].data = sectdata + 512*i;
@@ -109,7 +109,7 @@ bool mgt_format::save(io_generic *io, floppy_image *image)
else if(sector_count < 9)
sector_count = 9;
- UINT8 sectdata[10*512];
+ uint8_t sectdata[10*512];
int track_size = sector_count*512;
for(int head=0; head < 2; head++) {
diff --git a/src/lib/formats/coupedsk.h b/src/lib/formats/coupedsk.h
index 19f2d7ddac5..52d619ff6cd 100644
--- a/src/lib/formats/coupedsk.h
+++ b/src/lib/formats/coupedsk.h
@@ -18,8 +18,8 @@ class mgt_format : public floppy_image_format_t
public:
mgt_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
diff --git a/src/lib/formats/cqm_dsk.cpp b/src/lib/formats/cqm_dsk.cpp
index 94ba350c2a4..3c13f3d44b4 100644
--- a/src/lib/formats/cqm_dsk.cpp
+++ b/src/lib/formats/cqm_dsk.cpp
@@ -24,8 +24,8 @@ struct cqmdsk_tag
int interleave;
int skew;
- UINT8* buf;
- UINT64 track_offsets[84*2]; /* offset within data for each track */
+ uint8_t* buf;
+ uint64_t track_offsets[84*2]; /* offset within data for each track */
};
@@ -40,7 +40,7 @@ static struct cqmdsk_tag *get_tag(floppy_image_legacy *floppy)
FLOPPY_IDENTIFY( cqm_dsk_identify )
{
- UINT8 header[2];
+ uint8_t header[2];
floppy_image_read(floppy, header, 0, 2);
if (header[0]=='C' && header[1]=='Q') {
@@ -61,16 +61,16 @@ static int cqm_get_tracks_per_disk(floppy_image_legacy *floppy)
return get_tag(floppy)->tracks;
}
-static UINT64 cqm_get_track_offset(floppy_image_legacy *floppy, int head, int track)
+static uint64_t cqm_get_track_offset(floppy_image_legacy *floppy, int head, int track)
{
return get_tag(floppy)->track_offsets[(track<<1) + head];
}
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
- UINT64 pos = 0;
- UINT8 data;
- INT16 len;
+ uint64_t pos = 0;
+ uint8_t data;
+ int16_t len;
int s;
if ((head < 0) || (head >= get_tag(floppy)->heads) || (track < 0) || (track >= get_tag(floppy)->tracks)
@@ -103,7 +103,7 @@ static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, in
static floperr_t internal_cqm_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
// take sector offset
@@ -125,7 +125,7 @@ static floperr_t cqm_read_indexed_sector(floppy_image_legacy *floppy, int head,
return internal_cqm_read_sector(floppy, head, track, sector, TRUE, buffer, buflen);
}
-static floperr_t cqm_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t cqm_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
@@ -138,7 +138,7 @@ static floperr_t cqm_get_sector_length(floppy_image_legacy *floppy, int head, in
return FLOPPY_ERROR_SUCCESS;
}
-static floperr_t cqm_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t cqm_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
if (sector_index >= get_tag(floppy)->sector_per_track) return FLOPPY_ERROR_SEEKERROR;
@@ -163,9 +163,9 @@ FLOPPY_CONSTRUCT( cqm_dsk_construct )
{
struct FloppyCallbacks *callbacks;
struct cqmdsk_tag *tag;
- UINT8 header[CQM_HEADER_SIZE];
- UINT64 pos = 0;
- INT16 len;
+ uint8_t header[CQM_HEADER_SIZE];
+ uint64_t pos = 0;
+ int16_t len;
int head;
int track;
int s;
@@ -194,7 +194,7 @@ FLOPPY_CONSTRUCT( cqm_dsk_construct )
pos = CQM_HEADER_SIZE + (header[0x70] << 8) + header[0x6f];
track = 0;
head = 0;
- tag->buf = (UINT8*)malloc(tag->sector_size*tag->sector_per_track);
+ tag->buf = (uint8_t*)malloc(tag->sector_size*tag->sector_per_track);
do {
tag->track_offsets[(track<<1) + head] = pos;
s = 0;
@@ -261,9 +261,9 @@ const char *cqm_format::extensions() const
return "cqm,cqi,dsk";
}
-int cqm_format::identify(io_generic *io, UINT32 form_factor)
+int cqm_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[3];
+ uint8_t h[3];
io_generic_read(io, h, 0, 3);
if (h[0] == 'C' && h[1] == 'Q' && h[2] == 0x14)
@@ -272,11 +272,11 @@ int cqm_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool cqm_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool cqm_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
const int max_size = 4*1024*1024; // 4MB ought to be large enough for any floppy
- std::vector<UINT8> imagebuf(max_size);
- UINT8 header[CQM_HEADER_SIZE];
+ std::vector<uint8_t> imagebuf(max_size);
+ uint8_t header[CQM_HEADER_SIZE];
io_generic_read(io, header, 0, CQM_HEADER_SIZE);
int sector_size = (header[0x04] << 8) | header[0x03];
@@ -318,13 +318,13 @@ bool cqm_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int base_cell_count = rate*60/rpm;
int cqm_size = io_generic_size(io);
- std::vector<UINT8> cqmbuf(cqm_size);
+ std::vector<uint8_t> cqmbuf(cqm_size);
io_generic_read(io, &cqmbuf[0], 0, cqm_size);
// decode the RLE data
for (int s = 0, pos = CQM_HEADER_SIZE + comment_size; pos < cqm_size; )
{
- INT16 len = (cqmbuf[pos + 1] << 8) | cqmbuf[pos];
+ int16_t len = (cqmbuf[pos + 1] << 8) | cqmbuf[pos];
pos += 2;
if(len < 0)
{
diff --git a/src/lib/formats/cqm_dsk.h b/src/lib/formats/cqm_dsk.h
index 48bc8d5521c..7ae12ccff2b 100644
--- a/src/lib/formats/cqm_dsk.h
+++ b/src/lib/formats/cqm_dsk.h
@@ -18,8 +18,8 @@ class cqm_format : public floppy_image_format_t
public:
cqm_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
diff --git a/src/lib/formats/csw_cas.cpp b/src/lib/formats/csw_cas.cpp
index 0790dd16dee..a8feccf5300 100644
--- a/src/lib/formats/csw_cas.cpp
+++ b/src/lib/formats/csw_cas.cpp
@@ -32,32 +32,32 @@ Offset Value Type Description
#define CSW_WAV_FREQUENCY 44100
-static const UINT8 CSW_HEADER[] = { "Compressed Square Wave" };
+static const uint8_t CSW_HEADER[] = { "Compressed Square Wave" };
-static UINT32 get_leuint32(const void *ptr)
+static uint32_t get_leuint32(const void *ptr)
{
- UINT32 value;
+ uint32_t value;
memcpy(&value, ptr, sizeof(value));
return little_endianize_int32(value);
}
static int mycaslen;
-static int csw_cas_to_wav_size( const UINT8 *casdata, int caslen )
+static int csw_cas_to_wav_size( const uint8_t *casdata, int caslen )
{
- UINT32 SampleRate;
- UINT32 NumberOfPulses;
- UINT8 MajorRevision;
- UINT8 MinorRevision;
- UINT8 CompressionType;
- UINT8 Flags;
- UINT8 HeaderExtensionLength;
- std::vector<UINT8> gz_ptr;
+ uint32_t SampleRate;
+ uint32_t NumberOfPulses;
+ uint8_t MajorRevision;
+ uint8_t MinorRevision;
+ uint8_t CompressionType;
+ uint8_t Flags;
+ uint8_t HeaderExtensionLength;
+ std::vector<uint8_t> gz_ptr;
int total_size;
z_stream d_stream;
int err;
- UINT8 *in_ptr;
+ uint8_t *in_ptr;
int bsize=0;
if ( memcmp( casdata, CSW_HEADER, sizeof(CSW_HEADER)-1 ) )
@@ -98,7 +98,7 @@ static int csw_cas_to_wav_size( const UINT8 *casdata, int caslen )
mycaslen=caslen;
//from here on down for now I am assuming it is compressed csw file.
- in_ptr = (UINT8*) casdata+0x34+HeaderExtensionLength;
+ in_ptr = (uint8_t*) casdata+0x34+HeaderExtensionLength;
gz_ptr.resize( 8 );
@@ -163,20 +163,20 @@ cleanup:
return -1;
}
-static int csw_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
+static int csw_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes )
{
- UINT32 SampleRate;
- UINT32 NumberOfPulses;
- UINT8 CompressionType;
- UINT8 Flags;
- UINT8 HeaderExtensionLength;
- INT8 Bit;
-
- std::vector<UINT8> gz_ptr;
+ uint32_t SampleRate;
+ uint32_t NumberOfPulses;
+ uint8_t CompressionType;
+ uint8_t Flags;
+ uint8_t HeaderExtensionLength;
+ int8_t Bit;
+
+ std::vector<uint8_t> gz_ptr;
int total_size;
z_stream d_stream;
int err;
- UINT8 *in_ptr;
+ uint8_t *in_ptr;
int bsize=0;
int i;
@@ -206,7 +206,7 @@ static int csw_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
//from here on down for now I am assuming it is compressed csw file.
- in_ptr = (UINT8*) bytes+0x34+HeaderExtensionLength;
+ in_ptr = (uint8_t*) bytes+0x34+HeaderExtensionLength;
gz_ptr.resize( 8 );
@@ -288,7 +288,7 @@ static const struct CassetteLegacyWaveFiller csw_legacy_fill_wave = {
static cassette_image::error csw_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts )
{
- UINT8 header[22];
+ uint8_t header[22];
cassette_image_read(cassette, header, 0, sizeof(header));
if (memcmp(&header[0], CSW_HEADER, sizeof(CSW_HEADER) - 1)) {
diff --git a/src/lib/formats/d64_dsk.cpp b/src/lib/formats/d64_dsk.cpp
index 2cece44c43a..f26a3e676fb 100644
--- a/src/lib/formats/d64_dsk.cpp
+++ b/src/lib/formats/d64_dsk.cpp
@@ -51,7 +51,7 @@ const d64_format::format d64_format::file_formats[] = {
{}
};
-const UINT32 d64_format::cell_size[] =
+const uint32_t d64_format::cell_size[] =
{
4000, // 16MHz/16/4
3750, // 16MHz/15/4
@@ -79,20 +79,20 @@ const int d64_format::speed_zone[] =
0, 0 // 41-42
};
-int d64_format::find_size(io_generic *io, UINT32 form_factor) const
+int d64_format::find_size(io_generic *io, uint32_t form_factor) const
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].sector_count; i++) {
const format &f = formats[i];
- if(size == (UINT32) f.sector_count*f.sector_base_size*f.head_count)
+ if(size == (uint32_t) f.sector_count*f.sector_base_size*f.head_count)
return i;
- if(size == (UINT32) (f.sector_count*f.sector_base_size*f.head_count) + f.sector_count)
+ if(size == (uint32_t) (f.sector_count*f.sector_base_size*f.head_count) + f.sector_count)
return i;
}
return -1;
}
-int d64_format::identify(io_generic *io, UINT32 form_factor)
+int d64_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -114,9 +114,9 @@ int d64_format::get_disk_id_offset(const format &f)
return 0x165a2;
}
-void d64_format::get_disk_id(const format &f, io_generic *io, UINT8 &id1, UINT8 &id2)
+void d64_format::get_disk_id(const format &f, io_generic *io, uint8_t &id1, uint8_t &id2)
{
- UINT8 id[2];
+ uint8_t id[2];
io_generic_read(io, id, get_disk_id_offset(f), 2);
id1 = id[0];
id2 = id[1];
@@ -141,7 +141,7 @@ int d64_format::compute_track_size(const format &f, int track)
return this->get_sectors_per_track(f, track) * f.sector_base_size;
}
-UINT32 d64_format::get_cell_size(const format &f, int track)
+uint32_t d64_format::get_cell_size(const format &f, int track)
{
return cell_size[speed_zone[track]];
}
@@ -151,7 +151,7 @@ int d64_format::get_sectors_per_track(const format &f, int track)
return sectors_per_track[track];
}
-floppy_image_format_t::desc_e* d64_format::get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2)
+floppy_image_format_t::desc_e* d64_format::get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2)
{
static floppy_image_format_t::desc_e desc[] = {
/* 00 */ { SECTOR_LOOP_START, 0, -1 },
@@ -186,7 +186,7 @@ floppy_image_format_t::desc_e* d64_format::get_sector_desc(const format &f, int
return desc;
}
-void d64_format::build_sector_description(const format &f, UINT8 *sectdata, UINT32 sect_offs, UINT32 error_offs, desc_s *sectors, int sector_count) const
+void d64_format::build_sector_description(const format &f, uint8_t *sectdata, uint32_t sect_offs, uint32_t error_offs, desc_s *sectors, int sector_count) const
{
for (int i = 0; i < sector_count; i++) {
sectors[i].data = sectdata + sect_offs;
@@ -206,7 +206,7 @@ void d64_format::fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_
desc[22].p1 >>= remaining_size & 0x01;
}
-bool d64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool d64_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int type = find_size(io, form_factor);
if(type == -1)
@@ -214,10 +214,10 @@ bool d64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
const format &f = formats[type];
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> img;
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> img;
- if(size == (UINT32)f.sector_count*f.sector_base_size) {
+ if(size == (uint32_t)f.sector_count*f.sector_base_size) {
img.resize(size + f.sector_count);
memset(&img[0], ERROR_00, size + f.sector_count);
}
@@ -229,7 +229,7 @@ bool d64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int track_offset = 0, error_offset = f.sector_count*f.sector_base_size;
- UINT8 id1 = 0, id2 = 0;
+ uint8_t id1 = 0, id2 = 0;
get_disk_id(f, io, id1, id2);
for (int head = 0; head < f.head_count; head++) {
@@ -272,7 +272,7 @@ bool d64_format::save(io_generic *io, floppy_image *image)
for(int track=0; track < f.track_count; track++) {
int sector_count = this->get_sectors_per_track(f, track);
int track_size = compute_track_size(f, track);
- UINT8 sectdata[40*256] = { 0 };
+ uint8_t sectdata[40*256] = { 0 };
desc_s sectors[40];
int offset = get_image_offset(f, head, track);
@@ -287,8 +287,8 @@ bool d64_format::save(io_generic *io, floppy_image *image)
void d64_format::extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head, int sector_count)
{
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int physical_track = this->get_physical_track(f, head, track);
int cell_size = this->get_cell_size(f, track);
@@ -305,7 +305,7 @@ void d64_format::extract_sectors(floppy_image *image, const format &f, desc_s *s
memset((void *)ds.data, 0, ds.size);
else if(xs.size < ds.size) {
memcpy((void *)ds.data, xs.data, xs.size);
- memset((UINT8 *)ds.data + xs.size, 0, xs.size - ds.size);
+ memset((uint8_t *)ds.data + xs.size, 0, xs.size - ds.size);
} else
memcpy((void *)ds.data, xs.data, ds.size);
}
diff --git a/src/lib/formats/d64_dsk.h b/src/lib/formats/d64_dsk.h
index c5bef4b3313..28726332fa3 100644
--- a/src/lib/formats/d64_dsk.h
+++ b/src/lib/formats/d64_dsk.h
@@ -16,15 +16,15 @@
class d64_format : public floppy_image_format_t {
public:
struct format {
- UINT32 form_factor; // See floppy_image for possible values
- UINT32 variant; // See floppy_image for possible values
-
- UINT16 sector_count;
- UINT8 track_count;
- UINT8 head_count;
- UINT16 sector_base_size;
- UINT8 gap_1;
- UINT8 gap_2;
+ uint32_t form_factor; // See floppy_image for possible values
+ uint32_t variant; // See floppy_image for possible values
+
+ uint16_t sector_count;
+ uint8_t track_count;
+ uint8_t head_count;
+ uint16_t sector_base_size;
+ uint8_t gap_1;
+ uint8_t gap_2;
};
d64_format();
@@ -34,8 +34,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 bool supports_save() const override { return true; }
@@ -58,23 +58,23 @@ protected:
const format *formats;
- int find_size(io_generic *io, UINT32 form_factor) const;
+ int find_size(io_generic *io, uint32_t form_factor) const;
virtual int get_physical_track(const format &f, int head, int track);
- virtual UINT32 get_cell_size(const format &f, int track);
+ virtual uint32_t get_cell_size(const format &f, int track);
virtual int get_sectors_per_track(const format &f, int track);
virtual int get_disk_id_offset(const format &f);
- void get_disk_id(const format &f, io_generic *io, UINT8 &id1, UINT8 &id2);
+ void get_disk_id(const format &f, io_generic *io, uint8_t &id1, uint8_t &id2);
virtual int get_image_offset(const format &f, int head, int track);
int compute_track_size(const format &f, int track);
virtual int get_gap2(const format &f, int head, int track) { return f.gap_2; }
- virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2);
- void build_sector_description(const format &f, UINT8 *sectdata, UINT32 sect_offs, UINT32 error_offs, desc_s *sectors, int sector_count) const;
+ virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2);
+ void build_sector_description(const format &f, uint8_t *sectdata, uint32_t sect_offs, uint32_t error_offs, desc_s *sectors, int sector_count) const;
virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size);
void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head, int sector_count);
static const format file_formats[];
- static const UINT32 cell_size[];
+ static const uint32_t cell_size[];
static const int sectors_per_track[];
static const int speed_zone[];
};
diff --git a/src/lib/formats/d80_dsk.cpp b/src/lib/formats/d80_dsk.cpp
index 12ea14ad80f..e08ef22f6b9 100644
--- a/src/lib/formats/d80_dsk.cpp
+++ b/src/lib/formats/d80_dsk.cpp
@@ -42,7 +42,7 @@ const d80_format::format d80_format::file_formats[] = {
{}
};
-const UINT32 d80_format::d80_cell_size[] =
+const uint32_t d80_format::d80_cell_size[] =
{
2667, // 12MHz/2/16
2500, // 12MHz/2/15
@@ -75,7 +75,7 @@ int d80_format::get_physical_track(const format &f, int head, int track)
return track;
}
-UINT32 d80_format::get_cell_size(const format &f, int track)
+uint32_t d80_format::get_cell_size(const format &f, int track)
{
return d80_cell_size[d80_speed_zone[track]];
}
@@ -91,7 +91,7 @@ int d80_format::get_disk_id_offset(const format &f)
return 0x44e18;
}
-floppy_image_format_t::desc_e* d80_format::get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2)
+floppy_image_format_t::desc_e* d80_format::get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2)
{
static floppy_image_format_t::desc_e desc[] = {
/* 00 */ { SECTOR_LOOP_START, 0, -1 },
diff --git a/src/lib/formats/d80_dsk.h b/src/lib/formats/d80_dsk.h
index d823b85a9bc..4f6482efffe 100644
--- a/src/lib/formats/d80_dsk.h
+++ b/src/lib/formats/d80_dsk.h
@@ -26,15 +26,15 @@ protected:
const format *formats;
virtual int get_physical_track(const format &f, int head, int track) override;
- virtual UINT32 get_cell_size(const format &f, int track) override;
+ virtual uint32_t get_cell_size(const format &f, int track) override;
virtual int get_sectors_per_track(const format &f, int track) override;
virtual int get_disk_id_offset(const format &f) override;
- virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2) override;
+ virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, uint8_t id1, uint8_t id2, int gap_2) override;
virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size) override;
static const format file_formats[];
- static const UINT32 d80_cell_size[];
+ static const uint32_t d80_cell_size[];
static const int d80_speed_zone[];
static const int d80_sectors_per_track[];
};
diff --git a/src/lib/formats/d88_dsk.cpp b/src/lib/formats/d88_dsk.cpp
index 21c73fec5c0..cc95dcedb69 100644
--- a/src/lib/formats/d88_dsk.cpp
+++ b/src/lib/formats/d88_dsk.cpp
@@ -38,11 +38,11 @@
struct d88_tag
{
- UINT32 image_size;
- UINT32 trackoffset[164];
- UINT8 write_protect;
- UINT8 disk_type;
- UINT8 heads;
+ uint32_t image_size;
+ uint32_t trackoffset[164];
+ uint8_t write_protect;
+ uint8_t disk_type;
+ uint8_t heads;
};
static struct d88_tag *get_d88_tag(floppy_image_legacy *floppy)
@@ -53,8 +53,8 @@ static struct d88_tag *get_d88_tag(floppy_image_legacy *floppy)
static int d88_get_sector_id(floppy_image_legacy *floppy, int head, int track, int sector_index)
{
struct d88_tag* tag = get_d88_tag(floppy);
- UINT32 offset;
- UINT8 sector_hdr[16];
+ uint32_t offset;
+ uint8_t sector_hdr[16];
int x;
offset = tag->trackoffset[(track*tag->heads)+head];
@@ -91,8 +91,8 @@ static int d88_get_heads_per_disk(floppy_image_legacy *floppy)
static int d88_get_sectors_per_track(floppy_image_legacy *floppy, int head, int track)
{
struct d88_tag* tag = get_d88_tag(floppy);
- UINT32 offset;
- UINT8 sector_hdr[16];
+ uint32_t offset;
+ uint8_t sector_hdr[16];
offset = tag->trackoffset[(track*tag->heads)+head];
@@ -101,12 +101,12 @@ static int d88_get_sectors_per_track(floppy_image_legacy *floppy, int head, int
return sector_hdr[4];
}
-static floperr_t d88_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t d88_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
struct d88_tag* tag = get_d88_tag(floppy);
- UINT32 offset;
- UINT8 sector_hdr[16];
- UINT32 len;
+ uint32_t offset;
+ uint8_t sector_hdr[16];
+ uint32_t len;
int count,secs;
offset = tag->trackoffset[(track*tag->heads)+head];
@@ -131,20 +131,20 @@ static floperr_t d88_get_sector_length(floppy_image_legacy *floppy, int head, in
return FLOPPY_ERROR_SEEKERROR;
}
-static floperr_t d88_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen)
+static floperr_t d88_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen)
{
// floperr_t err;
return FLOPPY_ERROR_UNSUPPORTED;
}
-static UINT32 d88_get_sector_offset(floppy_image_legacy* floppy, int head, int track, int sector)
+static uint32_t d88_get_sector_offset(floppy_image_legacy* floppy, int head, int track, int sector)
{
struct d88_tag* tag = get_d88_tag(floppy);
- UINT32 offset = 0;
- UINT8 sector_hdr[16];
- UINT32 len;
- UINT32 secs;
+ uint32_t offset = 0;
+ uint8_t sector_hdr[16];
+ uint32_t len;
+ uint32_t secs;
int count;
// get offset of the beginning of the track
@@ -169,11 +169,11 @@ static UINT32 d88_get_sector_offset(floppy_image_legacy* floppy, int head, int t
return 0;
}
-static floperr_t d88_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t d88_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
struct d88_tag* tag = get_d88_tag(floppy);
- UINT32 offset;
- UINT8 sector_hdr[16];
+ uint32_t offset;
+ uint8_t sector_hdr[16];
int x;
offset = tag->trackoffset[(track*tag->heads)+head];
@@ -216,8 +216,8 @@ static floperr_t d88_get_indexed_sector_info(floppy_image_legacy *floppy, int he
static floperr_t d88_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
{
- UINT64 offset;
- UINT32 sector_length;
+ uint64_t offset;
+ uint32_t sector_length;
offset = d88_get_sector_offset(floppy,head,track,sector);
@@ -245,8 +245,8 @@ static floperr_t d88_read_indexed_sector(floppy_image_legacy *floppy, int head,
static floperr_t d88_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
{
- UINT64 offset;
- UINT32 sector_length;
+ uint64_t offset;
+ uint32_t sector_length;
offset = d88_get_sector_offset(floppy,head,track,sector);
@@ -272,9 +272,9 @@ static floperr_t d88_write_indexed_sector(floppy_image_legacy *floppy, int head,
return d88_write_sector(floppy,head,track,sec,buffer,buflen,ddam);
}
-static void d88_get_header(floppy_image_legacy* floppy,UINT32* size, UINT8* prot, UINT8* type, UINT32* offsets)
+static void d88_get_header(floppy_image_legacy* floppy,uint32_t* size, uint8_t* prot, uint8_t* type, uint32_t* offsets)
{
- UINT8 header[D88_HEADER_LEN];
+ uint8_t header[D88_HEADER_LEN];
int x,s;
floppy_image_read(floppy,header,0,D88_HEADER_LEN);
@@ -282,8 +282,8 @@ static void d88_get_header(floppy_image_legacy* floppy,UINT32* size, UINT8* prot
#ifdef SPOT_DUPLICATES
// there exist many .d88 files with same data and different headers and
// this allows to spot duplicates, making easier to debug softlists.
- UINT32 temp_size = floppy_image_size(floppy);
- UINT8 tmp_copy[temp_size - D88_HEADER_LEN];
+ uint32_t temp_size = floppy_image_size(floppy);
+ uint8_t tmp_copy[temp_size - D88_HEADER_LEN];
floppy_image_read(floppy,tmp_copy,D88_HEADER_LEN,temp_size - D88_HEADER_LEN);
printf("CRC16: %d\n", ccitt_crc16(0xffff, tmp_copy, temp_size - D88_HEADER_LEN));
#endif
@@ -317,7 +317,7 @@ static void d88_get_header(floppy_image_legacy* floppy,UINT32* size, UINT8* prot
FLOPPY_IDENTIFY(d88_dsk_identify)
{
- UINT32 size;
+ uint32_t size;
d88_get_header(floppy,&size,nullptr,nullptr,nullptr);
@@ -336,9 +336,9 @@ FLOPPY_CONSTRUCT(d88_dsk_construct)
{
struct FloppyCallbacks *callbacks;
struct d88_tag *tag;
- UINT32 size;
- UINT8 prot,type = 0;
- UINT32 offs[164];
+ uint32_t size;
+ uint8_t prot,type = 0;
+ uint32_t offs[164];
int x;
if(params)
@@ -414,22 +414,22 @@ const char *d88_format::extensions() const
return "d77,d88,1dd";
}
-int d88_format::identify(io_generic *io, UINT32 form_factor)
+int d88_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
- UINT8 h[32];
+ uint64_t size = io_generic_size(io);
+ uint8_t h[32];
io_generic_read(io, h, 0, 32);
- if((little_endianize_int32(*(UINT32 *)(h+0x1c)) == size) &&
+ if((little_endianize_int32(*(uint32_t *)(h+0x1c)) == size) &&
(h[0x1b] == 0x00 || h[0x1b] == 0x10 || h[0x1b] == 0x20 || h[0x1b] == 0x30 || h[0x1b] == 0x40))
return 100;
return 0;
}
-bool d88_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool d88_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 h[32];
+ uint8_t h[32];
io_generic_read(io, h, 0, 32);
@@ -476,7 +476,7 @@ bool d88_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if(!head_count)
return false;
- UINT32 track_pos[164];
+ uint32_t track_pos[164];
io_generic_read(io, track_pos, 32, 164*4);
for(int track=0; track < track_count; track++)
@@ -486,17 +486,17 @@ bool d88_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
continue;
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
int sdatapos = 0;
int sector_count = 1;
for(int i=0; i<sector_count; i++) {
- UINT8 hs[16];
+ uint8_t hs[16];
io_generic_read(io, hs, pos, 16);
pos += 16;
- UINT16 size = little_endianize_int16(*(UINT16 *)(hs+14));
+ uint16_t size = little_endianize_int16(*(uint16_t *)(hs+14));
if(i == 0) {
- sector_count = little_endianize_int16(*(UINT16 *)(hs+4));
+ sector_count = little_endianize_int16(*(uint16_t *)(hs+4));
// Support broken vfman converter
if(sector_count == 0x1000)
sector_count = 0x10;
diff --git a/src/lib/formats/d88_dsk.h b/src/lib/formats/d88_dsk.h
index 2ab8db763f6..5ba52c4fe45 100644
--- a/src/lib/formats/d88_dsk.h
+++ b/src/lib/formats/d88_dsk.h
@@ -19,8 +19,8 @@ class d88_format : public floppy_image_format_t
public:
d88_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
diff --git a/src/lib/formats/dcp_dsk.cpp b/src/lib/formats/dcp_dsk.cpp
index 4e2c305e6f6..179552409f8 100644
--- a/src/lib/formats/dcp_dsk.cpp
+++ b/src/lib/formats/dcp_dsk.cpp
@@ -43,10 +43,10 @@ const char *dcp_format::extensions() const
return "dcp,dcu";
}
-int dcp_format::identify(io_generic *io, UINT32 form_factor)
+int dcp_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
- UINT8 h[0xa2];
+ uint64_t size = io_generic_size(io);
+ uint8_t h[0xa2];
int heads, tracks, spt, bps, count_tracks = 0;
bool is_hdb = false;
@@ -112,9 +112,9 @@ int dcp_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool dcp_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dcp_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 h[0xa2];
+ uint8_t h[0xa2];
int heads, tracks, spt, bps;
bool is_hdb = false;
@@ -208,7 +208,7 @@ bool dcp_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for (ssize = 0; (128 << ssize) < bps; ssize++) {};
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
if (!is_hdb)
{
@@ -269,7 +269,7 @@ bool dcp_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
build_pc_track_mfm(0, 1, image, cell_count, spt, sects, calc_default_pc_gap3_size(form_factor, bps));
// Read other tracks as usual
- UINT32 data_offs = 0xa2 + (26 * 0x80) + (26 * 0x100);
+ uint32_t data_offs = 0xa2 + (26 * 0x80) + (26 * 0x100);
for (int track = 1; track < tracks; track++)
for (int head = 0; head < heads; head++)
{
diff --git a/src/lib/formats/dcp_dsk.h b/src/lib/formats/dcp_dsk.h
index 92e447741f5..940a8aca931 100644
--- a/src/lib/formats/dcp_dsk.h
+++ b/src/lib/formats/dcp_dsk.h
@@ -19,8 +19,8 @@ class dcp_format : public floppy_image_format_t
public:
dcp_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/dfi_dsk.cpp b/src/lib/formats/dfi_dsk.cpp
index dae3d737b67..6c9f32cbb31 100644
--- a/src/lib/formats/dfi_dsk.cpp
+++ b/src/lib/formats/dfi_dsk.cpp
@@ -55,7 +55,7 @@ bool dfi_format::supports_save() const
return false;
}
-int dfi_format::identify(io_generic *io, UINT32 form_factor)
+int dfi_format::identify(io_generic *io, uint32_t form_factor)
{
char sign[4];
io_generic_read(io, sign, 0, 4);
@@ -64,21 +64,21 @@ int dfi_format::identify(io_generic *io, UINT32 form_factor)
return memcmp(sign, "DFE2", 4) ? 0 : 100;
}
-bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dfi_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
- UINT64 pos = 4;
- std::vector<UINT8> data;
+ uint64_t size = io_generic_size(io);
+ uint64_t pos = 4;
+ std::vector<uint8_t> data;
int onerev_time = 0; // time for one revolution, used to guess clock and rpm for DFE2 files
unsigned long clock_rate = 100000000; // sample clock rate in megahertz
int rpm=360; // drive rpm
while(pos < size) {
- UINT8 h[10];
+ uint8_t h[10];
io_generic_read(io, h, pos, 10);
- UINT16 track = (h[0] << 8) | h[1];
- UINT16 head = (h[2] << 8) | h[3];
+ uint16_t track = (h[0] << 8) | h[1];
+ uint16_t head = (h[2] << 8) | h[3];
// Ignore sector
- UINT32 tsize = (h[6] << 24) | (h[7] << 16) | (h[8] << 8) | h[9];
+ uint32_t tsize = (h[6] << 24) | (h[7] << 16) | (h[8] << 8) | h[9];
// if the position-so-far-in-file plus 10 (for the header) plus track size
// is larger than the size of the file, free buffers and bail out
@@ -98,7 +98,7 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
//int index_polarity = 1; // current polarity of index, starts high
int total_time = 0; // total sampled time per track
for(int i=0; i<tsize; i++) {
- UINT8 v = data[i];
+ uint8_t v = data[i];
if (v == 0xFF) { fprintf(stderr,"DFI stream contained a 0xFF at t%d, position%d, THIS SHOULD NEVER HAPPEN! Bailing out!\n", track, i); exit(1); }
if((v & 0x7f) == 0x7f)
total_time += 0x7f;
@@ -149,7 +149,7 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if(!index_time)
index_time = total_time;
- std::vector<UINT32> &buf = image->get_buffer(track, head);
+ std::vector<uint32_t> &buf = image->get_buffer(track, head);
buf.resize(tsize);
int cur_time = 0;
@@ -162,11 +162,11 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
#endif
index_count = 0;
//index_polarity = 0;
- UINT32 mg = floppy_image::MG_A;
+ uint32_t mg = floppy_image::MG_A;
int tpos = 0;
buf[tpos++] = mg;
for(int i=0; i<tsize; i++) {
- UINT8 v = data[i];
+ uint8_t v = data[i];
if((v & 0x7f) == 0x7f) // 0x7F : no transition, but a carry (FF is a board-on-fire error and is checked for above)
cur_time += 0x7f;
else if(v & 0x80) { // 0x80 set, note the index (TODO: actually do this!) and add number to count
@@ -188,7 +188,7 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
// the normal case: write the transition at the appropriate time
if ((prev_time == 0) || ((trans_time > MIN_THRESH) && (trans_time <= MAX_THRESH))) {
mg = mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
- buf[tpos++] = mg | UINT32((200000000ULL*cur_time)/index_time);
+ buf[tpos++] = mg | uint32_t((200000000ULL*cur_time)/index_time);
prev_time = cur_time;
}
// the long case: we probably missed a transition, stuff an extra guessed one in there to see if it helps
@@ -196,14 +196,14 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
mg = mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
if (((track%2)==0)&&(head==0)) fprintf(stderr,"missed transition, total time for transition is %d\n",trans_time);
#ifndef FAKETRANS_ONE
- buf[tpos++] = mg | UINT32((200000000ULL*(cur_time-(trans_time/2)))/index_time); // generate imaginary transition at half period
+ buf[tpos++] = mg | uint32_t((200000000ULL*(cur_time-(trans_time/2)))/index_time); // generate imaginary transition at half period
#else
- buf[tpos++] = mg | UINT32((200000000ULL*(cur_time-((trans_time*2)/3)))/index_time);
+ buf[tpos++] = mg | uint32_t((200000000ULL*(cur_time-((trans_time*2)/3)))/index_time);
mg = mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
- buf[tpos++] = mg | UINT32((200000000ULL*(cur_time-(trans_time/3)))/index_time);
+ buf[tpos++] = mg | uint32_t((200000000ULL*(cur_time-(trans_time/3)))/index_time);
#endif
mg = mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
- buf[tpos++] = mg | UINT32(200000000ULL*cur_time/index_time); // generate transition now
+ buf[tpos++] = mg | uint32_t(200000000ULL*cur_time/index_time); // generate transition now
prev_time = cur_time;
}
}
diff --git a/src/lib/formats/dfi_dsk.h b/src/lib/formats/dfi_dsk.h
index b25278275f3..030776a9b4f 100644
--- a/src/lib/formats/dfi_dsk.h
+++ b/src/lib/formats/dfi_dsk.h
@@ -10,8 +10,8 @@ class dfi_format : public floppy_image_format_t
public:
dfi_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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);
virtual const char *name() const override;
diff --git a/src/lib/formats/dim_dsk.cpp b/src/lib/formats/dim_dsk.cpp
index 42668b39faf..67c04adc2bf 100644
--- a/src/lib/formats/dim_dsk.cpp
+++ b/src/lib/formats/dim_dsk.cpp
@@ -16,9 +16,9 @@
FLOPPY_IDENTIFY(dim_dsk_identify)
{
- UINT8 dim_header[16];
+ uint8_t dim_header[16];
- floppy_image_read(floppy, (UINT8*)dim_header,0xab,16);
+ floppy_image_read(floppy, (uint8_t*)dim_header,0xab,16);
if(strncmp((const char*)dim_header,"DIFC HEADER",11) == 0)
*vote = 100;
@@ -36,9 +36,9 @@ FLOPPY_CONSTRUCT(dim_dsk_construct)
int sectors = 8; // per track
int sectorlen = 1024;
int firstsector = 0x01;
- UINT8 format_tmp;
+ uint8_t format_tmp;
int x;
- UINT16 temp;
+ uint16_t temp;
if(params)
{
@@ -132,9 +132,9 @@ const char *dim_format::extensions() const
return "dim";
}
-int dim_format::identify(io_generic *io, UINT32 form_factor)
+int dim_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[16];
+ uint8_t h[16];
io_generic_read(io, h, 0xab, 16);
@@ -144,11 +144,11 @@ int dim_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool dim_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dim_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int offset = 0x100;
- UINT8 h;
- UINT8 track_total = 77;
+ uint8_t h;
+ uint8_t track_total = 77;
int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666;
io_generic_read(io, &h, 0, 1);
@@ -192,7 +192,7 @@ bool dim_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for(int track=0; track < track_total; track++)
for(int head=0; head < 2; head++) {
desc_pc_sector sects[30];
- UINT8 sect_data[10000];
+ uint8_t sect_data[10000];
int sdatapos = 0;
for(int i=0; i<spt; i++) {
sects[i].track = track;
diff --git a/src/lib/formats/dim_dsk.h b/src/lib/formats/dim_dsk.h
index 54f84aff471..3529c84253d 100644
--- a/src/lib/formats/dim_dsk.h
+++ b/src/lib/formats/dim_dsk.h
@@ -24,8 +24,8 @@ class dim_format : public floppy_image_format_t
public:
dim_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
diff --git a/src/lib/formats/dip_dsk.cpp b/src/lib/formats/dip_dsk.cpp
index 9e6570f8071..310eab56a73 100644
--- a/src/lib/formats/dip_dsk.cpp
+++ b/src/lib/formats/dip_dsk.cpp
@@ -37,9 +37,9 @@ const char *dip_format::extensions() const
return "dip";
}
-int dip_format::identify(io_generic *io, UINT32 form_factor)
+int dip_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
if (size == 0x134000 + 0x100)
return 100;
@@ -47,7 +47,7 @@ int dip_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool dip_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dip_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int heads, tracks, spt, bps;
@@ -64,7 +64,7 @@ bool dip_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for (ssize = 0; (128 << ssize) < bps; ssize++) {};
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
for (int track = 0; track < tracks; track++)
for (int head = 0; head < heads; head++)
diff --git a/src/lib/formats/dip_dsk.h b/src/lib/formats/dip_dsk.h
index dba5e4afee9..2f392ff8ab2 100644
--- a/src/lib/formats/dip_dsk.h
+++ b/src/lib/formats/dip_dsk.h
@@ -19,8 +19,8 @@ class dip_format : public floppy_image_format_t
public:
dip_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/dmk_dsk.cpp b/src/lib/formats/dmk_dsk.cpp
index aa37206f736..5ca0a3b8781 100644
--- a/src/lib/formats/dmk_dsk.cpp
+++ b/src/lib/formats/dmk_dsk.cpp
@@ -41,12 +41,12 @@ const char *dmk_format::extensions() const
}
-int dmk_format::identify(io_generic *io, UINT32 form_factor)
+int dmk_format::identify(io_generic *io, uint32_t form_factor)
{
const int header_size = 16;
- UINT8 header[header_size];
+ uint8_t header[header_size];
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
io_generic_read(io, header, 0, header_size);
@@ -81,10 +81,10 @@ int dmk_format::identify(io_generic *io, UINT32 form_factor)
}
-bool dmk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dmk_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
const int header_size = 16;
- UINT8 header[header_size];
+ uint8_t header[header_size];
io_generic_read(io, header, 0, header_size);
@@ -121,8 +121,8 @@ bool dmk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
for (int head = 0; head < heads; head++)
{
- std::vector<UINT8> track_data(track_size);
- std::vector<UINT32> raw_track_data;
+ std::vector<uint8_t> track_data(track_size);
+ std::vector<uint32_t> raw_track_data;
int iam_location = -1;
int idam_location[64];
int dam_location[64];
@@ -137,8 +137,8 @@ bool dmk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
}
// Find IDAM locations
- UINT16 track_header_offset = 0;
- UINT16 track_offset = ( ( track_data[track_header_offset + 1] << 8 ) | track_data[track_header_offset] ) & 0x3fff;
+ uint16_t track_header_offset = 0;
+ uint16_t track_offset = ( ( track_data[track_header_offset + 1] << 8 ) | track_data[track_header_offset] ) & 0x3fff;
track_header_offset += 2;
while ( track_offset != 0 && track_offset >= 0x83 && track_offset < track_size && track_header_offset < 0x80 )
diff --git a/src/lib/formats/dmk_dsk.h b/src/lib/formats/dmk_dsk.h
index 5a2f2f6cb7c..6b15000baab 100644
--- a/src/lib/formats/dmk_dsk.h
+++ b/src/lib/formats/dmk_dsk.h
@@ -20,8 +20,8 @@ class dmk_format : public floppy_image_format_t
public:
dmk_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
diff --git a/src/lib/formats/dsk_dsk.cpp b/src/lib/formats/dsk_dsk.cpp
index 528f30c24be..a4b498f47b2 100644
--- a/src/lib/formats/dsk_dsk.cpp
+++ b/src/lib/formats/dsk_dsk.cpp
@@ -23,7 +23,7 @@ struct dskdsk_tag
int heads;
int tracks;
int sector_size;
- UINT64 track_offsets[84*2]; /* offset within data for each track */
+ uint64_t track_offsets[84*2]; /* offset within data for each track */
};
@@ -39,7 +39,7 @@ static struct dskdsk_tag *get_tag(floppy_image_legacy *floppy)
FLOPPY_IDENTIFY( dsk_dsk_identify )
{
- UINT8 header[8];
+ uint8_t header[8];
floppy_image_read(floppy, header, 0, 8);
if ( memcmp( header, MV_CPC, 8 ) ==0) {
@@ -63,17 +63,17 @@ static int dsk_get_tracks_per_disk(floppy_image_legacy *floppy)
return get_tag(floppy)->tracks;
}
-static UINT64 dsk_get_track_offset(floppy_image_legacy *floppy, int head, int track)
+static uint64_t dsk_get_track_offset(floppy_image_legacy *floppy, int head, int track)
{
return get_tag(floppy)->track_offsets[(track<<1) + head];
}
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
- UINT64 offs;
- UINT64 track_offset;
- UINT8 track_info[0x100];
- UINT8 sectors_per_track;
+ uint64_t offs;
+ uint64_t track_offset;
+ uint8_t track_info[0x100];
+ uint8_t sectors_per_track;
int i;
/* translate the sector to a raw sector */
@@ -113,7 +113,7 @@ static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, in
static floperr_t internal_dsk_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
if (err)
@@ -126,7 +126,7 @@ static floperr_t internal_dsk_read_sector(floppy_image_legacy *floppy, int head,
static floperr_t internal_dsk_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
@@ -159,7 +159,7 @@ static floperr_t dsk_write_indexed_sector(floppy_image_legacy *floppy, int head,
return internal_dsk_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam);
}
-static floperr_t dsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t dsk_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
@@ -172,11 +172,11 @@ static floperr_t dsk_get_sector_length(floppy_image_legacy *floppy, int head, in
return FLOPPY_ERROR_SUCCESS;
}
-static floperr_t dsk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t dsk_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
floperr_t retVal;
- UINT64 offset;
- UINT8 sector_info[0x100];
+ uint64_t offset;
+ uint8_t sector_info[0x100];
int pos;
retVal = get_offset(floppy, head, track, sector_index, FALSE, nullptr);
@@ -202,8 +202,8 @@ FLOPPY_CONSTRUCT( dsk_dsk_construct )
{
struct FloppyCallbacks *callbacks;
struct dskdsk_tag *tag;
- UINT8 header[0x100];
- UINT64 tmp = 0;
+ uint8_t header[0x100];
+ uint64_t tmp = 0;
int i;
int skip,cnt;
@@ -216,8 +216,8 @@ FLOPPY_CONSTRUCT( dsk_dsk_construct )
floppy_image_read(floppy, header, 0, 0x100);
#ifdef SPOT_DUPLICATES
// this allow to spot .dsk files with same data and different headers, making easier to debug softlists.
- UINT32 temp_size = floppy_image_size(floppy);
- UINT8 tmp_copy[temp_size - 0x100];
+ uint32_t temp_size = floppy_image_size(floppy);
+ uint8_t tmp_copy[temp_size - 0x100];
floppy_image_read(floppy,tmp_copy,0x100,temp_size - 0x100);
printf("CRC16: %d\n", ccitt_crc16(0xffff, tmp_copy, temp_size - 0x100));
#endif
@@ -295,9 +295,9 @@ bool dsk_format::supports_save() const
return false;
}
-int dsk_format::identify(io_generic *io, UINT32 form_factor)
+int dsk_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 header[16];
+ uint8_t header[16];
io_generic_read(io, &header, 0, sizeof(header));
if ( memcmp( header, DSK_FORMAT_HEADER, 8 ) ==0) {
@@ -314,38 +314,38 @@ int dsk_format::identify(io_generic *io, UINT32 form_factor)
struct track_header
{
- UINT8 headertag[13];
- UINT16 unused1;
- UINT8 unused1b;
- UINT8 track_number;
- UINT8 side_number;
- UINT8 datarate;
- UINT8 rec_mode;
- UINT8 sector_size_code;
- UINT8 number_of_sector;
- UINT8 gap3_length;
- UINT8 filler_byte;
+ uint8_t headertag[13];
+ uint16_t unused1;
+ uint8_t unused1b;
+ uint8_t track_number;
+ uint8_t side_number;
+ uint8_t datarate;
+ uint8_t rec_mode;
+ uint8_t sector_size_code;
+ uint8_t number_of_sector;
+ uint8_t gap3_length;
+ uint8_t filler_byte;
};
struct sector_header
{
- UINT8 track;
- UINT8 side;
- UINT8 sector_id;
- UINT8 sector_size_code;
- UINT8 fdc_status_reg1;
- UINT8 fdc_status_reg2;
- UINT16 data_length;
+ uint8_t track;
+ uint8_t side;
+ uint8_t sector_id;
+ uint8_t sector_size_code;
+ uint8_t fdc_status_reg1;
+ uint8_t fdc_status_reg2;
+ uint16_t data_length;
};
#pragma pack()
-bool dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool dsk_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 header[0x100];
+ uint8_t header[0x100];
bool extendformat = false;
- UINT64 image_size = io_generic_size(io);
+ uint64_t image_size = io_generic_size(io);
io_generic_read(io, &header, 0, sizeof(header));
if ( memcmp( header, EXT_FORMAT_HEADER, 16 ) ==0) {
@@ -358,7 +358,7 @@ bool dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
skip = 2;
}
int tracks = header[0x30];
- UINT64 track_offsets[84*2];
+ uint64_t track_offsets[84*2];
int cnt =0;
if (!extendformat) {
int tmp = 0x100;
@@ -395,7 +395,7 @@ bool dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
track_header tr;
io_generic_read(io, &tr,track_offsets[(track<<1)+side],sizeof(tr));
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
int sdatapos = 0;
int pos = track_offsets[(track<<1)+side] + 0x100;
for(int j=0;j<tr.number_of_sector;j++) {
diff --git a/src/lib/formats/dsk_dsk.h b/src/lib/formats/dsk_dsk.h
index fc27c0c5030..61af930fdb5 100644
--- a/src/lib/formats/dsk_dsk.h
+++ b/src/lib/formats/dsk_dsk.h
@@ -18,8 +18,8 @@ class dsk_format : public floppy_image_format_t
public:
dsk_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/esq16_dsk.cpp b/src/lib/formats/esq16_dsk.cpp
index 517bb756577..1f6e86f295f 100644
--- a/src/lib/formats/esq16_dsk.cpp
+++ b/src/lib/formats/esq16_dsk.cpp
@@ -71,14 +71,14 @@ bool esqimg_format::supports_save() const
return true;
}
-void esqimg_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count)
+void esqimg_format::find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
track_count = 80;
head_count = 2;
sector_count = 10;
- UINT32 expected_size = 512 * track_count*head_count*sector_count;
+ uint32_t expected_size = 512 * track_count*head_count*sector_count;
if (size == expected_size)
{
return;
@@ -87,9 +87,9 @@ void esqimg_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_co
track_count = head_count = sector_count = 0;
}
-int esqimg_format::identify(io_generic *io, UINT32 form_factor)
+int esqimg_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
if(track_count)
@@ -97,12 +97,12 @@ int esqimg_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool esqimg_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool esqimg_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
- UINT8 sectdata[10*512];
+ uint8_t sectdata[10*512];
desc_s sectors[10];
for(int i=0; i<sector_count; i++) {
sectors[i].data = sectdata + 512*i;
@@ -138,7 +138,7 @@ bool esqimg_format::save(io_generic *io, floppy_image *image)
if(sector_count != 10)
sector_count = 10;
- UINT8 sectdata[11*512];
+ uint8_t sectdata[11*512];
int track_size = sector_count*512;
for(int track=0; track < track_count; track++) {
diff --git a/src/lib/formats/esq16_dsk.h b/src/lib/formats/esq16_dsk.h
index 696db98345c..76c210fd60d 100644
--- a/src/lib/formats/esq16_dsk.h
+++ b/src/lib/formats/esq16_dsk.h
@@ -20,8 +20,8 @@ class esqimg_format : public floppy_image_format_t
public:
esqimg_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
@@ -32,7 +32,7 @@ public:
static const desc_e esq_10_desc[];
private:
- void find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count);
+ void find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count);
};
extern const floppy_format_type FLOPPY_ESQIMG_FORMAT;
diff --git a/src/lib/formats/esq8_dsk.cpp b/src/lib/formats/esq8_dsk.cpp
index f887cba8951..c575fe0db2f 100644
--- a/src/lib/formats/esq8_dsk.cpp
+++ b/src/lib/formats/esq8_dsk.cpp
@@ -75,7 +75,7 @@ bool esq8img_format::supports_save() const
void esq8img_format::find_size(io_generic *io, int &track_count, int &head_count, int &sector_count)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
track_count = 80;
head_count = 1;
sector_count = 6;
@@ -88,7 +88,7 @@ void esq8img_format::find_size(io_generic *io, int &track_count, int &head_count
track_count = head_count = sector_count = 0;
}
-int esq8img_format::identify(io_generic *io, UINT32 form_factor)
+int esq8img_format::identify(io_generic *io, uint32_t form_factor)
{
int track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
@@ -98,12 +98,12 @@ int esq8img_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool esq8img_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool esq8img_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
- UINT8 sectdata[(5*1024) + 512];
+ uint8_t sectdata[(5*1024) + 512];
desc_s sectors[6];
for(int i=0; i<sector_count; i++) {
if (i < 5)
@@ -151,7 +151,7 @@ bool esq8img_format::save(io_generic *io, floppy_image *image)
if(sector_count != 6)
sector_count = 6;
- UINT8 sectdata[10*512];
+ uint8_t sectdata[10*512];
int track_size = (5*1024) + 512;
for(int track=0; track < track_count; track++) {
diff --git a/src/lib/formats/esq8_dsk.h b/src/lib/formats/esq8_dsk.h
index 5fb998bf3b0..d5925805f30 100644
--- a/src/lib/formats/esq8_dsk.h
+++ b/src/lib/formats/esq8_dsk.h
@@ -22,8 +22,8 @@ class esq8img_format : public floppy_image_format_t
public:
esq8img_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
diff --git a/src/lib/formats/fc100_cas.cpp b/src/lib/formats/fc100_cas.cpp
index 48f2373dc19..5004da147d3 100644
--- a/src/lib/formats/fc100_cas.cpp
+++ b/src/lib/formats/fc100_cas.cpp
@@ -23,7 +23,7 @@ it's all a guess.
// image size
static int fc100_image_size;
-static int fc100_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int fc100_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -34,7 +34,7 @@ static int fc100_put_samples(INT16 *buffer, int sample_pos, int count, int level
return count;
}
-static int fc100_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int fc100_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -54,10 +54,10 @@ static int fc100_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int fc100_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int fc100_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* start */
samples += fc100_output_bit (buffer, sample_pos + samples, 0);
@@ -73,11 +73,11 @@ static int fc100_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int fc100_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int fc100_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 byte_count = 0;
- UINT32 i;
+ uint32_t sample_count = 0;
+ uint32_t byte_count = 0;
+ uint32_t i;
/* start */
@@ -106,7 +106,7 @@ static int fc100_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int fc100_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int fc100_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return fc100_handle_cassette(buffer, bytes);
}
@@ -115,7 +115,7 @@ static int fc100_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int fc100_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int fc100_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
fc100_image_size = length;
diff --git a/src/lib/formats/fdd_dsk.cpp b/src/lib/formats/fdd_dsk.cpp
index 46aa8976605..5e34c4ad7df 100644
--- a/src/lib/formats/fdd_dsk.cpp
+++ b/src/lib/formats/fdd_dsk.cpp
@@ -54,9 +54,9 @@ const char *fdd_format::extensions() const
return "fdd";
}
-int fdd_format::identify(io_generic *io, UINT32 form_factor)
+int fdd_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[7];
+ uint8_t h[7];
io_generic_read(io, h, 0, 7);
if (strncmp((const char *)h, "VFD1.0", 6) == 0)
@@ -65,18 +65,18 @@ int fdd_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool fdd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 hsec[0x0c];
+ uint8_t hsec[0x0c];
// sector map
- UINT8 num_secs[160];
- UINT8 tracks[160 * 26];
- UINT8 heads[160 * 26];
- UINT8 secs[160 * 26];
- UINT8 fill_vals[160 * 26];
- UINT32 sec_offs[160 * 26];
- UINT8 sec_sizes[160 * 26];
+ uint8_t num_secs[160];
+ uint8_t tracks[160 * 26];
+ uint8_t heads[160 * 26];
+ uint8_t secs[160 * 26];
+ uint8_t fill_vals[160 * 26];
+ uint32_t sec_offs[160 * 26];
+ uint8_t sec_sizes[160 * 26];
int pos = 0xdc;
@@ -97,7 +97,7 @@ bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
secs[(track * 26) + sect] = hsec[2];
sec_sizes[(track * 26) + sect] = hsec[3];
fill_vals[(track * 26) + sect] = hsec[4];
- sec_offs[(track * 26) + sect] = little_endianize_int32(*(UINT32 *)(hsec + 0x08));
+ sec_offs[(track * 26) + sect] = little_endianize_int32(*(uint32_t *)(hsec + 0x08));
curr_track_size += (128 << hsec[3]);
curr_num_sec++;
@@ -107,7 +107,7 @@ bool fdd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666;
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
int cur_sec_map = 0, sector_size;
for (int track = 0; track < 160; track++)
diff --git a/src/lib/formats/fdd_dsk.h b/src/lib/formats/fdd_dsk.h
index 6a7faa57669..f73e18cd696 100644
--- a/src/lib/formats/fdd_dsk.h
+++ b/src/lib/formats/fdd_dsk.h
@@ -19,8 +19,8 @@ class fdd_format : public floppy_image_format_t
public:
fdd_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/fdi_dsk.cpp b/src/lib/formats/fdi_dsk.cpp
index b766671ecb8..c703f29cc69 100644
--- a/src/lib/formats/fdi_dsk.cpp
+++ b/src/lib/formats/fdi_dsk.cpp
@@ -86,45 +86,45 @@ struct fdidsk_tag
int version;
int heads; /* number of physical heads */
int tracks; /* number of physical tracks */
- UINT32 track_offset[MAX_TRACKS]; /* offset within data for each track */
- UINT8 track_type[MAX_TRACKS];
+ uint32_t track_offset[MAX_TRACKS]; /* offset within data for each track */
+ uint8_t track_type[MAX_TRACKS];
};
struct fdi_track
{
- UINT8 type;
- UINT8 size;
+ uint8_t type;
+ uint8_t size;
};
struct fdi_header
{
- UINT8 signature[27];
- UINT8 creator[32];
- UINT8 comment[80];
- UINT8 eof;
- UINT8 version[2];
- UINT8 ltrack[2];
- UINT8 lhead;
- UINT8 type;
- UINT8 rotspeed;
- UINT8 flags;
- UINT8 tpi;
- UINT8 headwidth;
- UINT8 reserved[2];
+ uint8_t signature[27];
+ uint8_t creator[32];
+ uint8_t comment[80];
+ uint8_t eof;
+ uint8_t version[2];
+ uint8_t ltrack[2];
+ uint8_t lhead;
+ uint8_t type;
+ uint8_t rotspeed;
+ uint8_t flags;
+ uint8_t tpi;
+ uint8_t headwidth;
+ uint8_t reserved[2];
struct fdi_track track[MAX_TRACKS];
};
struct fdi_pulse_track_header
{
- UINT8 numpulses[4];
- UINT8 averagesz[3];
- UINT8 minsize[3];
- UINT8 maxsize[3];
- UINT8 indexsize[3];
-// UINT8 averagedt[averagesz];
-// UINT8 mindata[minsize];
-// UINT8 maxdata[maxsize];
-// UINT8 indexdata[indexsize];
+ uint8_t numpulses[4];
+ uint8_t averagesz[3];
+ uint8_t minsize[3];
+ uint8_t maxsize[3];
+ uint8_t indexsize[3];
+// uint8_t averagedt[averagesz];
+// uint8_t mindata[minsize];
+// uint8_t maxdata[maxsize];
+// uint8_t indexdata[indexsize];
};
/***************************************************************************
@@ -155,22 +155,22 @@ static int fdi_get_sectors_per_track(floppy_image_legacy *floppy, int head, int
return 0;
}
-static floperr_t fdi_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t fdi_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
return FLOPPY_ERROR_SUCCESS;
}
/*
-static UINT32 fdi_get_sector_offset(floppy_image_legacy* floppy, int head, int track, int sector)
+static uint32_t fdi_get_sector_offset(floppy_image_legacy* floppy, int head, int track, int sector)
{
return 0;
}
*/
-static floperr_t fdi_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t fdi_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
return FLOPPY_ERROR_UNSUPPORTED;
}
-static floperr_t fdi_read_track(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen)
+static floperr_t fdi_read_track(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen)
{
return FLOPPY_ERROR_UNSUPPORTED;
}
@@ -201,7 +201,7 @@ static floperr_t fdi_write_indexed_sector(floppy_image_legacy *floppy, int head,
FLOPPY_IDENTIFY( fdi_dsk_identify )
{
- UINT8 header[25];
+ uint8_t header[25];
floppy_image_read(floppy, header, 0, 25);
@@ -261,7 +261,7 @@ FLOPPY_CONSTRUCT( fdi_dsk_construct )
for (int track = 0; track < tag->tracks; track++)
{
- UINT8 type = header.track[track].type;
+ uint8_t type = header.track[track].type;
int size = header.track[track].size * 256;
if (LOG) LOG_FORMATS("FDI track %d type %02x size %d offset %d\n", track, type, size, offset);
diff --git a/src/lib/formats/flex_dsk.cpp b/src/lib/formats/flex_dsk.cpp
index ced4bf2f8a5..fb7dfb1499b 100644
--- a/src/lib/formats/flex_dsk.cpp
+++ b/src/lib/formats/flex_dsk.cpp
@@ -33,7 +33,7 @@ bool flex_format::supports_save() const
return true;
}
-int flex_format::identify(io_generic *io, UINT32 form_factor)
+int flex_format::identify(io_generic *io, uint32_t form_factor)
{
io_generic_read(io, &info, 256 * 2, sizeof(struct sysinfo_sector));
@@ -45,7 +45,7 @@ int flex_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool flex_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool flex_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int spt = info.last_sec;
int bps = 256;
@@ -76,7 +76,7 @@ bool flex_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for(int head=0;head < head_num;head++)
{
desc_pc_sector sects[80];
- UINT8 sect_data[20000];
+ uint8_t sect_data[20000];
int sdatapos = 0;
for(int i=0; i<spt; i++)
{
diff --git a/src/lib/formats/flex_dsk.h b/src/lib/formats/flex_dsk.h
index bade0115c56..c40e0fbda15 100644
--- a/src/lib/formats/flex_dsk.h
+++ b/src/lib/formats/flex_dsk.h
@@ -18,28 +18,28 @@ public:
virtual const char *name() const override;
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 supports_save() const override;
private:
struct sysinfo_sector
{
- UINT8 unused1[16];
- UINT8 disk_name[8];
- UINT8 disk_ext[3];
- UINT8 disk_number[2];
- UINT8 fc_start_trk;
- UINT8 fc_start_sec;
- UINT8 fc_end_trk;
- UINT8 fc_end_sec;
- UINT8 free[2];
- UINT8 month;
- UINT8 day;
- UINT8 year;
- UINT8 last_trk;
- UINT8 last_sec;
- UINT8 unused2[216];
+ uint8_t unused1[16];
+ uint8_t disk_name[8];
+ uint8_t disk_ext[3];
+ uint8_t disk_number[2];
+ uint8_t fc_start_trk;
+ uint8_t fc_start_sec;
+ uint8_t fc_end_trk;
+ uint8_t fc_end_sec;
+ uint8_t free[2];
+ uint8_t month;
+ uint8_t day;
+ uint8_t year;
+ uint8_t last_trk;
+ uint8_t last_sec;
+ uint8_t unused2[216];
} info;
};
diff --git a/src/lib/formats/flopimg.cpp b/src/lib/formats/flopimg.cpp
index 72786f6422e..c924050ac08 100644
--- a/src/lib/formats/flopimg.cpp
+++ b/src/lib/formats/flopimg.cpp
@@ -36,10 +36,10 @@ struct floppy_image_legacy
/* loaded track stuff */
int loaded_track_head;
int loaded_track_index;
- UINT32 loaded_track_size;
+ uint32_t loaded_track_size;
void *loaded_track_data;
- UINT8 loaded_track_status;
- UINT8 flags;
+ uint8_t loaded_track_status;
+ uint8_t flags;
/* tagging system */
object_pool *tags;
@@ -89,7 +89,7 @@ static floppy_image_legacy *floppy_init(void *fp, const struct io_procs *procs,
floppy->io.file = fp;
floppy->io.procs = procs;
floppy->io.filler = 0xFF;
- floppy->flags = (UINT8) flags;
+ floppy->flags = (uint8_t) flags;
return floppy;
}
@@ -337,14 +337,14 @@ void *floppy_create_tag(floppy_image_legacy *floppy, size_t tagsize)
-UINT8 floppy_get_filler(floppy_image_legacy *floppy)
+uint8_t floppy_get_filler(floppy_image_legacy *floppy)
{
return floppy->io.filler;
}
-void floppy_set_filler(floppy_image_legacy *floppy, UINT8 filler)
+void floppy_set_filler(floppy_image_legacy *floppy, uint8_t filler)
{
floppy->io.filler = filler;
}
@@ -355,28 +355,28 @@ void floppy_set_filler(floppy_image_legacy *floppy, UINT8 filler)
calls for accessing the raw disk image
*********************************************************************/
-void floppy_image_read(floppy_image_legacy *floppy, void *buffer, UINT64 offset, size_t length)
+void floppy_image_read(floppy_image_legacy *floppy, void *buffer, uint64_t offset, size_t length)
{
io_generic_read(&floppy->io, buffer, offset, length);
}
-void floppy_image_write(floppy_image_legacy *floppy, const void *buffer, UINT64 offset, size_t length)
+void floppy_image_write(floppy_image_legacy *floppy, const void *buffer, uint64_t offset, size_t length)
{
io_generic_write(&floppy->io, buffer, offset, length);
}
-void floppy_image_write_filler(floppy_image_legacy *floppy, UINT8 filler, UINT64 offset, size_t length)
+void floppy_image_write_filler(floppy_image_legacy *floppy, uint8_t filler, uint64_t offset, size_t length)
{
io_generic_write_filler(&floppy->io, filler, offset, length);
}
-UINT64 floppy_image_size(floppy_image_legacy *floppy)
+uint64_t floppy_image_size(floppy_image_legacy *floppy)
{
return io_generic_size(&floppy->io);
}
@@ -393,9 +393,9 @@ static floperr_t floppy_readwrite_sector(floppy_image_legacy *floppy, int head,
floperr_t err;
const struct FloppyCallbacks *fmt;
size_t this_buffer_len;
- std::vector<UINT8> alloc_buf;
- UINT32 sector_length;
- UINT8 *buffer_ptr = (UINT8 *)buffer;
+ std::vector<uint8_t> alloc_buf;
+ uint32_t sector_length;
+ uint8_t *buffer_ptr = (uint8_t *)buffer;
floperr_t (*read_sector)(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen);
floperr_t (*write_sector)(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam);
@@ -532,7 +532,7 @@ floperr_t floppy_write_indexed_sector(floppy_image_legacy *floppy, int head, int
}
-static floperr_t floppy_get_track_data_offset(floppy_image_legacy *floppy, int head, int track, UINT64 *offset)
+static floperr_t floppy_get_track_data_offset(floppy_image_legacy *floppy, int head, int track, uint64_t *offset)
{
floperr_t err;
const struct FloppyCallbacks *callbacks;
@@ -550,7 +550,7 @@ static floperr_t floppy_get_track_data_offset(floppy_image_legacy *floppy, int h
-static floperr_t floppy_read_track_offset(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buffer_len)
+static floperr_t floppy_read_track_offset(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buffer_len)
{
floperr_t err;
const struct FloppyCallbacks *format;
@@ -583,7 +583,7 @@ floperr_t floppy_read_track(floppy_image_legacy *floppy, int head, int track, vo
floperr_t floppy_read_track_data(floppy_image_legacy *floppy, int head, int track, void *buffer, size_t buffer_len)
{
floperr_t err;
- UINT64 offset;
+ uint64_t offset;
err = floppy_get_track_data_offset(floppy, head, track, &offset);
if (err)
@@ -594,7 +594,7 @@ floperr_t floppy_read_track_data(floppy_image_legacy *floppy, int head, int trac
-static floperr_t floppy_write_track_offset(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buffer_len)
+static floperr_t floppy_write_track_offset(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buffer_len)
{
floperr_t err;
@@ -629,7 +629,7 @@ floperr_t floppy_write_track(floppy_image_legacy *floppy, int head, int track, c
floperr_t floppy_write_track_data(floppy_image_legacy *floppy, int head, int track, const void *buffer, size_t buffer_len)
{
floperr_t err;
- UINT64 offset;
+ uint64_t offset;
err = floppy_get_track_data_offset(floppy, head, track, &offset);
if (err)
@@ -690,7 +690,7 @@ int floppy_get_heads_per_disk(floppy_image_legacy *floppy)
-UINT32 floppy_get_track_size(floppy_image_legacy *floppy, int head, int track)
+uint32_t floppy_get_track_size(floppy_image_legacy *floppy, int head, int track)
{
const struct FloppyCallbacks *fmt;
@@ -703,7 +703,7 @@ UINT32 floppy_get_track_size(floppy_image_legacy *floppy, int head, int track)
-floperr_t floppy_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+floperr_t floppy_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
const struct FloppyCallbacks *fmt;
@@ -716,7 +716,7 @@ floperr_t floppy_get_sector_length(floppy_image_legacy *floppy, int head, int tr
-floperr_t floppy_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+floperr_t floppy_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
const struct FloppyCallbacks *fmt;
@@ -758,7 +758,7 @@ int floppy_is_read_only(floppy_image_legacy *floppy)
-UINT8 floppy_random_byte(floppy_image_legacy *floppy)
+uint8_t floppy_random_byte(floppy_image_legacy *floppy)
{
/* can't use mame_rand(); this might not be in the core */
#ifdef rand
@@ -777,7 +777,7 @@ floperr_t floppy_load_track(floppy_image_legacy *floppy, int head, int track, in
{
floperr_t err;
void *new_loaded_track_data;
- UINT32 track_size;
+ uint32_t track_size;
/* have we already loaded this track? */
if (((floppy->loaded_track_status & TRACK_LOADED) == 0) || (head != floppy->loaded_track_head) || (track != floppy->loaded_track_index))
@@ -892,7 +892,7 @@ LEGACY_FLOPPY_OPTIONS_END
****************************************************************************/
-floppy_image::floppy_image(int _tracks, int _heads, UINT32 _form_factor)
+floppy_image::floppy_image(int _tracks, int _heads, uint32_t _form_factor)
{
tracks = _tracks;
heads = _heads;
@@ -952,7 +952,7 @@ int floppy_image::get_resolution() const
return 0;
}
-const char *floppy_image::get_variant_name(UINT32 form_factor, UINT32 variant)
+const char *floppy_image::get_variant_name(uint32_t form_factor, uint32_t variant)
{
switch(variant) {
case SSSD: return "Single side, single density";
@@ -1105,42 +1105,42 @@ int floppy_image_format_t::crc_cells_size(int type) const
}
}
-bool floppy_image_format_t::bit_r(const std::vector<UINT32> &buffer, int offset)
+bool floppy_image_format_t::bit_r(const std::vector<uint32_t> &buffer, int offset)
{
return (buffer[offset] & floppy_image::MG_MASK) == MG_1;
}
-UINT32 floppy_image_format_t::bitn_r(const std::vector<UINT32> &buffer, int offset, int count)
+uint32_t floppy_image_format_t::bitn_r(const std::vector<uint32_t> &buffer, int offset, int count)
{
- UINT32 r = 0;
+ uint32_t r = 0;
for(int i=0; i<count; i++)
- r = (r << 1) | (UINT32) bit_r(buffer, offset+i);
+ r = (r << 1) | (uint32_t) bit_r(buffer, offset+i);
return r;
}
-void floppy_image_format_t::bit_w(std::vector<UINT32> &buffer, bool val, UINT32 size, int offset)
+void floppy_image_format_t::bit_w(std::vector<uint32_t> &buffer, bool val, uint32_t size, int offset)
{
buffer[offset] = (val ? MG_1 : MG_0) | size;
}
-void floppy_image_format_t::bit_w(std::vector<UINT32> &buffer, bool val, UINT32 size)
+void floppy_image_format_t::bit_w(std::vector<uint32_t> &buffer, bool val, uint32_t size)
{
buffer.push_back((val ? MG_1 : MG_0) | size);
}
-void floppy_image_format_t::raw_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size)
+void floppy_image_format_t::raw_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size)
{
for(int i=n-1; i>=0; i--)
bit_w(buffer, (val >> i) & 1, size);
}
-void floppy_image_format_t::raw_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset)
+void floppy_image_format_t::raw_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size, int offset)
{
for(int i=n-1; i>=0; i--)
bit_w(buffer, (val >> i) & 1, size, offset++);
}
-void floppy_image_format_t::mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size)
+void floppy_image_format_t::mfm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size)
{
int prec = buffer.empty() ? 0 : bit_r(buffer, buffer.size()-1);
for(int i=n-1; i>=0; i--) {
@@ -1151,7 +1151,7 @@ void floppy_image_format_t::mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val
}
}
-void floppy_image_format_t::mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset)
+void floppy_image_format_t::mfm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size, int offset)
{
int prec = offset ? bit_r(buffer, offset-1) : 0;
for(int i=n-1; i>=0; i--) {
@@ -1162,7 +1162,7 @@ void floppy_image_format_t::mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val
}
}
-void floppy_image_format_t::fm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size)
+void floppy_image_format_t::fm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size)
{
for(int i=n-1; i>=0; i--) {
int bit = (val >> i) & 1;
@@ -1171,7 +1171,7 @@ void floppy_image_format_t::fm_w(std::vector<UINT32> &buffer, int n, UINT32 val,
}
}
-void floppy_image_format_t::fm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset)
+void floppy_image_format_t::fm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size, int offset)
{
for(int i=n-1; i>=0; i--) {
int bit = (val >> i) & 1;
@@ -1180,7 +1180,7 @@ void floppy_image_format_t::fm_w(std::vector<UINT32> &buffer, int n, UINT32 val,
}
}
-void floppy_image_format_t::mfm_half_w(std::vector<UINT32> &buffer, int start_bit, UINT32 val, UINT32 size)
+void floppy_image_format_t::mfm_half_w(std::vector<uint32_t> &buffer, int start_bit, uint32_t val, uint32_t size)
{
int prec = buffer.empty() ? 0 : bit_r(buffer, buffer.size()-1);
for(int i=start_bit; i>=0; i-=2) {
@@ -1191,23 +1191,23 @@ void floppy_image_format_t::mfm_half_w(std::vector<UINT32> &buffer, int start_bi
}
}
-void floppy_image_format_t::gcr5_w(std::vector<UINT32> &buffer, UINT8 val, UINT32 size)
+void floppy_image_format_t::gcr5_w(std::vector<uint32_t> &buffer, uint8_t val, uint32_t size)
{
- UINT32 e0 = gcr5fw_tb[val >> 4];
- UINT32 e1 = gcr5fw_tb[val & 0x0f];
+ uint32_t e0 = gcr5fw_tb[val >> 4];
+ uint32_t e1 = gcr5fw_tb[val & 0x0f];
raw_w(buffer, 5, e0, size);
raw_w(buffer, 5, e1, size);
}
-void floppy_image_format_t::gcr5_w(std::vector<UINT32> &buffer, UINT8 val, UINT32 size, int offset)
+void floppy_image_format_t::gcr5_w(std::vector<uint32_t> &buffer, uint8_t val, uint32_t size, int offset)
{
- UINT32 e0 = gcr5fw_tb[val >> 4];
- UINT32 e1 = gcr5fw_tb[val & 0x0f];
+ uint32_t e0 = gcr5fw_tb[val >> 4];
+ uint32_t e1 = gcr5fw_tb[val & 0x0f];
raw_w(buffer, 5, e0, size, offset);
raw_w(buffer, 5, e1, size, offset+5);
}
-void floppy_image_format_t::_8n1_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size)
+void floppy_image_format_t::_8n1_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size)
{
bit_w(buffer, 0, size);
for(int i=n-1; i>=0; i--) {
@@ -1217,9 +1217,9 @@ void floppy_image_format_t::_8n1_w(std::vector<UINT32> &buffer, int n, UINT32 va
bit_w(buffer, 1, size);
}
-void floppy_image_format_t::fixup_crc_amiga(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_amiga(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
- UINT16 res = 0;
+ uint16_t res = 0;
int size = crc->end - crc->start;
for(int i=1; i<size; i+=2)
if(bit_r(buffer, crc->start + i))
@@ -1228,9 +1228,9 @@ void floppy_image_format_t::fixup_crc_amiga(std::vector<UINT32> &buffer, const g
mfm_w(buffer, 16, res, 1000, crc->write+32);
}
-void floppy_image_format_t::fixup_crc_cbm(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_cbm(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
- UINT8 v = 0;
+ uint8_t v = 0;
for(int o = crc->start; o < crc->end; o+=10) {
v = v ^ (gcr5bw_tb[bitn_r(buffer, o, 5)] << 4);
v = v ^ gcr5bw_tb[bitn_r(buffer, o+5, 5)];
@@ -1238,9 +1238,9 @@ void floppy_image_format_t::fixup_crc_cbm(std::vector<UINT32> &buffer, const gen
gcr5_w(buffer, v, 1000, crc->write);
}
-UINT16 floppy_image_format_t::calc_crc_ccitt(const std::vector<UINT32> &buffer, int start, int end)
+uint16_t floppy_image_format_t::calc_crc_ccitt(const std::vector<uint32_t> &buffer, int start, int end)
{
- UINT32 res = 0xffff;
+ uint32_t res = 0xffff;
int size = end - start;
for(int i=1; i<size; i+=2) {
res <<= 1;
@@ -1252,47 +1252,47 @@ UINT16 floppy_image_format_t::calc_crc_ccitt(const std::vector<UINT32> &buffer,
return res;
}
-void floppy_image_format_t::fixup_crc_ccitt(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_ccitt(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
mfm_w(buffer, 16, calc_crc_ccitt(buffer, crc->start, crc->end), 1000, crc->write);
}
-void floppy_image_format_t::fixup_crc_ccitt_fm(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_ccitt_fm(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
fm_w(buffer, 16, calc_crc_ccitt(buffer, crc->start, crc->end), 1000, crc->write);
}
-void floppy_image_format_t::fixup_crc_machead(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_machead(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
- UINT8 v = 0;
+ uint8_t v = 0;
for(int o = crc->start; o < crc->end; o+=8)
v = v ^ gcr6bw_tb[bitn_r(buffer, o, 8)];
raw_w(buffer, 8, gcr6fw_tb[v], 1000, crc->write);
}
-void floppy_image_format_t::fixup_crc_fcs(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_fcs(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
// TODO
}
-void floppy_image_format_t::fixup_crc_victor_header(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_victor_header(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
- UINT8 v = 0;
+ uint8_t v = 0;
for(int o = crc->start; o < crc->end; o+=10)
v += ((gcr5bw_tb[bitn_r(buffer, o, 5)] << 4) | gcr5bw_tb[bitn_r(buffer, o+5, 5)]);
gcr5_w(buffer, v, 1000, crc->write);
}
-void floppy_image_format_t::fixup_crc_victor_data(std::vector<UINT32> &buffer, const gen_crc_info *crc)
+void floppy_image_format_t::fixup_crc_victor_data(std::vector<uint32_t> &buffer, const gen_crc_info *crc)
{
- UINT16 v = 0;
+ uint16_t v = 0;
for(int o = crc->start; o < crc->end; o+=10)
v += ((gcr5bw_tb[bitn_r(buffer, o, 5)] << 4) | gcr5bw_tb[bitn_r(buffer, o+5, 5)]);
gcr5_w(buffer, v & 0xff, 1000, crc->write);
gcr5_w(buffer, v >> 8, 1000, crc->write+10);
}
-void floppy_image_format_t::fixup_crcs(std::vector<UINT32> &buffer, gen_crc_info *crcs)
+void floppy_image_format_t::fixup_crcs(std::vector<uint32_t> &buffer, gen_crc_info *crcs)
{
for(int i=0; i != MAX_CRC_COUNT; i++)
if(crcs[i].write != -1) {
@@ -1314,9 +1314,9 @@ void floppy_image_format_t::fixup_crcs(std::vector<UINT32> &buffer, gen_crc_info
}
}
-UINT32 floppy_image_format_t::gcr6_encode(UINT8 va, UINT8 vb, UINT8 vc)
+uint32_t floppy_image_format_t::gcr6_encode(uint8_t va, uint8_t vb, uint8_t vc)
{
- UINT32 r;
+ uint32_t r;
r = gcr6fw_tb[((va >> 2) & 0x30) | ((vb >> 4) & 0x0c) | ((vc >> 6) & 0x03)] << 24;
r |= gcr6fw_tb[va & 0x3f] << 16;
r |= gcr6fw_tb[vb & 0x3f] << 8;
@@ -1324,7 +1324,7 @@ UINT32 floppy_image_format_t::gcr6_encode(UINT8 va, UINT8 vb, UINT8 vc)
return r;
}
-void floppy_image_format_t::gcr6_decode(UINT8 e0, UINT8 e1, UINT8 e2, UINT8 e3, UINT8 &va, UINT8 &vb, UINT8 &vc)
+void floppy_image_format_t::gcr6_decode(uint8_t e0, uint8_t e1, uint8_t e2, uint8_t e3, uint8_t &va, uint8_t &vb, uint8_t &vc)
{
e0 = gcr6bw_tb[e0];
e1 = gcr6bw_tb[e1];
@@ -1336,12 +1336,12 @@ void floppy_image_format_t::gcr6_decode(UINT8 e0, UINT8 e1, UINT8 e2, UINT8 e3,
vc = ((e0 << 6) & 0xc0) | e3;
}
-UINT16 floppy_image_format_t::gcr4_encode(UINT8 va)
+uint16_t floppy_image_format_t::gcr4_encode(uint8_t va)
{
return (va << 7) | va | 0xaaaa;
}
-UINT8 floppy_image_format_t::gcr4_decode(UINT8 e0, UINT8 e1)
+uint8_t floppy_image_format_t::gcr4_decode(uint8_t e0, uint8_t e1)
{
return ((e0 << 1) & 0xaa) | (e1 & 0x55);
}
@@ -1371,7 +1371,7 @@ int floppy_image_format_t::calc_sector_index(int num, int interleave, int skew,
void floppy_image_format_t::generate_track(const desc_e *desc, int track, int head, const desc_s *sect, int sect_count, int track_size, floppy_image *image)
{
- std::vector<UINT32> buffer;
+ std::vector<uint32_t> buffer;
gen_crc_info crcs[MAX_CRC_COUNT];
collect_crcs(desc, crcs);
@@ -1617,14 +1617,14 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
case SECTOR_DATA_MAC: {
const desc_s *csect = sect + (desc[index].p1 >= 0 ? desc[index].p1 : sector_idx);
- const UINT8 *data = csect->data;
+ const uint8_t *data = csect->data;
int size = csect->size;
- UINT8 ca = 0, cb = 0, cc = 0;
+ uint8_t ca = 0, cb = 0, cc = 0;
for(int i=0; i < size; i+=3) {
int dt = size-i;
- UINT8 va = data[i];
- UINT8 vb = dt > 1 ? data[i+1] : 0;
- UINT8 vc = dt > 2 ? data[i+2] : 0;
+ uint8_t va = data[i];
+ uint8_t vb = dt > 1 ? data[i+1] : 0;
+ uint8_t vc = dt > 2 ? data[i+2] : 0;
cc = (cc << 1) | (cc >> 7);
int suma = ca + va + (cc & 1);
@@ -1665,7 +1665,7 @@ void floppy_image_format_t::generate_track(const desc_e *desc, int track, int he
generate_track_from_levels(track, head, buffer, 0, image);
}
-void floppy_image_format_t::normalize_times(std::vector<UINT32> &buffer)
+void floppy_image_format_t::normalize_times(std::vector<uint32_t> &buffer)
{
unsigned int total_sum = 0;
for(unsigned int i=0; i != buffer.size(); i++)
@@ -1673,20 +1673,20 @@ void floppy_image_format_t::normalize_times(std::vector<UINT32> &buffer)
unsigned int current_sum = 0;
for(unsigned int i=0; i != buffer.size(); i++) {
- UINT32 time = buffer[i] & floppy_image::TIME_MASK;
+ uint32_t time = buffer[i] & floppy_image::TIME_MASK;
buffer[i] = (buffer[i] & floppy_image::MG_MASK) | (200000000ULL * current_sum / total_sum);
current_sum += time;
}
}
-void floppy_image_format_t::generate_track_from_bitstream(int track, int head, const UINT8 *trackbuf, int track_size, floppy_image *image, int subtrack)
+void floppy_image_format_t::generate_track_from_bitstream(int track, int head, const uint8_t *trackbuf, int track_size, floppy_image *image, int subtrack)
{
// Maximal number of cells which happens when the buffer is all 1
- std::vector<UINT32> &dest = image->get_buffer(track, head, subtrack);
+ std::vector<uint32_t> &dest = image->get_buffer(track, head, subtrack);
dest.clear();
- UINT32 cbit = floppy_image::MG_A;
- UINT32 count = 0;
+ uint32_t cbit = floppy_image::MG_A;
+ uint32_t count = 0;
for(int i=0; i != track_size; i++)
if(trackbuf[i >> 3] & (0x80 >> (i & 7))) {
dest.push_back(cbit | (count+1));
@@ -1702,11 +1702,11 @@ void floppy_image_format_t::generate_track_from_bitstream(int track, int head, c
image->set_write_splice_position(track, head, 0, subtrack);
}
-void floppy_image_format_t::generate_track_from_levels(int track, int head, std::vector<UINT32> &trackbuf, int splice_pos, floppy_image *image)
+void floppy_image_format_t::generate_track_from_levels(int track, int head, std::vector<uint32_t> &trackbuf, int splice_pos, floppy_image *image)
{
// Retrieve the angular splice pos before messing with the data
splice_pos = splice_pos % trackbuf.size();
- UINT32 splice_angular_pos = trackbuf[splice_pos] & floppy_image::TIME_MASK;
+ uint32_t splice_angular_pos = trackbuf[splice_pos] & floppy_image::TIME_MASK;
// Check if we need to invert a cell to get an even number of
// transitions on the whole track
@@ -1755,14 +1755,14 @@ void floppy_image_format_t::generate_track_from_levels(int track, int head, std:
}
// Maximal number of cells which happens when the buffer is all MG_1/MG_N alternated, which would be 3/2
- std::vector<UINT32> &dest = image->get_buffer(track, head);
+ std::vector<uint32_t> &dest = image->get_buffer(track, head);
dest.clear();
- UINT32 cbit = floppy_image::MG_A;
- UINT32 count = 0;
+ uint32_t cbit = floppy_image::MG_A;
+ uint32_t count = 0;
for(auto & elem : trackbuf) {
- UINT32 bit = elem & floppy_image::MG_MASK;
- UINT32 time = elem & floppy_image::TIME_MASK;
+ uint32_t bit = elem & floppy_image::MG_MASK;
+ uint32_t time = elem & floppy_image::TIME_MASK;
if(bit == MG_0) {
count += time;
continue;
@@ -1786,13 +1786,13 @@ void floppy_image_format_t::generate_track_from_levels(int track, int head, std:
image->set_write_splice_position(track, head, splice_angular_pos);
}
-const UINT8 floppy_image_format_t::gcr5fw_tb[0x10] =
+const uint8_t floppy_image_format_t::gcr5fw_tb[0x10] =
{
0x0a, 0x0b, 0x12, 0x13, 0x0e, 0x0f, 0x16, 0x17,
0x09, 0x19, 0x1a, 0x1b, 0x0d, 0x1d, 0x1e, 0x15
};
-const UINT8 floppy_image_format_t::gcr5bw_tb[0x20] =
+const uint8_t floppy_image_format_t::gcr5bw_tb[0x20] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x00, 0x01, 0x00, 0x0c, 0x04, 0x05,
@@ -1800,7 +1800,7 @@ const UINT8 floppy_image_format_t::gcr5bw_tb[0x20] =
0x00, 0x09, 0x0a, 0x0b, 0x00, 0x0d, 0x0e, 0x00
};
-const UINT8 floppy_image_format_t::gcr6fw_tb[0x40] =
+const uint8_t floppy_image_format_t::gcr6fw_tb[0x40] =
{
0x96, 0x97, 0x9a, 0x9b, 0x9d, 0x9e, 0x9f, 0xa6,
0xa7, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb2, 0xb3,
@@ -1812,7 +1812,7 @@ const UINT8 floppy_image_format_t::gcr6fw_tb[0x40] =
0xf7, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
};
-const UINT8 floppy_image_format_t::gcr6bw_tb[0x100] =
+const uint8_t floppy_image_format_t::gcr6bw_tb[0x100] =
{
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -2192,9 +2192,9 @@ const floppy_image_format_t::desc_e floppy_image_format_t::amiga_22[] = {
{ END }
};
-void floppy_image_format_t::generate_bitstream_from_track(int track, int head, int cell_size, UINT8 *trackbuf, int &track_size, floppy_image *image, int subtrack)
+void floppy_image_format_t::generate_bitstream_from_track(int track, int head, int cell_size, uint8_t *trackbuf, int &track_size, floppy_image *image, int subtrack)
{
- std::vector<UINT32> &tbuf = image->get_buffer(track, head, subtrack);
+ std::vector<uint32_t> &tbuf = image->get_buffer(track, head, subtrack);
if(tbuf.size() <= 1) {
// Unformatted track
track_size = 200000000/cell_size;
@@ -2203,7 +2203,7 @@ void floppy_image_format_t::generate_bitstream_from_track(int track, int head, i
}
// Start at the write splice
- UINT32 splice = image->get_write_splice_position(track, head, subtrack);
+ uint32_t splice = image->get_write_splice_position(track, head, subtrack);
int cur_pos = splice;
int cur_entry = 0;
while(cur_entry < int(tbuf.size())-1 && (tbuf[cur_entry+1] & floppy_image::TIME_MASK) < cur_pos)
@@ -2219,7 +2219,7 @@ void floppy_image_format_t::generate_bitstream_from_track(int track, int head, i
int phase_adjust = 0;
int freq_hist = 0;
- UINT32 scanned = 0;
+ uint32_t scanned = 0;
while(scanned < 200000000) {
// Note that all magnetic cell type changes are considered
// edges. No randomness added for neutral/damaged cells
@@ -2294,12 +2294,12 @@ void floppy_image_format_t::generate_bitstream_from_track(int track, int head, i
track_size = cur_bit;
}
-int floppy_image_format_t::sbit_r(const UINT8 *bitstream, int pos)
+int floppy_image_format_t::sbit_r(const uint8_t *bitstream, int pos)
{
return (bitstream[pos >> 3] & (0x80 >> (pos & 7))) != 0;
}
-int floppy_image_format_t::sbit_rp(const UINT8 *bitstream, int &pos, int track_size)
+int floppy_image_format_t::sbit_rp(const uint8_t *bitstream, int &pos, int track_size)
{
int res = sbit_r(bitstream, pos);
pos ++;
@@ -2308,9 +2308,9 @@ int floppy_image_format_t::sbit_rp(const UINT8 *bitstream, int &pos, int track_s
return res;
}
-UINT8 floppy_image_format_t::sbyte_mfm_r(const UINT8 *bitstream, int &pos, int track_size)
+uint8_t floppy_image_format_t::sbyte_mfm_r(const uint8_t *bitstream, int &pos, int track_size)
{
- UINT8 res = 0;
+ uint8_t res = 0;
for(int i=0; i<8; i++) {
sbit_rp(bitstream, pos, track_size);
if(sbit_rp(bitstream, pos, track_size))
@@ -2319,9 +2319,9 @@ UINT8 floppy_image_format_t::sbyte_mfm_r(const UINT8 *bitstream, int &pos, int t
return res;
}
-UINT8 floppy_image_format_t::sbyte_gcr5_r(const UINT8 *bitstream, int &pos, int track_size)
+uint8_t floppy_image_format_t::sbyte_gcr5_r(const uint8_t *bitstream, int &pos, int track_size)
{
- UINT16 gcr = 0;
+ uint16_t gcr = 0;
for(int i=0; i<10; i++) {
if(sbit_rp(bitstream, pos, track_size))
gcr |= 0x200 >> i;
@@ -2330,7 +2330,7 @@ UINT8 floppy_image_format_t::sbyte_gcr5_r(const UINT8 *bitstream, int &pos, int
return (gcr5bw_tb[gcr >> 5] << 4) | gcr5bw_tb[gcr & 0x1f];
}
-void floppy_image_format_t::extract_sectors_from_bitstream_mfm_pc(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size)
+void floppy_image_format_t::extract_sectors_from_bitstream_mfm_pc(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size)
{
memset(sectors, 0, 256*sizeof(desc_xs));
@@ -2347,7 +2347,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_mfm_pc(const UINT8 *b
int idblk_count = 0, dblk_count = 0;
// Precharge the shift register to detect over-the-index stuff
- UINT16 shift_reg = 0;
+ uint16_t shift_reg = 0;
for(int i=0; i<16; i++)
if(sbit_r(bitstream, track_size-16+i))
shift_reg |= 0x8000 >> i;
@@ -2357,7 +2357,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_mfm_pc(const UINT8 *b
for(int i=0; i<track_size; i++) {
shift_reg = (shift_reg << 1) | sbit_r(bitstream, i);
if(shift_reg == 0x4489) {
- UINT16 header;
+ uint16_t header;
int pos = i+1;
do {
header = 0;
@@ -2389,10 +2389,10 @@ void floppy_image_format_t::extract_sectors_from_bitstream_mfm_pc(const UINT8 *b
int sectdata_pos = 0;
for(int i=0; i<idblk_count; i++) {
int pos = idblk[i];
- UINT8 track = sbyte_mfm_r(bitstream, pos, track_size);
- UINT8 head = sbyte_mfm_r(bitstream, pos, track_size);
- UINT8 sector = sbyte_mfm_r(bitstream, pos, track_size);
- UINT8 size = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t track = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t head = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t sector = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t size = sbyte_mfm_r(bitstream, pos, track_size);
if(size >= 8)
continue;
@@ -2436,8 +2436,8 @@ void floppy_image_format_t::get_geometry_mfm_pc(floppy_image *image, int cell_si
return;
}
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -2455,17 +2455,17 @@ void floppy_image_format_t::get_geometry_mfm_pc(floppy_image *image, int cell_si
}
-void floppy_image_format_t::get_track_data_mfm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, UINT8 *sectdata)
+void floppy_image_format_t::get_track_data_mfm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, uint8_t *sectdata)
{
- UINT8 bitstream[500000/8];
- UINT8 sectbuf[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectbuf[50000];
desc_xs sectors[256];
int track_size;
generate_bitstream_from_track(track, head, cell_size, bitstream, track_size, image);
extract_sectors_from_bitstream_mfm_pc(bitstream, track_size, sectors, sectbuf, sizeof(sectbuf));
for(int sector=1; sector <= sector_count; sector++) {
- UINT8 *sd = sectdata + (sector-1)*sector_size;
+ uint8_t *sd = sectdata + (sector-1)*sector_size;
if(sectors[sector].data && sectors[sector].track == track && sectors[sector].head == head) {
int asize = sectors[sector].size;
if(asize > sector_size)
@@ -2479,7 +2479,7 @@ void floppy_image_format_t::get_track_data_mfm_pc(int track, int head, floppy_im
}
-void floppy_image_format_t::extract_sectors_from_bitstream_fm_pc(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size)
+void floppy_image_format_t::extract_sectors_from_bitstream_fm_pc(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size)
{
memset(sectors, 0, 256*sizeof(desc_xs));
@@ -2496,7 +2496,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_fm_pc(const UINT8 *bi
int idblk_count = 0, dblk_count = 0;
// Precharge the shift register to detect over-the-index stuff
- UINT16 shift_reg = 0;
+ uint16_t shift_reg = 0;
for(int i=0; i<16; i++)
if(sbit_r(bitstream, track_size-16+i))
shift_reg |= 0x8000 >> i;
@@ -2526,10 +2526,10 @@ void floppy_image_format_t::extract_sectors_from_bitstream_fm_pc(const UINT8 *bi
int sectdata_pos = 0;
for(int i=0; i<idblk_count; i++) {
int pos = idblk[i];
- UINT8 track = sbyte_mfm_r(bitstream, pos, track_size);
- UINT8 head = sbyte_mfm_r(bitstream, pos, track_size);
- UINT8 sector = sbyte_mfm_r(bitstream, pos, track_size);
- UINT8 size = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t track = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t head = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t sector = sbyte_mfm_r(bitstream, pos, track_size);
+ uint8_t size = sbyte_mfm_r(bitstream, pos, track_size);
if(size >= 8)
continue;
int ssize = 128 << size;
@@ -2571,8 +2571,8 @@ void floppy_image_format_t::get_geometry_fm_pc(floppy_image *image, int cell_siz
return;
}
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -2590,17 +2590,17 @@ void floppy_image_format_t::get_geometry_fm_pc(floppy_image *image, int cell_siz
}
-void floppy_image_format_t::get_track_data_fm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, UINT8 *sectdata)
+void floppy_image_format_t::get_track_data_fm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, uint8_t *sectdata)
{
- UINT8 bitstream[500000/8];
- UINT8 sectbuf[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectbuf[50000];
desc_xs sectors[256];
int track_size;
generate_bitstream_from_track(track, head, cell_size, bitstream, track_size, image);
extract_sectors_from_bitstream_fm_pc(bitstream, track_size, sectors, sectbuf, sizeof(sectbuf));
for(int sector=1; sector <= sector_count; sector++) {
- UINT8 *sd = sectdata + (sector-1)*sector_size;
+ uint8_t *sd = sectdata + (sector-1)*sector_size;
if(sectors[sector].data && sectors[sector].track == track && sectors[sector].head == head) {
int asize = sectors[sector].size;
if(asize > sector_size)
@@ -2613,7 +2613,7 @@ void floppy_image_format_t::get_track_data_fm_pc(int track, int head, floppy_ima
}
}
-int floppy_image_format_t::calc_default_pc_gap3_size(UINT32 form_factor, int sector_size)
+int floppy_image_format_t::calc_default_pc_gap3_size(uint32_t form_factor, int sector_size)
{
return
form_factor == floppy_image::FF_8 ? 25 :
@@ -2634,7 +2634,7 @@ void floppy_image_format_t::build_wd_track_mfm(int track, int head, floppy_image
void floppy_image_format_t::build_pc_track_fm(int track, int head, floppy_image *image, int cell_count, int sector_count, const desc_pc_sector *sects, int gap_3, int gap_4a, int gap_1, int gap_2)
{
- std::vector<UINT32> track_data;
+ std::vector<uint32_t> track_data;
// gap 4a , IAM and gap 1
if(gap_4a != -1) {
@@ -2658,7 +2658,7 @@ void floppy_image_format_t::build_pc_track_fm(int track, int head, floppy_image
// Build the track
for(int i=0; i<sector_count; i++) {
- UINT16 crc;
+ uint16_t crc;
// sync and IDAM and gap 2
for(int j=0; j< 6; j++) fm_w(track_data, 8, 0x00);
@@ -2700,7 +2700,7 @@ void floppy_image_format_t::build_pc_track_fm(int track, int head, floppy_image
void floppy_image_format_t::build_pc_track_mfm(int track, int head, floppy_image *image, int cell_count, int sector_count, const desc_pc_sector *sects, int gap_3, int gap_4a, int gap_1, int gap_2)
{
- std::vector<UINT32> track_data;
+ std::vector<uint32_t> track_data;
// gap 4a , IAM and gap 1
if(gap_4a != -1) {
@@ -2725,7 +2725,7 @@ void floppy_image_format_t::build_pc_track_mfm(int track, int head, floppy_image
// Build the track
for(int i=0; i<sector_count; i++) {
- UINT16 crc;
+ uint16_t crc;
// sync and IDAM and gap 2
for(int j=0; j<12; j++) mfm_w(track_data, 8, 0x00);
unsigned int cpos = track_data.size();
@@ -2766,7 +2766,7 @@ void floppy_image_format_t::build_pc_track_mfm(int track, int head, floppy_image
generate_track_from_levels(track, head, track_data, 0, image);
}
-void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size, int head, int tracks)
+void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size, int head, int tracks)
{
memset(sectors, 0, 256*sizeof(desc_xs));
@@ -2779,7 +2779,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const UINT8 *bit
int hblk_count = 0, dblk_count = 0;
// Precharge the shift register to detect over-the-index stuff
- UINT16 shift_reg = 0;
+ uint16_t shift_reg = 0;
for(int i=0; i<16; i++)
if(sbit_r(bitstream, track_size-16+i))
shift_reg |= 0x8000 >> i;
@@ -2791,7 +2791,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const UINT8 *bit
shift_reg = ((shift_reg << 1) | bit) & 0x3ff;
if (sync && !bit) {
- UINT8 id = sbyte_gcr5_r(bitstream, i, track_size);
+ uint8_t id = sbyte_gcr5_r(bitstream, i, track_size);
switch (id) {
case 0x08:
@@ -2813,12 +2813,12 @@ void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const UINT8 *bit
int sectdata_pos = 0;
for(int i=0; i<hblk_count; i++) {
int pos = hblk[i];
- ATTR_UNUSED UINT8 block_id = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 crc = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 sector = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 track = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 id2 = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 id1 = sbyte_gcr5_r(bitstream, pos, track_size);
+ ATTR_UNUSED uint8_t block_id = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t crc = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t sector = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t track = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t id2 = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t id1 = sbyte_gcr5_r(bitstream, pos, track_size);
if (crc ^ sector ^ track ^ id2 ^ id1) {
// header crc mismatch
@@ -2832,9 +2832,9 @@ void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const UINT8 *bit
sectors[sector].head = head;
sectors[sector].size = 256;
sectors[sector].data = sectdata + sectdata_pos;
- UINT8 data_crc = 0;
+ uint8_t data_crc = 0;
for(int j=0; j<sectors[sector].size; j++) {
- UINT8 data = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t data = sbyte_gcr5_r(bitstream, pos, track_size);
data_crc ^= data;
sectdata[sectdata_pos++] = data;
}
@@ -2845,7 +2845,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_gcr5(const UINT8 *bit
}
}
-void floppy_image_format_t::extract_sectors_from_bitstream_victor_gcr5(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size)
+void floppy_image_format_t::extract_sectors_from_bitstream_victor_gcr5(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size)
{
memset(sectors, 0, 256*sizeof(desc_xs));
@@ -2858,7 +2858,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_victor_gcr5(const UIN
int hblk_count = 0, dblk_count = 0;
// Precharge the shift register to detect over-the-index stuff
- UINT16 shift_reg = 0;
+ uint16_t shift_reg = 0;
for(int i=0; i<16; i++)
if(sbit_r(bitstream, track_size-16+i))
shift_reg |= 0x8000 >> i;
@@ -2870,7 +2870,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_victor_gcr5(const UIN
shift_reg = ((shift_reg << 1) | bit) & 0x3ff;
if (sync && !bit) {
- UINT8 id = sbyte_gcr5_r(bitstream, i, track_size);
+ uint8_t id = sbyte_gcr5_r(bitstream, i, track_size);
switch (id) {
case 0x07:
@@ -2892,9 +2892,9 @@ void floppy_image_format_t::extract_sectors_from_bitstream_victor_gcr5(const UIN
int sectdata_pos = 0;
for(int i=0; i<hblk_count; i++) {
int pos = hblk[i];
- ATTR_UNUSED UINT8 block_id = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 track = sbyte_gcr5_r(bitstream, pos, track_size);
- UINT8 sector = sbyte_gcr5_r(bitstream, pos, track_size);
+ ATTR_UNUSED uint8_t block_id = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t track = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t sector = sbyte_gcr5_r(bitstream, pos, track_size);
pos = dblk[i];
block_id = sbyte_gcr5_r(bitstream, pos, track_size);
@@ -2904,7 +2904,7 @@ void floppy_image_format_t::extract_sectors_from_bitstream_victor_gcr5(const UIN
sectors[sector].size = 512;
sectors[sector].data = sectdata + sectdata_pos;
for(int j=0; j<sectors[sector].size; j++) {
- UINT8 data = sbyte_gcr5_r(bitstream, pos, track_size);
+ uint8_t data = sbyte_gcr5_r(bitstream, pos, track_size);
sectdata[sectdata_pos++] = data;
}
}
diff --git a/src/lib/formats/flopimg.h b/src/lib/formats/flopimg.h
index 9a8f1513623..1ad73d94f81 100644
--- a/src/lib/formats/flopimg.h
+++ b/src/lib/formats/flopimg.h
@@ -66,17 +66,17 @@ struct FloppyCallbacks
floperr_t (*write_sector)(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam);
floperr_t (*read_indexed_sector)(floppy_image_legacy *floppy, int head, int track, int sector_index, void *buffer, size_t buflen);
floperr_t (*write_indexed_sector)(floppy_image_legacy *floppy, int head, int track, int sector_index, const void *buffer, size_t buflen, int ddam);
- floperr_t (*read_track)(floppy_image_legacy *floppy, int head, int track, UINT64 offset, void *buffer, size_t buflen);
- floperr_t (*write_track)(floppy_image_legacy *floppy, int head, int track, UINT64 offset, const void *buffer, size_t buflen);
+ floperr_t (*read_track)(floppy_image_legacy *floppy, int head, int track, uint64_t offset, void *buffer, size_t buflen);
+ floperr_t (*write_track)(floppy_image_legacy *floppy, int head, int track, uint64_t offset, const void *buffer, size_t buflen);
floperr_t (*format_track)(floppy_image_legacy *floppy, int head, int track, util::option_resolution *params);
floperr_t (*post_format)(floppy_image_legacy *floppy, util::option_resolution *params);
int (*get_heads_per_disk)(floppy_image_legacy *floppy);
int (*get_tracks_per_disk)(floppy_image_legacy *floppy);
int (*get_sectors_per_track)(floppy_image_legacy *floppy, int head, int track);
- UINT32 (*get_track_size)(floppy_image_legacy *floppy, int head, int track);
- floperr_t (*get_sector_length)(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length);
- floperr_t (*get_indexed_sector_info)(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags);
- floperr_t (*get_track_data_offset)(floppy_image_legacy *floppy, int head, int track, UINT64 *offset);
+ uint32_t (*get_track_size)(floppy_image_legacy *floppy, int head, int track);
+ floperr_t (*get_sector_length)(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length);
+ floperr_t (*get_indexed_sector_info)(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags);
+ floperr_t (*get_track_data_offset)(floppy_image_legacy *floppy, int head, int track, uint64_t *offset);
};
@@ -177,8 +177,8 @@ floperr_t floppy_identify(void *fp, const struct io_procs *procs, const char *ex
void *floppy_tag(floppy_image_legacy *floppy);
void *floppy_create_tag(floppy_image_legacy *floppy, size_t tagsize);
struct FloppyCallbacks *floppy_callbacks(floppy_image_legacy *floppy);
-UINT8 floppy_get_filler(floppy_image_legacy *floppy);
-void floppy_set_filler(floppy_image_legacy *floppy, UINT8 filler);
+uint8_t floppy_get_filler(floppy_image_legacy *floppy);
+void floppy_set_filler(floppy_image_legacy *floppy, uint8_t filler);
/* calls for accessing disk image data */
floperr_t floppy_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int offset, void *buffer, size_t buffer_len);
@@ -192,22 +192,22 @@ floperr_t floppy_write_track_data(floppy_image_legacy *floppy, int head, int tra
floperr_t floppy_format_track(floppy_image_legacy *floppy, int head, int track, util::option_resolution *params);
int floppy_get_tracks_per_disk(floppy_image_legacy *floppy);
int floppy_get_heads_per_disk(floppy_image_legacy *floppy);
-UINT32 floppy_get_track_size(floppy_image_legacy *floppy, int head, int track);
-floperr_t floppy_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length);
-floperr_t floppy_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags);
+uint32_t floppy_get_track_size(floppy_image_legacy *floppy, int head, int track);
+floperr_t floppy_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length);
+floperr_t floppy_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags);
floperr_t floppy_get_sector_count(floppy_image_legacy *floppy, int head, int track, int *sector_count);
floperr_t floppy_load_track(floppy_image_legacy *floppy, int head, int track, int dirtify, void **track_data, size_t *track_length);
int floppy_is_read_only(floppy_image_legacy *floppy);
-UINT8 floppy_random_byte(floppy_image_legacy *floppy);
+uint8_t floppy_random_byte(floppy_image_legacy *floppy);
/* accessors for meta information about the image */
const char *floppy_format_description(floppy_image_legacy *floppy);
/* calls for accessing the raw disk image */
-void floppy_image_read(floppy_image_legacy *floppy, void *buffer, UINT64 offset, size_t length);
-void floppy_image_write(floppy_image_legacy *floppy, const void *buffer, UINT64 offset, size_t length);
-void floppy_image_write_filler(floppy_image_legacy *floppy, UINT8 filler, UINT64 offset, size_t length);
-UINT64 floppy_image_size(floppy_image_legacy *floppy);
+void floppy_image_read(floppy_image_legacy *floppy, void *buffer, uint64_t offset, size_t length);
+void floppy_image_write(floppy_image_legacy *floppy, const void *buffer, uint64_t offset, size_t length);
+void floppy_image_write_filler(floppy_image_legacy *floppy, uint8_t filler, uint64_t offset, size_t length);
+uint64_t floppy_image_size(floppy_image_legacy *floppy);
/* misc */
const char *floppy_error(floperr_t err);
@@ -234,7 +234,7 @@ public:
in floppy_image
@return 1 if image valid, 0 otherwise.
*/
- virtual int identify(io_generic *io, UINT32 form_factor) = 0;
+ virtual int identify(io_generic *io, uint32_t form_factor) = 0;
/*! @brief Load an image.
The load function opens an image file and converts it to the
@@ -245,7 +245,7 @@ public:
@param image output buffer for data in MESS internal format.
@return true on success, false otherwise.
*/
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) = 0;
+ virtual bool load(io_generic *io, uint32_t form_factor, floppy_image *image) = 0;
/*! @brief Save an image.
The save function writes back an image from the MESS internal
@@ -363,9 +363,9 @@ protected:
//! Sector data description
struct desc_s {
int size; //!< Sector size, int bytes
- const UINT8 *data; //!< Sector data
- UINT8 sector_id; //!< Sector ID
- UINT8 sector_info; //!< Sector free byte
+ const uint8_t *data; //!< Sector data
+ uint8_t sector_id; //!< Sector ID
+ uint8_t sector_info; //!< Sector free byte
};
@@ -387,7 +387,7 @@ protected:
@param track_size in cells, not bytes.
@param image
*/
- void generate_track_from_bitstream(int track, int head, const UINT8 *trackbuf, int track_size, floppy_image *image, int subtrack = 0);
+ void generate_track_from_bitstream(int track, int head, const uint8_t *trackbuf, int track_size, floppy_image *image, int subtrack = 0);
//! @brief Generate a track from cell level values (0/1/W/D/N).
@@ -404,14 +404,14 @@ protected:
know. trackbuf may be modified at that position or after.
@param image
*/
- void generate_track_from_levels(int track, int head, std::vector<UINT32> &trackbuf, int splice_pos, floppy_image *image);
+ void generate_track_from_levels(int track, int head, std::vector<uint32_t> &trackbuf, int splice_pos, floppy_image *image);
//! Normalize the times in a cell buffer to sum up to 200000000
- void normalize_times(std::vector<UINT32> &buffer);
+ void normalize_times(std::vector<uint32_t> &buffer);
// Some conversion tables for gcr
- static const UINT8 gcr5fw_tb[0x10], gcr5bw_tb[0x20];
- static const UINT8 gcr6fw_tb[0x40], gcr6bw_tb[0x100];
+ static const uint8_t gcr5fw_tb[0x10], gcr5bw_tb[0x20];
+ static const uint8_t gcr6fw_tb[0x40], gcr6bw_tb[0x100];
// Some useful descriptions shared by multiple formats
@@ -484,25 +484,25 @@ protected:
@endverbatim
*/
- void generate_bitstream_from_track(int track, int head, int cell_size, UINT8 *trackbuf, int &track_size, floppy_image *image, int subtrack = 0);
+ void generate_bitstream_from_track(int track, int head, int cell_size, uint8_t *trackbuf, int &track_size, floppy_image *image, int subtrack = 0);
//! Defines a standard sector for extracting.
struct desc_xs {
int track, //!< Track for this sector
head, //!< Head for this sector
size; //!< Size of this sector
- const UINT8 *data; //!< Data within this sector
+ const uint8_t *data; //!< Data within this sector
};
struct desc_pc_sector {
- UINT8 track, head, sector, size;
+ uint8_t track, head, sector, size;
int actual_size;
- UINT8 *data;
+ uint8_t *data;
bool deleted;
bool bad_crc;
};
- int calc_default_pc_gap3_size(UINT32 form_factor, int sector_size);
+ int calc_default_pc_gap3_size(uint32_t form_factor, int sector_size);
void build_wd_track_fm(int track, int head, floppy_image *image, int cell_count, int sector_count, const desc_pc_sector *sects, int gap_3, int gap_1, int gap_2);
void build_wd_track_mfm(int track, int head, floppy_image *image, int cell_count, int sector_count, const desc_pc_sector *sects, int gap_3, int gap_1, int gap_2=22);
void build_pc_track_fm(int track, int head, floppy_image *image, int cell_count, int sector_count, const desc_pc_sector *sects, int gap_3, int gap_4a=40, int gap_1=26, int gap_2=11);
@@ -519,13 +519,13 @@ protected:
//! systems.
//! PC-type sectors with MFM encoding, sector size can go from 128 bytes to 16K.
- void extract_sectors_from_bitstream_mfm_pc(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size);
+ void extract_sectors_from_bitstream_mfm_pc(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size);
//! PC-type sectors with FM encoding
- void extract_sectors_from_bitstream_fm_pc(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size);
+ void extract_sectors_from_bitstream_fm_pc(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size);
//! Commodore type sectors with GCR5 encoding
- void extract_sectors_from_bitstream_gcr5(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size, int head, int tracks);
+ void extract_sectors_from_bitstream_gcr5(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size, int head, int tracks);
//! Victor 9000 type sectors with GCR5 encoding
- void extract_sectors_from_bitstream_victor_gcr5(const UINT8 *bitstream, int track_size, desc_xs *sectors, UINT8 *sectdata, int sectdata_size);
+ void extract_sectors_from_bitstream_victor_gcr5(const uint8_t *bitstream, int track_size, desc_xs *sectors, uint8_t *sectdata, int sectdata_size);
//! @brief Get a geometry (including sectors) from an image.
@@ -538,48 +538,48 @@ protected:
//! Regenerate the data for a full track.
//! PC-type sectors with MFM encoding and fixed-size.
- void get_track_data_mfm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, UINT8 *sectdata);
+ void get_track_data_mfm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, uint8_t *sectdata);
//! Regenerate the data for a full track.
//! PC-type sectors with FM encoding and fixed-size.
- void get_track_data_fm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, UINT8 *sectdata);
+ void get_track_data_fm_pc(int track, int head, floppy_image *image, int cell_size, int sector_size, int sector_count, uint8_t *sectdata);
//! Look up a bit in a level-type stream.
- bool bit_r(const std::vector<UINT32> &buffer, int offset);
+ bool bit_r(const std::vector<uint32_t> &buffer, int offset);
//! Look up multiple bits
- UINT32 bitn_r(const std::vector<UINT32> &buffer, int offset, int count);
+ uint32_t bitn_r(const std::vector<uint32_t> &buffer, int offset, int count);
//! Write a bit with a given size.
- void bit_w(std::vector<UINT32> &buffer, bool val, UINT32 size = 1000);
- void bit_w(std::vector<UINT32> &buffer, bool val, UINT32 size, int offset);
+ void bit_w(std::vector<uint32_t> &buffer, bool val, uint32_t size = 1000);
+ void bit_w(std::vector<uint32_t> &buffer, bool val, uint32_t size, int offset);
//! Calculate a CCITT-type CRC.
- UINT16 calc_crc_ccitt(const std::vector<UINT32> &buffer, int start, int end);
+ uint16_t calc_crc_ccitt(const std::vector<uint32_t> &buffer, int start, int end);
//! Write a series of (raw) bits
- void raw_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size = 1000);
- void raw_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset);
+ void raw_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size = 1000);
+ void raw_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size, int offset);
//! FM-encode and write a series of bits
- void fm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size = 1000);
- void fm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset);
+ void fm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size = 1000);
+ void fm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size, int offset);
//! MFM-encode and write a series of bits
- void mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size = 1000);
- void mfm_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size, int offset);
+ void mfm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size = 1000);
+ void mfm_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size, int offset);
//! MFM-encode every two bits and write
- void mfm_half_w(std::vector<UINT32> &buffer, int start_bit, UINT32 val, UINT32 size = 1000);
+ void mfm_half_w(std::vector<uint32_t> &buffer, int start_bit, uint32_t val, uint32_t size = 1000);
//! GCR5-encode and write a series of bits
- void gcr5_w(std::vector<UINT32> &buffer, UINT8 val, UINT32 size = 1000);
- void gcr5_w(std::vector<UINT32> &buffer, UINT8 val, UINT32 size, int offset);
+ void gcr5_w(std::vector<uint32_t> &buffer, uint8_t val, uint32_t size = 1000);
+ void gcr5_w(std::vector<uint32_t> &buffer, uint8_t val, uint32_t size, int offset);
//! 8N1-encode and write a series of bits
- void _8n1_w(std::vector<UINT32> &buffer, int n, UINT32 val, UINT32 size = 1000);
+ void _8n1_w(std::vector<uint32_t> &buffer, int n, uint32_t val, uint32_t size = 1000);
//! GCR4 encode (Apple II sector header)
- UINT16 gcr4_encode(UINT8 va);
+ uint16_t gcr4_encode(uint8_t va);
//! GCR4 decode
- UINT8 gcr4_decode(UINT8 e0, UINT8 e1);
+ uint8_t gcr4_decode(uint8_t e0, uint8_t e1);
//! GCR6 encode (Apple II 16-sector and Mac-style GCR)
- UINT32 gcr6_encode(UINT8 va, UINT8 vb, UINT8 vc);
+ uint32_t gcr6_encode(uint8_t va, uint8_t vb, uint8_t vc);
//! GCR6 decode
- void gcr6_decode(UINT8 e0, UINT8 e1, UINT8 e2, UINT8 e3, UINT8 &va, UINT8 &vb, UINT8 &vc);
+ void gcr6_decode(uint8_t e0, uint8_t e1, uint8_t e2, uint8_t e3, uint8_t &va, uint8_t &vb, uint8_t &vc);
- UINT8 sbyte_mfm_r(const UINT8 *bitstream, int &pos, int track_size);
- UINT8 sbyte_gcr5_r(const UINT8 *bitstream, int &pos, int track_size);
+ uint8_t sbyte_mfm_r(const uint8_t *bitstream, int &pos, int track_size);
+ uint8_t sbyte_gcr5_r(const uint8_t *bitstream, int &pos, int track_size);
private:
enum { CRC_NONE, CRC_AMIGA, CRC_CBM, CRC_CCITT, CRC_CCITT_FM, CRC_MACHEAD, CRC_FCS, CRC_VICTOR_HDR, CRC_VICTOR_DATA };
@@ -598,19 +598,19 @@ private:
bool type_data_mfm(int type, int p1, const gen_crc_info *crcs) const;
int crc_cells_size(int type) const;
- void fixup_crc_amiga(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_cbm(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_ccitt(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_ccitt_fm(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_machead(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_fcs(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_victor_header(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crc_victor_data(std::vector<UINT32> &buffer, const gen_crc_info *crc);
- void fixup_crcs(std::vector<UINT32> &buffer, gen_crc_info *crcs);
+ void fixup_crc_amiga(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_cbm(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_ccitt(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_ccitt_fm(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_machead(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_fcs(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_victor_header(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crc_victor_data(std::vector<uint32_t> &buffer, const gen_crc_info *crc);
+ void fixup_crcs(std::vector<uint32_t> &buffer, gen_crc_info *crcs);
void collect_crcs(const desc_e *desc, gen_crc_info *crcs) const;
- int sbit_r(const UINT8 *bitstream, int pos);
- int sbit_rp(const UINT8 *bitstream, int &pos, int track_size);
+ int sbit_r(const uint8_t *bitstream, int pos);
+ int sbit_rp(const uint8_t *bitstream, int &pos, int track_size);
int calc_sector_index(int num, int interleave, int skew, int total_sectors, int track_head);
};
@@ -717,15 +717,15 @@ public:
@param _heads number of heads.
@param _form_factor form factor of drive (from enum)
*/
- floppy_image(int tracks, int heads, UINT32 form_factor);
+ floppy_image(int tracks, int heads, uint32_t form_factor);
virtual ~floppy_image();
//! @return the form factor.
- UINT32 get_form_factor() const { return form_factor; }
+ uint32_t get_form_factor() const { return form_factor; }
//! @return the variant.
- UINT32 get_variant() const { return variant; }
+ uint32_t get_variant() const { return variant; }
//! @param v the variant.
- void set_variant(UINT32 v) { variant = v; }
+ void set_variant(uint32_t v) { variant = v; }
/*!
@param track
@@ -733,7 +733,7 @@ public:
@param head head number
@return a pointer to the data buffer for this track and head
*/
- std::vector<UINT32> &get_buffer(int track, int head, int subtrack = 0) { return track_array[track*4+subtrack][head].cell_data; }
+ std::vector<uint32_t> &get_buffer(int track, int head, int subtrack = 0) { return track_array[track*4+subtrack][head].cell_data; }
//! Sets the write splice position.
//! The "track splice" information indicates where to start writing
@@ -747,9 +747,9 @@ public:
@param head
@param pos the position
*/
- void set_write_splice_position(int track, int head, UINT32 pos, int subtrack = 0) { track_array[track*4+subtrack][head].write_splice = pos; }
+ void set_write_splice_position(int track, int head, uint32_t pos, int subtrack = 0) { track_array[track*4+subtrack][head].write_splice = pos; }
//! @return the current write splice position.
- UINT32 get_write_splice_position(int track, int head, int subtrack = 0) const { return track_array[track*4+subtrack][head].write_splice; }
+ uint32_t get_write_splice_position(int track, int head, int subtrack = 0) const { return track_array[track*4+subtrack][head].write_splice; }
//! @return the maximal geometry supported by this format.
void get_maximal_geometry(int &tracks, int &heads) const;
@@ -763,16 +763,16 @@ public:
//! @param form_factor
//! @param variant
//! @param returns a string containing the variant name.
- static const char *get_variant_name(UINT32 form_factor, UINT32 variant);
+ static const char *get_variant_name(uint32_t form_factor, uint32_t variant);
private:
int tracks, heads;
- UINT32 form_factor, variant;
+ uint32_t form_factor, variant;
struct track_info {
- std::vector<UINT32> cell_data;
- UINT32 write_splice;
+ std::vector<uint32_t> cell_data;
+ uint32_t write_splice;
track_info() { write_splice = 0; }
};
diff --git a/src/lib/formats/fm7_cas.cpp b/src/lib/formats/fm7_cas.cpp
index 5d4aad61092..32cd08e3b27 100644
--- a/src/lib/formats/fm7_cas.cpp
+++ b/src/lib/formats/fm7_cas.cpp
@@ -13,9 +13,9 @@
static int cas_size;
-static int fm7_fill_wave(INT16* buffer, UINT8 high, UINT8 low, int sample_pos)
+static int fm7_fill_wave(int16_t* buffer, uint8_t high, uint8_t low, int sample_pos)
{
- UINT16 data = (high << 8) + low;
+ uint16_t data = (high << 8) + low;
int sample_count = 0;
int x = 0;
int count = (data & 0x7fff);
@@ -41,7 +41,7 @@ static int fm7_fill_wave(INT16* buffer, UINT8 high, UINT8 low, int sample_pos)
return sample_count;
}
-static int fm7_handle_t77(INT16* buffer, const UINT8* casdata)
+static int fm7_handle_t77(int16_t* buffer, const uint8_t* casdata)
{
int sample_count = 0;
int data_pos = 16;
@@ -61,7 +61,7 @@ static int fm7_handle_t77(INT16* buffer, const UINT8* casdata)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int fm7_cas_to_wav_size (const UINT8 *casdata, int caslen)
+static int fm7_cas_to_wav_size (const uint8_t *casdata, int caslen)
{
cas_size = caslen;
@@ -71,7 +71,7 @@ static int fm7_cas_to_wav_size (const UINT8 *casdata, int caslen)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int fm7_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int fm7_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return fm7_handle_t77(buffer,bytes);
}
diff --git a/src/lib/formats/fmsx_cas.cpp b/src/lib/formats/fmsx_cas.cpp
index ca2ab078fd4..6da8fc47f81 100644
--- a/src/lib/formats/fmsx_cas.cpp
+++ b/src/lib/formats/fmsx_cas.cpp
@@ -8,7 +8,7 @@
#define CAS_PERIOD (16)
#define CAS_HEADER_PERIODS (4000)
#define CAS_EMPTY_PERIODS (1000)
-static const UINT8 CasHeader[8] = { 0x1F,0xA6,0xDE,0xBA,0xCC,0x13,0x7D,0x74 };
+static const uint8_t CasHeader[8] = { 0x1F,0xA6,0xDE,0xBA,0xCC,0x13,0x7D,0x74 };
static int cas_size;
@@ -16,7 +16,7 @@ static int cas_size;
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int fmsx_cas_to_wav_size (const UINT8 *casdata, int caslen)
+static int fmsx_cas_to_wav_size (const uint8_t *casdata, int caslen)
{
int pos, size;
@@ -48,7 +48,7 @@ static int fmsx_cas_to_wav_size (const UINT8 *casdata, int caslen)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int fmsx_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int fmsx_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
int cas_pos, bit, state = 1, samples_pos, size, n, i, p;
diff --git a/src/lib/formats/fsd_dsk.cpp b/src/lib/formats/fsd_dsk.cpp
index cbf474da116..9cd4bff1f61 100644
--- a/src/lib/formats/fsd_dsk.cpp
+++ b/src/lib/formats/fsd_dsk.cpp
@@ -84,9 +84,9 @@ bool fsd_format::supports_save() const
return false;
}
-int fsd_format::identify(io_generic *io, UINT32 form_factor)
+int fsd_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[3];
+ uint8_t h[3];
io_generic_read(io, h, 0, 3);
if (memcmp(h, "FSD", 3) == 0) {
@@ -96,18 +96,18 @@ int fsd_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool fsd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool fsd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
const char* result[255];
result[0x00] = "OK";
result[0x0e] = "Data CRC Error";
result[0x20] = "Deleted Data";
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> img(size);
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> img(size);
io_generic_read(io, &img[0], 0, size);
- UINT64 pos;
+ uint64_t pos;
std::string title;
for(pos=8; pos < size && img[pos] != '\0'; pos++)
title.append(1, img[pos]);
@@ -122,21 +122,21 @@ bool fsd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
LOG_FORMATS("FSD Release: %d\n", ((img[7] & 0xc0) / 64) * 256 + img[6]);
desc_pc_sector sects[256];
- UINT8 total_tracks = img[pos++];
- UINT8 tnum, hnum, snum, ssize, error;
+ uint8_t total_tracks = img[pos++];
+ uint8_t tnum, hnum, snum, ssize, error;
hnum = 0;
LOG_FORMATS("FSD Tracks: %02d\n", total_tracks+1);
LOG_FORMATS("Tr.# No.S Sec.# Tr.ID Head# SecID IDsiz REsiz Error\n");
for(int curr_track=0; curr_track <= total_tracks; curr_track++)
{
- UINT8 track = img[pos++];
- UINT8 spt = img[pos++];
+ uint8_t track = img[pos++];
+ uint8_t spt = img[pos++];
if (spt > 0) // formatted
{
LOG_FORMATS("%02X %02X\n", track, spt);
- UINT8 readable = img[pos++];
+ uint8_t readable = img[pos++];
for (int i = 0; i < spt; i++)
{
tnum = img[pos++]; // logical track
diff --git a/src/lib/formats/fsd_dsk.h b/src/lib/formats/fsd_dsk.h
index fdfb6fb3d27..8a472016cc6 100644
--- a/src/lib/formats/fsd_dsk.h
+++ b/src/lib/formats/fsd_dsk.h
@@ -34,8 +34,8 @@ public:
virtual const char *extensions() const override;
virtual bool supports_save() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
};
extern const floppy_format_type FLOPPY_FSD_FORMAT;
diff --git a/src/lib/formats/g64_dsk.cpp b/src/lib/formats/g64_dsk.cpp
index 302bfc0e842..d0fc182835d 100644
--- a/src/lib/formats/g64_dsk.cpp
+++ b/src/lib/formats/g64_dsk.cpp
@@ -19,7 +19,7 @@ g64_format::g64_format()
{
}
-const UINT32 g64_format::c1541_cell_size[] =
+const uint32_t g64_format::c1541_cell_size[] =
{
4000, // 16MHz/16/4
3750, // 16MHz/15/4
@@ -27,7 +27,7 @@ const UINT32 g64_format::c1541_cell_size[] =
3250 // 16MHz/13/4
};
-int g64_format::identify(io_generic *io, UINT32 form_factor)
+int g64_format::identify(io_generic *io, uint32_t form_factor)
{
char h[8];
@@ -38,10 +38,10 @@ int g64_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool g64_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> img(size);
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> img(size);
io_generic_read(io, &img[0], 0, size);
if (img[POS_VERSION]) {
@@ -58,9 +58,9 @@ bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if (track == TRACK_COUNT)
head = 1;
- UINT32 tpos = POS_TRACK_OFFSET + (track * 4);
- UINT32 spos = tpos + (track_count * 4);
- UINT32 dpos = pick_integer_le(&img[0], tpos, 4);
+ uint32_t tpos = POS_TRACK_OFFSET + (track * 4);
+ uint32_t spos = tpos + (track_count * 4);
+ uint32_t dpos = pick_integer_le(&img[0], tpos, 4);
if (!dpos)
continue;
@@ -68,12 +68,12 @@ bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if (dpos > size)
throw emu_fatalerror("g64_format: Track %u offset %06x out of bounds", track, dpos);
- UINT32 speed_zone = pick_integer_le(&img[0], spos, 4);
+ uint32_t speed_zone = pick_integer_le(&img[0], spos, 4);
if (speed_zone > 3)
throw emu_fatalerror("g64_format: Unsupported variable speed zones on track %d", track);
- UINT16 track_bytes = pick_integer_le(&img[0], dpos, 2);
+ uint16_t track_bytes = pick_integer_le(&img[0], dpos, 2);
int track_size = track_bytes * 8;
LOG_FORMATS("head %u track %u offs %u size %u cell %ld\n", head, cylinder, dpos, track_bytes, 200000000L/track_size);
@@ -89,7 +89,7 @@ bool g64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
return true;
}
-int g64_format::generate_bitstream(int track, int head, int speed_zone, UINT8 *trackbuf, int &track_size, floppy_image *image)
+int g64_format::generate_bitstream(int track, int head, int speed_zone, uint8_t *trackbuf, int &track_size, floppy_image *image)
{
int cell_size = c1541_cell_size[speed_zone];
@@ -108,19 +108,19 @@ bool g64_format::save(io_generic *io, floppy_image *image)
tracks = TRACK_COUNT * heads;
// write header
- UINT8 header[] = { 'G', 'C', 'R', '-', '1', '5', '4', '1', 0x00, static_cast<UINT8>(tracks), TRACK_LENGTH & 0xff, TRACK_LENGTH >> 8 };
+ uint8_t header[] = { 'G', 'C', 'R', '-', '1', '5', '4', '1', 0x00, static_cast<uint8_t>(tracks), TRACK_LENGTH & 0xff, TRACK_LENGTH >> 8 };
io_generic_write(io, header, POS_SIGNATURE, sizeof(header));
// write tracks
for (int head = 0; head < heads; head++) {
int tracks_written = 0;
- std::vector<UINT8> trackbuf(TRACK_LENGTH-2);
+ std::vector<uint8_t> trackbuf(TRACK_LENGTH-2);
for (int track = 0; track < TRACK_COUNT; track++) {
- UINT32 tpos = POS_TRACK_OFFSET + (track * 4);
- UINT32 spos = tpos + (tracks * 4);
- UINT32 dpos = POS_TRACK_OFFSET + (tracks * 4 * 2) + (tracks_written * TRACK_LENGTH);
+ uint32_t tpos = POS_TRACK_OFFSET + (track * 4);
+ uint32_t spos = tpos + (tracks * 4);
+ uint32_t dpos = POS_TRACK_OFFSET + (tracks * 4 * 2) + (tracks_written * TRACK_LENGTH);
io_generic_write_filler(io, 0x00, tpos, 4);
io_generic_write_filler(io, 0x00, spos, 4);
@@ -140,9 +140,9 @@ bool g64_format::save(io_generic *io, floppy_image *image)
LOG_FORMATS("head %u track %u size %u cell %u\n", head, track, track_size, c1541_cell_size[speed_zone]);
- UINT8 track_offset[4];
- UINT8 speed_offset[4];
- UINT8 track_length[2];
+ uint8_t track_offset[4];
+ uint8_t speed_offset[4];
+ uint8_t track_length[2];
place_integer_le(track_offset, 0, 4, dpos);
place_integer_le(speed_offset, 0, 4, speed_zone);
diff --git a/src/lib/formats/g64_dsk.h b/src/lib/formats/g64_dsk.h
index ddc12636b7e..e0966f8690e 100644
--- a/src/lib/formats/g64_dsk.h
+++ b/src/lib/formats/g64_dsk.h
@@ -18,8 +18,8 @@ class g64_format : public floppy_image_format_t {
public:
g64_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
@@ -43,9 +43,9 @@ protected:
TRACK_COUNT = 84
};
- static const UINT32 c1541_cell_size[];
+ static const uint32_t c1541_cell_size[];
- int generate_bitstream(int track, int head, int speed_zone, UINT8 *trackbuf, int &track_size, floppy_image *image);
+ int generate_bitstream(int track, int head, int speed_zone, uint8_t *trackbuf, int &track_size, floppy_image *image);
};
extern const floppy_format_type FLOPPY_G64_FORMAT;
diff --git a/src/lib/formats/gtp_cas.cpp b/src/lib/formats/gtp_cas.cpp
index 577d878b67a..fd3a16932b3 100644
--- a/src/lib/formats/gtp_cas.cpp
+++ b/src/lib/formats/gtp_cas.cpp
@@ -20,8 +20,8 @@
#define GTP_BLOCK_TURBO 0x01
#define GTP_BLOCK_NAME 0x10
-static INT16 wave_data;
-static INT16 len;
+static int16_t wave_data;
+static int16_t len;
#define PULSE_WIDTH 30
#define PERIOD_BASE 150
@@ -32,7 +32,7 @@ static INT16 len;
#define INTERBLOCK_PAUSE 100000
-static void gtp_output_wave( INT16 **buffer, int length ) {
+static void gtp_output_wave( int16_t **buffer, int length ) {
if ( buffer == nullptr ) {
return;
}
@@ -45,7 +45,7 @@ static void gtp_output_wave( INT16 **buffer, int length ) {
-static int gtp_mod_1( INT16 **buffer )
+static int gtp_mod_1( int16_t **buffer )
{
wave_data = WAVE_LOW;
gtp_output_wave(buffer,PULSE_WIDTH);
@@ -63,7 +63,7 @@ static int gtp_mod_1( INT16 **buffer )
return PERIOD_1 * 2;
}
-static int gtp_mod_0( INT16 **buffer )
+static int gtp_mod_0( int16_t **buffer )
{
wave_data = WAVE_LOW;
gtp_output_wave(buffer,PULSE_WIDTH);
@@ -75,9 +75,9 @@ static int gtp_mod_0( INT16 **buffer )
return PERIOD_0;
}
-static int gtp_byte( INT16 **buffer, UINT8 val )
+static int gtp_byte( int16_t **buffer, uint8_t val )
{
- UINT8 b;
+ uint8_t b;
int j,size = 0;
for (j=0;j<8;j++) {
b = (val >> j) & 1;
@@ -90,7 +90,7 @@ static int gtp_byte( INT16 **buffer, UINT8 val )
return size;
}
-static int gtp_sync( INT16 **buffer )
+static int gtp_sync( int16_t **buffer )
{
int i;
int size = 0;
@@ -107,7 +107,7 @@ static int gtp_sync( INT16 **buffer )
return size;
}
-static int gtp_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int gtp_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
int size,n;
size = 0;
n = 0;
@@ -128,7 +128,7 @@ static int gtp_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
return size;
}
-static int gtp_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int gtp_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int i,size,n;
size = 0;
n = 0;
diff --git a/src/lib/formats/hect_tap.cpp b/src/lib/formats/hect_tap.cpp
index d24c5625c78..4f823fb24e5 100644
--- a/src/lib/formats/hect_tap.cpp
+++ b/src/lib/formats/hect_tap.cpp
@@ -40,7 +40,7 @@ enum
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-static inline int hector_tap_cycle(INT16 *buffer, int sample_pos, int high, int low)
+static inline int hector_tap_cycle(int16_t *buffer, int sample_pos, int high, int low)
{
int i = 0;
@@ -62,7 +62,7 @@ static inline int hector_tap_cycle(INT16 *buffer, int sample_pos, int high, int
}
-static inline int hector_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
+static inline int hector_tap_byte(int16_t *buffer, int sample_pos, uint8_t data)
{
/* Writing an entire byte */
int i, samples;
@@ -81,7 +81,7 @@ static inline int hector_tap_byte(INT16 *buffer, int sample_pos, UINT8 data)
}
-static inline int hector_tap_synchro(INT16 *buffer, int sample_pos, int nb_synchro)
+static inline int hector_tap_synchro(int16_t *buffer, int sample_pos, int nb_synchro)
{
/* Writing an entire byte */
int i, samples;
@@ -94,7 +94,7 @@ static inline int hector_tap_synchro(INT16 *buffer, int sample_pos, int nb_synch
}
-static int hector_handle_tap(INT16 *buffer, const UINT8 *casdata)
+static int hector_handle_tap(int16_t *buffer, const uint8_t *casdata)
{
int data_pos, sample_count/*, block_count*/;
int previous_block=0;
@@ -110,7 +110,7 @@ static int hector_handle_tap(INT16 *buffer, const UINT8 *casdata)
/* on the entire file*/
while( data_pos < cas_size )
{
- UINT16 block_size;
+ uint16_t block_size;
if (previous_block == 0xFE)
/* Starting a block with 150 cycle of synchro to let time to Hector to do the job ! */
@@ -152,7 +152,7 @@ static int hector_handle_tap(INT16 *buffer, const UINT8 *casdata)
*******************************************************************/
-static int hector_handle_forth_tap(INT16 *buffer, const UINT8 *casdata)
+static int hector_handle_forth_tap(int16_t *buffer, const uint8_t *casdata)
{
int data_pos, sample_count/*, block_count*/;
/*int previous_block=0;*/
@@ -169,7 +169,7 @@ static int hector_handle_forth_tap(INT16 *buffer, const UINT8 *casdata)
/* on the entire file*/
while( data_pos < cas_size )
{
- UINT16 block_size;
+ uint16_t block_size;
/* Starting a block with 768 cycle of synchro*/
sample_count += hector_tap_synchro( buffer, sample_count, 768 );
@@ -204,7 +204,7 @@ static int hector_handle_forth_tap(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int hector_tap_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int hector_tap_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return hector_handle_tap( buffer, bytes );
}
@@ -213,7 +213,7 @@ static int hector_tap_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image FORTH
********************************************************************/
-static int hector_tap_forth_to_wav_size(const UINT8 *casdata, int caslen)
+static int hector_tap_forth_to_wav_size(const uint8_t *casdata, int caslen)
{
cas_size = caslen ;
@@ -223,7 +223,7 @@ static int hector_tap_forth_to_wav_size(const UINT8 *casdata, int caslen)
/*******************************************************************
Generate samples for the tape image FORTH
********************************************************************/
-static int hector_tap_forth_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int hector_tap_forth_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return hector_handle_forth_tap( buffer, bytes ); //forth removed here !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}
@@ -232,7 +232,7 @@ static int hector_tap_forth_fill_wave(INT16 *buffer, int sample_count, UINT8 *by
/*******************************************************************
Calculate the number of samples needed for this tape image classical
********************************************************************/
-static int hector_tap_to_wav_size(const UINT8 *casdata, int caslen)
+static int hector_tap_to_wav_size(const uint8_t *casdata, int caslen)
{
cas_size = caslen ;
diff --git a/src/lib/formats/hxchfe_dsk.cpp b/src/lib/formats/hxchfe_dsk.cpp
index 1e532e140b2..f85b1d31678 100644
--- a/src/lib/formats/hxchfe_dsk.cpp
+++ b/src/lib/formats/hxchfe_dsk.cpp
@@ -12,28 +12,28 @@
typedef struct picfileformatheader_
{
- UINT8 HEADERSIGNATURE[8]; // 0: "HXCPICFE"
- UINT8 formatrevision; // 8: Revision 0
- UINT8 number_of_track; // 9: Number of track in the file
- UINT8 number_of_side; // 10: Number of valid side (Not used by the emulator)
- UINT8 track_encoding; // 11: Track Encoding mode
+ uint8_t HEADERSIGNATURE[8]; // 0: "HXCPICFE"
+ uint8_t formatrevision; // 8: Revision 0
+ uint8_t number_of_track; // 9: Number of track in the file
+ uint8_t number_of_side; // 10: Number of valid side (Not used by the emulator)
+ uint8_t track_encoding; // 11: Track Encoding mode
// (Used for the write support - Please see the list above)
- UINT16 bitRate; // 12: Bitrate in Kbit/s. Ex : 250=250000bits/s
+ uint16_t bitRate; // 12: Bitrate in Kbit/s. Ex : 250=250000bits/s
// Max value : 500
- UINT16 floppyRPM; // 14: Rotation per minute (Not used by the emulator)
- UINT8 floppyinterfacemode; // 16: Floppy interface mode. (Please see the list above.)
- UINT8 dnu; // 17: Free
- UINT16 track_list_offset; // 18: Offset of the track list LUT in block of 512 bytes
+ uint16_t floppyRPM; // 14: Rotation per minute (Not used by the emulator)
+ uint8_t floppyinterfacemode; // 16: Floppy interface mode. (Please see the list above.)
+ uint8_t dnu; // 17: Free
+ uint16_t track_list_offset; // 18: Offset of the track list LUT in block of 512 bytes
// (Ex: 1=0x200)
- UINT8 write_allowed; // 20: The Floppy image is write protected ?
- UINT8 single_step; // 21: 0xFF : Single Step – 0x00 Double Step mode
- UINT8 track0s0_altencoding; // 22: 0x00 : Use an alternate track_encoding for track 0 Side 0
- UINT8 track0s0_encoding; // 23: alternate track_encoding for track 0 Side 0
- UINT8 track0s1_altencoding; // 24: 0x00 : Use an alternate track_encoding for track 0 Side 1
- UINT8 track0s1_encoding; // 25: alternate track_encoding for track 0 Side 1
+ uint8_t write_allowed; // 20: The Floppy image is write protected ?
+ uint8_t single_step; // 21: 0xFF : Single Step – 0x00 Double Step mode
+ uint8_t track0s0_altencoding; // 22: 0x00 : Use an alternate track_encoding for track 0 Side 0
+ uint8_t track0s0_encoding; // 23: alternate track_encoding for track 0 Side 0
+ uint8_t track0s1_altencoding; // 24: 0x00 : Use an alternate track_encoding for track 0 Side 1
+ uint8_t track0s1_encoding; // 25: alternate track_encoding for track 0 Side 1
} picfileformatheader;
- Byte order for UINT16 is little endian.
+ Byte order for uint16_t is little endian.
floppyintefacemode values are defined in the header file as floppymode_t,
track_encodings are defined as encoding_t
@@ -46,8 +46,8 @@
typedef struct pictrack_
{
- UINT16 offset; // Offset of the track data in blocks of 512 bytes (Ex: 2=0x400)
- UINT16 track_len; // Length of the track data in byte.
+ uint16_t offset; // Offset of the track data in blocks of 512 bytes (Ex: 2=0x400)
+ uint16_t track_len; // Length of the track data in byte.
} pictrack;
This table has a size of number_of_track*4 bytes.
@@ -142,9 +142,9 @@ bool hfe_format::supports_save() const
return true;
}
-int hfe_format::identify(io_generic *io, UINT32 form_factor)
+int hfe_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 header[8];
+ uint8_t header[8];
io_generic_read(io, &header, 0, sizeof(header));
if ( memcmp( header, HFE_FORMAT_HEADER, 8 ) ==0) {
@@ -153,10 +153,10 @@ int hfe_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool hfe_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool hfe_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 header[HEADER_LENGTH];
- UINT8 track_table[TRACK_TABLE_LENGTH];
+ uint8_t header[HEADER_LENGTH];
+ uint8_t track_table[TRACK_TABLE_LENGTH];
int drivecyl, driveheads;
image->get_maximal_geometry(drivecyl, driveheads);
@@ -233,7 +233,7 @@ bool hfe_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
}
// Load the tracks
- std::vector<UINT8> cylinder_buffer;
+ std::vector<uint8_t> cylinder_buffer;
for(int cyl=0; cyl < m_cylinders; cyl++)
{
// actual data read
@@ -288,7 +288,7 @@ bool hfe_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
return success;
}
-void hfe_format::generate_track_from_hfe_bitstream(int cyl, int head, int samplelength, const UINT8 *trackbuf, int track_end, floppy_image *image)
+void hfe_format::generate_track_from_hfe_bitstream(int cyl, int head, int samplelength, const uint8_t *trackbuf, int track_end, floppy_image *image)
{
// HFE has a minor issue: The track images do not sum up to 200 ms.
// Tracks are samples at 250 kbit/s for both FM and MFM, which yields
@@ -315,11 +315,11 @@ void hfe_format::generate_track_from_hfe_bitstream(int cyl, int head, int sample
// Cell: | AAAABBBB | = MG_1 = | BBBBAAAA |
// | AAAAAAAA | = MG_0 = | BBBBBBBB |
- std::vector<UINT32> &dest = image->get_buffer(cyl, head, 0);
+ std::vector<uint32_t> &dest = image->get_buffer(cyl, head, 0);
dest.clear();
// Start with MG_A
- UINT32 cbit = floppy_image::MG_A;
+ uint32_t cbit = floppy_image::MG_A;
int offset = 0x100;
@@ -329,7 +329,7 @@ void hfe_format::generate_track_from_hfe_bitstream(int cyl, int head, int sample
track_end -= 0x0100;
}
- UINT8 current = 0;
+ uint8_t current = 0;
int time = 0;
dest.push_back(cbit | time);
@@ -402,11 +402,11 @@ void hfe_format::generate_track_from_hfe_bitstream(int cyl, int head, int sample
bool hfe_format::save(io_generic *io, floppy_image *image)
{
- std::vector<UINT8> cylbuf;
+ std::vector<uint8_t> cylbuf;
cylbuf.resize(0x6200);
- UINT8 header[HEADER_LENGTH];
- UINT8 track_table[TRACK_TABLE_LENGTH];
+ uint8_t header[HEADER_LENGTH];
+ uint8_t track_table[TRACK_TABLE_LENGTH];
int track_end = 0x61c0;
int samplelength = 2000;
@@ -498,7 +498,7 @@ bool hfe_format::save(io_generic *io, floppy_image *image)
return true;
}
-void hfe_format::generate_hfe_bitstream_from_track(int cyl, int head, int& samplelength, encoding_t& encoding, UINT8 *cylinder_buffer, int track_end, floppy_image *image)
+void hfe_format::generate_hfe_bitstream_from_track(int cyl, int head, int& samplelength, encoding_t& encoding, uint8_t *cylinder_buffer, int track_end, floppy_image *image)
{
// We are using an own implementation here because the result of the
// parent class method would require some post-processing that we
@@ -508,7 +508,7 @@ void hfe_format::generate_hfe_bitstream_from_track(int cyl, int head, int& sampl
// as the original code
// No subtracks definded
- std::vector<UINT32> &tbuf = image->get_buffer(cyl, head, 0);
+ std::vector<uint32_t> &tbuf = image->get_buffer(cyl, head, 0);
if (tbuf.size() <= 1)
{
// Unformatted track
@@ -563,7 +563,7 @@ void hfe_format::generate_hfe_bitstream_from_track(int cyl, int head, int& sampl
}
// Start at the write splice
- UINT32 splice = image->get_write_splice_position(cyl, head, 0);
+ uint32_t splice = image->get_write_splice_position(cyl, head, 0);
int cur_pos = splice;
int cur_entry = 0;
@@ -579,7 +579,7 @@ void hfe_format::generate_hfe_bitstream_from_track(int cyl, int head, int& sampl
int max_period = int(samplelength*1.25);
int phase_adjust = 0;
int freq_hist = 0;
- UINT32 next = 0;
+ uint32_t next = 0;
int offset = 0x100;
@@ -590,8 +590,8 @@ void hfe_format::generate_hfe_bitstream_from_track(int cyl, int head, int& sampl
track_end -= 0x0100;
}
- UINT8 bit = 0x01;
- UINT8 current = 0;
+ uint8_t bit = 0x01;
+ uint8_t current = 0;
while (next < 200000000) {
int edge = tbuf[cur_entry] & floppy_image::TIME_MASK;
diff --git a/src/lib/formats/hxchfe_dsk.h b/src/lib/formats/hxchfe_dsk.h
index 4f322f659c3..af4652ca9bf 100644
--- a/src/lib/formats/hxchfe_dsk.h
+++ b/src/lib/formats/hxchfe_dsk.h
@@ -48,8 +48,8 @@ class hfe_format : public floppy_image_format_t
public:
hfe_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
@@ -61,8 +61,8 @@ public:
void set_encoding(encoding_t enc) { m_selected_encoding = enc; }
private:
- void generate_track_from_hfe_bitstream(int track, int head, int samplelength, const UINT8 *trackbuf, int track_end, floppy_image *image);
- void generate_hfe_bitstream_from_track(int track, int head, int& samplelength, encoding_t& encoding, UINT8 *trackbuf, int track_end, floppy_image *image);
+ void generate_track_from_hfe_bitstream(int track, int head, int samplelength, const uint8_t *trackbuf, int track_end, floppy_image *image);
+ void generate_hfe_bitstream_from_track(int track, int head, int& samplelength, encoding_t& encoding, uint8_t *trackbuf, int track_end, floppy_image *image);
// Header fields from the HFE format
int m_cylinders; // Number of track in the file
diff --git a/src/lib/formats/hxcmfm_dsk.cpp b/src/lib/formats/hxcmfm_dsk.cpp
index 07a05d3e2f6..274c8a7695f 100644
--- a/src/lib/formats/hxcmfm_dsk.cpp
+++ b/src/lib/formats/hxcmfm_dsk.cpp
@@ -11,24 +11,24 @@
struct MFMIMG
{
- UINT8 headername[7];
+ uint8_t headername[7];
- UINT16 number_of_track;
- UINT8 number_of_side;
+ uint16_t number_of_track;
+ uint8_t number_of_side;
- UINT16 floppyRPM;
- UINT16 floppyBitRate;
- UINT8 floppyiftype;
+ uint16_t floppyRPM;
+ uint16_t floppyBitRate;
+ uint8_t floppyiftype;
- UINT32 mfmtracklistoffset;
+ uint32_t mfmtracklistoffset;
};
struct MFMTRACKIMG
{
- UINT16 track_number;
- UINT8 side_number;
- UINT32 mfmtracksize;
- UINT32 mfmtrackoffset;
+ uint16_t track_number;
+ uint8_t side_number;
+ uint32_t mfmtracksize;
+ uint32_t mfmtrackoffset;
};
#pragma pack()
@@ -57,9 +57,9 @@ bool mfm_format::supports_save() const
return true;
}
-int mfm_format::identify(io_generic *io, UINT32 form_factor)
+int mfm_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 header[7];
+ uint8_t header[7];
io_generic_read(io, &header, 0, sizeof(header));
if ( memcmp( header, MFM_FORMAT_HEADER, 6 ) ==0) {
@@ -68,7 +68,7 @@ int mfm_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool mfm_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool mfm_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
MFMIMG header;
MFMTRACKIMG trackdesc;
@@ -76,7 +76,7 @@ bool mfm_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
// read header
io_generic_read(io, &header, 0, sizeof(header));
int counter = 0;
- std::vector<UINT8> trackbuf;
+ std::vector<uint8_t> trackbuf;
for(int track=0; track < header.number_of_track; track++) {
for(int side=0; side < header.number_of_side; side++) {
// read location of
@@ -117,7 +117,7 @@ bool mfm_format::save(io_generic *io, floppy_image *image)
int tpos = sizeof(MFMIMG);
int dpos = tpos + track_count*head_count*sizeof(MFMTRACKIMG);
- UINT8 trackbuf[150000/8];
+ uint8_t trackbuf[150000/8];
for(int track=0; track < track_count; track++) {
for(int side=0; side < head_count; side++) {
diff --git a/src/lib/formats/hxcmfm_dsk.h b/src/lib/formats/hxcmfm_dsk.h
index 63238ab2006..eb2f8ae245b 100644
--- a/src/lib/formats/hxcmfm_dsk.h
+++ b/src/lib/formats/hxcmfm_dsk.h
@@ -18,8 +18,8 @@ class mfm_format : public floppy_image_format_t
public:
mfm_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
diff --git a/src/lib/formats/imageutl.h b/src/lib/formats/imageutl.h
index 7da4a184112..5e478cfb1e7 100644
--- a/src/lib/formats/imageutl.h
+++ b/src/lib/formats/imageutl.h
@@ -25,43 +25,43 @@ unsigned short ccitt_crc16_one( unsigned short crc, const unsigned char data );
* Alignment-friendly integer placement
* ----------------------------------------------------------------------- */
-static inline void place_integer_be(void *ptr, size_t offset, size_t size, UINT64 value)
+static inline void place_integer_be(void *ptr, size_t offset, size_t size, uint64_t value)
{
- UINT8 *byte_ptr = ((UINT8 *) ptr) + offset;
- UINT16 val16;
- UINT32 val32;
+ uint8_t *byte_ptr = ((uint8_t *) ptr) + offset;
+ uint16_t val16;
+ uint32_t val32;
switch(size)
{
case 2:
- val16 = big_endianize_int16((UINT16) value);
+ val16 = big_endianize_int16((uint16_t) value);
memcpy(byte_ptr, &val16, sizeof(val16));
break;
case 4:
- val32 = big_endianize_int32((UINT32) value);
+ val32 = big_endianize_int32((uint32_t) value);
memcpy(byte_ptr, &val32, sizeof(val32));
break;
default:
- if (size >= 1) byte_ptr[0] = (UINT8) (value >> ((size - 1) * 8));
- if (size >= 2) byte_ptr[1] = (UINT8) (value >> ((size - 2) * 8));
- if (size >= 3) byte_ptr[2] = (UINT8) (value >> ((size - 3) * 8));
- if (size >= 4) byte_ptr[3] = (UINT8) (value >> ((size - 4) * 8));
- if (size >= 5) byte_ptr[4] = (UINT8) (value >> ((size - 5) * 8));
- if (size >= 6) byte_ptr[5] = (UINT8) (value >> ((size - 6) * 8));
- if (size >= 7) byte_ptr[6] = (UINT8) (value >> ((size - 7) * 8));
- if (size >= 8) byte_ptr[7] = (UINT8) (value >> ((size - 8) * 8));
+ if (size >= 1) byte_ptr[0] = (uint8_t) (value >> ((size - 1) * 8));
+ if (size >= 2) byte_ptr[1] = (uint8_t) (value >> ((size - 2) * 8));
+ if (size >= 3) byte_ptr[2] = (uint8_t) (value >> ((size - 3) * 8));
+ if (size >= 4) byte_ptr[3] = (uint8_t) (value >> ((size - 4) * 8));
+ if (size >= 5) byte_ptr[4] = (uint8_t) (value >> ((size - 5) * 8));
+ if (size >= 6) byte_ptr[5] = (uint8_t) (value >> ((size - 6) * 8));
+ if (size >= 7) byte_ptr[6] = (uint8_t) (value >> ((size - 7) * 8));
+ if (size >= 8) byte_ptr[7] = (uint8_t) (value >> ((size - 8) * 8));
break;
}
}
-static inline UINT64 pick_integer_be(const void *ptr, size_t offset, size_t size)
+static inline uint64_t pick_integer_be(const void *ptr, size_t offset, size_t size)
{
- UINT64 result = 0;
- const UINT8 *byte_ptr = ((const UINT8 *) ptr) + offset;
- UINT16 val16;
- UINT32 val32;
+ uint64_t result = 0;
+ const uint8_t *byte_ptr = ((const uint8_t *) ptr) + offset;
+ uint16_t val16;
+ uint32_t val32;
switch(size)
{
@@ -80,56 +80,56 @@ static inline UINT64 pick_integer_be(const void *ptr, size_t offset, size_t size
break;
default:
- if (size >= 1) result |= ((UINT64) byte_ptr[0]) << ((size - 1) * 8);
- if (size >= 2) result |= ((UINT64) byte_ptr[1]) << ((size - 2) * 8);
- if (size >= 3) result |= ((UINT64) byte_ptr[2]) << ((size - 3) * 8);
- if (size >= 4) result |= ((UINT64) byte_ptr[3]) << ((size - 4) * 8);
- if (size >= 5) result |= ((UINT64) byte_ptr[4]) << ((size - 5) * 8);
- if (size >= 6) result |= ((UINT64) byte_ptr[5]) << ((size - 6) * 8);
- if (size >= 7) result |= ((UINT64) byte_ptr[6]) << ((size - 7) * 8);
- if (size >= 8) result |= ((UINT64) byte_ptr[7]) << ((size - 8) * 8);
+ if (size >= 1) result |= ((uint64_t) byte_ptr[0]) << ((size - 1) * 8);
+ if (size >= 2) result |= ((uint64_t) byte_ptr[1]) << ((size - 2) * 8);
+ if (size >= 3) result |= ((uint64_t) byte_ptr[2]) << ((size - 3) * 8);
+ if (size >= 4) result |= ((uint64_t) byte_ptr[3]) << ((size - 4) * 8);
+ if (size >= 5) result |= ((uint64_t) byte_ptr[4]) << ((size - 5) * 8);
+ if (size >= 6) result |= ((uint64_t) byte_ptr[5]) << ((size - 6) * 8);
+ if (size >= 7) result |= ((uint64_t) byte_ptr[6]) << ((size - 7) * 8);
+ if (size >= 8) result |= ((uint64_t) byte_ptr[7]) << ((size - 8) * 8);
break;
}
return result;
}
-static inline void place_integer_le(void *ptr, size_t offset, size_t size, UINT64 value)
+static inline void place_integer_le(void *ptr, size_t offset, size_t size, uint64_t value)
{
- UINT8 *byte_ptr = ((UINT8 *) ptr) + offset;
- UINT16 val16;
- UINT32 val32;
+ uint8_t *byte_ptr = ((uint8_t *) ptr) + offset;
+ uint16_t val16;
+ uint32_t val32;
switch(size)
{
case 2:
- val16 = little_endianize_int16((UINT16) value);
+ val16 = little_endianize_int16((uint16_t) value);
memcpy(byte_ptr, &val16, sizeof(val16));
break;
case 4:
- val32 = little_endianize_int32((UINT32) value);
+ val32 = little_endianize_int32((uint32_t) value);
memcpy(byte_ptr, &val32, sizeof(val32));
break;
default:
- if (size >= 1) byte_ptr[0] = (UINT8) (value >> (0 * 8));
- if (size >= 2) byte_ptr[1] = (UINT8) (value >> (1 * 8));
- if (size >= 3) byte_ptr[2] = (UINT8) (value >> (2 * 8));
- if (size >= 4) byte_ptr[3] = (UINT8) (value >> (3 * 8));
- if (size >= 5) byte_ptr[4] = (UINT8) (value >> (4 * 8));
- if (size >= 6) byte_ptr[5] = (UINT8) (value >> (5 * 8));
- if (size >= 7) byte_ptr[6] = (UINT8) (value >> (6 * 8));
- if (size >= 8) byte_ptr[7] = (UINT8) (value >> (7 * 8));
+ if (size >= 1) byte_ptr[0] = (uint8_t) (value >> (0 * 8));
+ if (size >= 2) byte_ptr[1] = (uint8_t) (value >> (1 * 8));
+ if (size >= 3) byte_ptr[2] = (uint8_t) (value >> (2 * 8));
+ if (size >= 4) byte_ptr[3] = (uint8_t) (value >> (3 * 8));
+ if (size >= 5) byte_ptr[4] = (uint8_t) (value >> (4 * 8));
+ if (size >= 6) byte_ptr[5] = (uint8_t) (value >> (5 * 8));
+ if (size >= 7) byte_ptr[6] = (uint8_t) (value >> (6 * 8));
+ if (size >= 8) byte_ptr[7] = (uint8_t) (value >> (7 * 8));
break;
}
}
-static inline UINT64 pick_integer_le(const void *ptr, size_t offset, size_t size)
+static inline uint64_t pick_integer_le(const void *ptr, size_t offset, size_t size)
{
- UINT64 result = 0;
- const UINT8 *byte_ptr = ((const UINT8 *) ptr) + offset;
- UINT16 val16;
- UINT32 val32;
+ uint64_t result = 0;
+ const uint8_t *byte_ptr = ((const uint8_t *) ptr) + offset;
+ uint16_t val16;
+ uint32_t val32;
switch(size)
{
@@ -148,14 +148,14 @@ static inline UINT64 pick_integer_le(const void *ptr, size_t offset, size_t size
break;
default:
- if (size >= 1) result |= ((UINT64) byte_ptr[0]) << (0 * 8);
- if (size >= 2) result |= ((UINT64) byte_ptr[1]) << (1 * 8);
- if (size >= 3) result |= ((UINT64) byte_ptr[2]) << (2 * 8);
- if (size >= 4) result |= ((UINT64) byte_ptr[3]) << (3 * 8);
- if (size >= 5) result |= ((UINT64) byte_ptr[4]) << (4 * 8);
- if (size >= 6) result |= ((UINT64) byte_ptr[5]) << (5 * 8);
- if (size >= 7) result |= ((UINT64) byte_ptr[6]) << (6 * 8);
- if (size >= 8) result |= ((UINT64) byte_ptr[7]) << (7 * 8);
+ if (size >= 1) result |= ((uint64_t) byte_ptr[0]) << (0 * 8);
+ if (size >= 2) result |= ((uint64_t) byte_ptr[1]) << (1 * 8);
+ if (size >= 3) result |= ((uint64_t) byte_ptr[2]) << (2 * 8);
+ if (size >= 4) result |= ((uint64_t) byte_ptr[3]) << (3 * 8);
+ if (size >= 5) result |= ((uint64_t) byte_ptr[4]) << (4 * 8);
+ if (size >= 6) result |= ((uint64_t) byte_ptr[5]) << (5 * 8);
+ if (size >= 7) result |= ((uint64_t) byte_ptr[6]) << (6 * 8);
+ if (size >= 8) result |= ((uint64_t) byte_ptr[7]) << (7 * 8);
break;
}
return result;
diff --git a/src/lib/formats/imd_dsk.cpp b/src/lib/formats/imd_dsk.cpp
index 13f155b638a..8f3626aedbb 100644
--- a/src/lib/formats/imd_dsk.cpp
+++ b/src/lib/formats/imd_dsk.cpp
@@ -17,7 +17,7 @@ struct imddsk_tag
int heads;
int tracks;
int sector_size;
- UINT64 track_offsets[84*2]; /* offset within data for each track */
+ uint64_t track_offsets[84*2]; /* offset within data for each track */
};
@@ -32,7 +32,7 @@ static struct imddsk_tag *get_tag(floppy_image_legacy *floppy)
FLOPPY_IDENTIFY( imd_dsk_identify )
{
- UINT8 header[3];
+ uint8_t header[3];
floppy_image_read(floppy, header, 0, 3);
if (header[0]=='I' && header[1]=='M' && header[2]=='D') {
@@ -53,16 +53,16 @@ static int imd_get_tracks_per_disk(floppy_image_legacy *floppy)
return get_tag(floppy)->tracks;
}
-static UINT64 imd_get_track_offset(floppy_image_legacy *floppy, int head, int track)
+static uint64_t imd_get_track_offset(floppy_image_legacy *floppy, int head, int track)
{
return get_tag(floppy)->track_offsets[(track<<1) + head];
}
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
- UINT64 offs = 0;
- UINT8 header[5];
- UINT8 sector_num;
+ uint64_t offs = 0;
+ uint8_t header[5];
+ uint8_t sector_num;
int i;
@@ -98,9 +98,9 @@ static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, in
static floperr_t internal_imd_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
- UINT8 header[1];
+ uint8_t header[1];
// take sector offset
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
@@ -137,25 +137,25 @@ static floperr_t imd_read_indexed_sector(floppy_image_legacy *floppy, int head,
return internal_imd_read_sector(floppy, head, track, sector, TRUE, buffer, buflen);
}
-static floperr_t imd_expand_file(floppy_image_legacy *floppy , UINT64 offset , size_t amount)
+static floperr_t imd_expand_file(floppy_image_legacy *floppy , uint64_t offset , size_t amount)
{
if (amount == 0) {
return FLOPPY_ERROR_SUCCESS;
}
- UINT64 file_size = floppy_image_size(floppy);
+ uint64_t file_size = floppy_image_size(floppy);
if (offset > file_size) {
return FLOPPY_ERROR_INTERNAL;
}
- UINT64 size_after_off = file_size - offset;
+ uint64_t size_after_off = file_size - offset;
if (size_after_off == 0) {
return FLOPPY_ERROR_SUCCESS;
}
- auto buffer = global_alloc_array(UINT8 , size_after_off);
+ auto buffer = global_alloc_array(uint8_t , size_after_off);
// Read the part of file after offset
floppy_image_read(floppy , buffer , offset , size_after_off);
@@ -172,7 +172,7 @@ static floperr_t imd_expand_file(floppy_image_legacy *floppy , UINT64 offset , s
struct imddsk_tag *tag = get_tag(floppy);
for (int track = 0; track < tag->tracks; track++) {
for (int head = 0; head < tag->heads; head++) {
- UINT64 *track_off = &(tag->track_offsets[ (track << 1) + head ]);
+ uint64_t *track_off = &(tag->track_offsets[ (track << 1) + head ]);
if (*track_off >= offset) {
*track_off += amount;
}
@@ -184,9 +184,9 @@ static floperr_t imd_expand_file(floppy_image_legacy *floppy , UINT64 offset , s
static floperr_t imd_write_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector_index, const void *buffer, size_t buflen, int ddam)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
- UINT8 header[1];
+ uint8_t header[1];
// take sector offset
err = get_offset(floppy, head, track, sector_index, TRUE, &offset);
@@ -222,7 +222,7 @@ static floperr_t imd_write_indexed_sector(floppy_image_legacy *floppy, int head,
return FLOPPY_ERROR_SUCCESS;
}
-static floperr_t imd_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t imd_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
@@ -235,14 +235,14 @@ static floperr_t imd_get_sector_length(floppy_image_legacy *floppy, int head, in
return FLOPPY_ERROR_SUCCESS;
}
-static floperr_t imd_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t imd_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
- UINT64 offset;
- UINT8 header[5];
- UINT8 hd;
- UINT8 tr;
- UINT32 sector_size;
- UINT8 sector_num;
+ uint64_t offset;
+ uint8_t header[5];
+ uint8_t hd;
+ uint8_t tr;
+ uint32_t sector_size;
+ uint8_t sector_num;
offset = imd_get_track_offset(floppy,head,track);
floppy_image_read(floppy, header, offset, 5);
@@ -279,7 +279,7 @@ static floperr_t imd_get_indexed_sector_info(floppy_image_legacy *floppy, int he
*sector_length = sector_size;
}
if (flags) {
- UINT8 skip;
+ uint8_t skip;
if (head & 0x40) {
if (head & 0x80) {
skip = 3;
@@ -302,8 +302,8 @@ FLOPPY_CONSTRUCT( imd_dsk_construct )
{
struct FloppyCallbacks *callbacks;
struct imddsk_tag *tag;
- UINT8 header[0x100];
- UINT64 pos = 0;
+ uint8_t header[0x100];
+ uint64_t pos = 0;
int sector_size = 0;
int sector_num;
int i;
@@ -409,7 +409,7 @@ void imd_format::fixnum(char *start, char *end) const
};
}
-int imd_format::identify(io_generic *io, UINT32 form_factor)
+int imd_format::identify(io_generic *io, uint32_t form_factor)
{
char h[4];
@@ -420,13 +420,13 @@ int imd_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool imd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> img(size);
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> img(size);
io_generic_read(io, &img[0], 0, size);
- UINT64 pos;
+ uint64_t pos;
for(pos=0; pos < size && img[pos] != 0x1a; pos++) {};
pos++;
@@ -434,16 +434,16 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
return false;
while(pos < size) {
- UINT8 mode = img[pos++];
- UINT8 track = img[pos++];
- UINT8 head = img[pos++];
- UINT8 sector_count = img[pos++];
- UINT8 ssize = img[pos++];
+ uint8_t mode = img[pos++];
+ uint8_t track = img[pos++];
+ uint8_t head = img[pos++];
+ uint8_t sector_count = img[pos++];
+ uint8_t ssize = img[pos++];
if(ssize == 0xff)
throw emu_fatalerror("imd_format: Unsupported variable sector size on track %d head %d", track, head);
- UINT32 actual_size = ssize < 7 ? 128 << ssize : 8192;
+ uint32_t actual_size = ssize < 7 ? 128 << ssize : 8192;
static const int rates[3] = { 500000, 300000, 250000 };
bool fm = mode < 3;
@@ -451,12 +451,12 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int rpm = form_factor == floppy_image::FF_8 || (form_factor == floppy_image::FF_525 && rate >= 300000) ? 360 : 300;
int cell_count = (fm ? 1 : 2)*rate*60/rpm;
- const UINT8 *snum = &img[pos];
+ const uint8_t *snum = &img[pos];
pos += sector_count;
- const UINT8 *tnum = head & 0x80 ? &img[pos] : nullptr;
+ const uint8_t *tnum = head & 0x80 ? &img[pos] : nullptr;
if(tnum)
pos += sector_count;
- const UINT8 *hnum = head & 0x40 ? &img[pos] : nullptr;
+ const uint8_t *hnum = head & 0x40 ? &img[pos] : nullptr;
if(hnum)
pos += sector_count;
@@ -467,7 +467,7 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
desc_pc_sector sects[256];
for(int i=0; i<sector_count; i++) {
- UINT8 stype = img[pos++];
+ uint8_t stype = img[pos++];
sects[i].track = tnum ? tnum[i] : track;
sects[i].head = hnum ? hnum[i] : head;
sects[i].sector = snum[i];
@@ -482,7 +482,7 @@ bool imd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
sects[i].bad_crc = stype == 5 || stype == 6 || stype == 7 || stype == 8;
if(stype == 2 || stype == 4 || stype == 6 || stype == 8) {
- sects[i].data = global_alloc_array(UINT8, actual_size);
+ sects[i].data = global_alloc_array(uint8_t, actual_size);
memset(sects[i].data, img[pos++], actual_size);
} else {
diff --git a/src/lib/formats/imd_dsk.h b/src/lib/formats/imd_dsk.h
index 5f26de88d75..306fd544c7e 100644
--- a/src/lib/formats/imd_dsk.h
+++ b/src/lib/formats/imd_dsk.h
@@ -19,8 +19,8 @@ class imd_format : public floppy_image_format_t
public:
imd_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/ioprocs.cpp b/src/lib/formats/ioprocs.cpp
index 0be7cab97f4..69943c13dc0 100644
--- a/src/lib/formats/ioprocs.cpp
+++ b/src/lib/formats/ioprocs.cpp
@@ -17,7 +17,7 @@ static void stdio_closeproc(void *file)
fclose((FILE*)file);
}
-static int stdio_seekproc(void *file, INT64 offset, int whence)
+static int stdio_seekproc(void *file, int64_t offset, int whence)
{
return fseek((FILE*)file, (long) offset, whence);
}
@@ -32,7 +32,7 @@ static size_t stdio_writeproc(void *file, const void *buffer, size_t length)
return fwrite(buffer, 1, length, (FILE*)file);
}
-static UINT64 stdio_filesizeproc(void *file)
+static uint64_t stdio_filesizeproc(void *file)
{
long l, sz;
l = ftell((FILE*)file);
@@ -71,7 +71,7 @@ static void corefile_closeproc(void *file)
delete (util::core_file*)file;
}
-static int corefile_seekproc(void *file, INT64 offset, int whence)
+static int corefile_seekproc(void *file, int64_t offset, int whence)
{
return ((util::core_file*)file)->seek(offset, whence);
}
@@ -86,15 +86,15 @@ static size_t corefile_writeproc(void *file, const void *buffer, size_t length)
return ((util::core_file*)file)->write(buffer, length);
}
-static UINT64 corefile_filesizeproc(void *file)
+static uint64_t corefile_filesizeproc(void *file)
{
const auto l = ((util::core_file*)file)->tell();
if (((util::core_file*)file)->seek(0, SEEK_END))
return (size_t) -1;
const auto sz = ((util::core_file*)file)->tell();
if (((util::core_file*)file)->seek(l, SEEK_SET))
- return UINT64(-1);
- return UINT64(sz);
+ return uint64_t(-1);
+ return uint64_t(sz);
}
const struct io_procs corefile_ioprocs =
@@ -121,7 +121,7 @@ const struct io_procs corefile_ioprocs_noclose =
calls for accessing generic IO
*********************************************************************/
-static void io_generic_seek(struct io_generic *genio, UINT64 offset)
+static void io_generic_seek(struct io_generic *genio, uint64_t offset)
{
genio->procs->seekproc(genio->file, offset, SEEK_SET);
}
@@ -136,9 +136,9 @@ void io_generic_close(struct io_generic *genio)
-void io_generic_read(struct io_generic *genio, void *buffer, UINT64 offset, size_t length)
+void io_generic_read(struct io_generic *genio, void *buffer, uint64_t offset, size_t length)
{
- UINT64 size;
+ uint64_t size;
size_t bytes_read;
size = io_generic_size(genio);
@@ -151,17 +151,17 @@ void io_generic_read(struct io_generic *genio, void *buffer, UINT64 offset, size
io_generic_seek(genio, offset);
bytes_read = genio->procs->readproc(genio->file, buffer, length);
}
- memset(((UINT8 *) buffer) + bytes_read, genio->filler, length - bytes_read);
+ memset(((uint8_t *) buffer) + bytes_read, genio->filler, length - bytes_read);
}
-void io_generic_write(struct io_generic *genio, const void *buffer, UINT64 offset, size_t length)
+void io_generic_write(struct io_generic *genio, const void *buffer, uint64_t offset, size_t length)
{
- UINT64 filler_size = 0;
+ uint64_t filler_size = 0;
char filler_buffer[1024];
size_t bytes_to_write;
- UINT64 size;
+ uint64_t size;
size = io_generic_size(genio);
@@ -191,9 +191,9 @@ void io_generic_write(struct io_generic *genio, const void *buffer, UINT64 offse
-void io_generic_write_filler(struct io_generic *genio, UINT8 filler, UINT64 offset, size_t length)
+void io_generic_write_filler(struct io_generic *genio, uint8_t filler, uint64_t offset, size_t length)
{
- UINT8 buffer[512];
+ uint8_t buffer[512];
size_t this_length;
memset(buffer, filler, std::min(length, sizeof(buffer)));
@@ -209,7 +209,7 @@ void io_generic_write_filler(struct io_generic *genio, UINT8 filler, UINT64 offs
-UINT64 io_generic_size(struct io_generic *genio)
+uint64_t io_generic_size(struct io_generic *genio)
{
return genio->procs->filesizeproc(genio->file);
}
diff --git a/src/lib/formats/ioprocs.h b/src/lib/formats/ioprocs.h
index 08acbe45295..ac032d5e1f3 100644
--- a/src/lib/formats/ioprocs.h
+++ b/src/lib/formats/ioprocs.h
@@ -24,10 +24,10 @@
struct io_procs
{
void (*closeproc)(void *file);
- int (*seekproc)(void *file, INT64 offset, int whence);
+ int (*seekproc)(void *file, int64_t offset, int whence);
size_t (*readproc)(void *file, void *buffer, size_t length);
size_t (*writeproc)(void *file, const void *buffer, size_t length);
- UINT64 (*filesizeproc)(void *file);
+ uint64_t (*filesizeproc)(void *file);
};
@@ -36,7 +36,7 @@ struct io_generic
{
const struct io_procs *procs;
void *file;
- UINT8 filler;
+ uint8_t filler;
};
@@ -62,10 +62,10 @@ extern const struct io_procs corefile_ioprocs_noclose;
void io_generic_close(struct io_generic *genio);
-void io_generic_read(struct io_generic *genio, void *buffer, UINT64 offset, size_t length);
-void io_generic_write(struct io_generic *genio, const void *buffer, UINT64 offset, size_t length);
-void io_generic_write_filler(struct io_generic *genio, UINT8 filler, UINT64 offset, size_t length);
-UINT64 io_generic_size(struct io_generic *genio);
+void io_generic_read(struct io_generic *genio, void *buffer, uint64_t offset, size_t length);
+void io_generic_write(struct io_generic *genio, const void *buffer, uint64_t offset, size_t length);
+void io_generic_write_filler(struct io_generic *genio, uint8_t filler, uint64_t offset, size_t length);
+uint64_t io_generic_size(struct io_generic *genio);
diff --git a/src/lib/formats/ipf_dsk.cpp b/src/lib/formats/ipf_dsk.cpp
index 40ad1229ab8..da50e850ea8 100644
--- a/src/lib/formats/ipf_dsk.cpp
+++ b/src/lib/formats/ipf_dsk.cpp
@@ -30,10 +30,10 @@ bool ipf_format::supports_save() const
return false;
}
-int ipf_format::identify(io_generic *io, UINT32 form_factor)
+int ipf_format::identify(io_generic *io, uint32_t form_factor)
{
- static const UINT8 refh[12] = { 0x43, 0x41, 0x50, 0x53, 0x00, 0x00, 0x00, 0x0c, 0x1c, 0xd5, 0x73, 0xba };
- UINT8 h[12];
+ static const uint8_t refh[12] = { 0x43, 0x41, 0x50, 0x53, 0x00, 0x00, 0x00, 0x0c, 0x1c, 0xd5, 0x73, 0xba };
+ uint8_t h[12];
io_generic_read(io, h, 0, 12);
if(!memcmp(h, refh, 12))
@@ -42,34 +42,34 @@ int ipf_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool ipf_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool ipf_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> data(size);
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> data(size);
io_generic_read(io, &data[0], 0, size);
bool res = parse(data, image);
return res;
}
-UINT32 ipf_format::r32(const UINT8 *p)
+uint32_t ipf_format::r32(const uint8_t *p)
{
return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
}
-UINT32 ipf_format::rb(const UINT8 *&p, int count)
+uint32_t ipf_format::rb(const uint8_t *&p, int count)
{
- UINT32 v = 0;
+ uint32_t v = 0;
for(int i=0; i<count; i++)
v = (v << 8) | *p++;
return v;
}
-UINT32 ipf_format::crc32r(const UINT8 *data, UINT32 size)
+uint32_t ipf_format::crc32r(const uint8_t *data, uint32_t size)
{
// Reversed crc32
- UINT32 crc = 0xffffffff;
- for(UINT32 i=0; i != size; i++) {
+ uint32_t crc = 0xffffffff;
+ for(uint32_t i=0; i != size; i++) {
crc = crc ^ data[i];
for(int j=0; j<8; j++)
if(crc & 1)
@@ -80,7 +80,7 @@ UINT32 ipf_format::crc32r(const UINT8 *data, UINT32 size)
return ~crc;
}
-bool ipf_format::parse(std::vector<UINT8> &data, floppy_image *image)
+bool ipf_format::parse(std::vector<uint8_t> &data, floppy_image *image)
{
image->set_variant(floppy_image::DSDD); // Not handling anything else yet
tcount = 84*2+1; // Usual max
@@ -93,7 +93,7 @@ bool ipf_format::parse(std::vector<UINT8> &data, floppy_image *image)
return res;
}
-bool ipf_format::parse_info(const UINT8 *info)
+bool ipf_format::parse_info(const uint8_t *info)
{
type = r32(info+12);
if(type != 1)
@@ -116,7 +116,7 @@ bool ipf_format::parse_info(const UINT8 *info)
return true;
}
-ipf_format::track_info *ipf_format::get_index(UINT32 idx)
+ipf_format::track_info *ipf_format::get_index(uint32_t idx)
{
if(idx > 1000)
return nullptr;
@@ -131,7 +131,7 @@ ipf_format::track_info *ipf_format::get_index(UINT32 idx)
return tinfos+idx;
}
-bool ipf_format::parse_imge(const UINT8 *imge)
+bool ipf_format::parse_imge(const uint8_t *imge)
{
track_info *t = get_index(r32(imge+64));
if(!t)
@@ -165,7 +165,7 @@ bool ipf_format::parse_imge(const UINT8 *imge)
return true;
}
-bool ipf_format::parse_data(const UINT8 *data, UINT32 &pos, UINT32 max_extra_size)
+bool ipf_format::parse_data(const uint8_t *data, uint32_t &pos, uint32_t max_extra_size)
{
track_info *t = get_index(r32(data+24));
if(!t)
@@ -182,7 +182,7 @@ bool ipf_format::parse_data(const UINT8 *data, UINT32 &pos, UINT32 max_extra_siz
return true;
}
-bool ipf_format::scan_one_tag(std::vector<UINT8> &data, UINT32 &pos, UINT8 *&tag, UINT32 &tsize)
+bool ipf_format::scan_one_tag(std::vector<uint8_t> &data, uint32_t &pos, uint8_t *&tag, uint32_t &tsize)
{
if(data.size()-pos < 12)
return false;
@@ -190,7 +190,7 @@ bool ipf_format::scan_one_tag(std::vector<UINT8> &data, UINT32 &pos, UINT8 *&tag
tsize = r32(tag+4);
if(data.size()-pos < tsize)
return false;
- UINT32 crc = r32(tag+8);
+ uint32_t crc = r32(tag+8);
tag[8] = tag[9] = tag[10] = tag[11] = 0;
if(crc32r(tag, tsize) != crc)
return false;
@@ -198,13 +198,13 @@ bool ipf_format::scan_one_tag(std::vector<UINT8> &data, UINT32 &pos, UINT8 *&tag
return true;
}
-bool ipf_format::scan_all_tags(std::vector<UINT8> &data)
+bool ipf_format::scan_all_tags(std::vector<uint8_t> &data)
{
- UINT32 pos = 0;
- UINT32 size = data.size();
+ uint32_t pos = 0;
+ uint32_t size = data.size();
while(pos != size) {
- UINT8 *tag;
- UINT32 tsize;
+ uint8_t *tag;
+ uint32_t tsize;
if(!scan_one_tag(data, pos, tag, tsize))
return false;
@@ -245,7 +245,7 @@ bool ipf_format::scan_all_tags(std::vector<UINT8> &data)
bool ipf_format::generate_tracks(floppy_image *image)
{
- for(UINT32 i = 0; i != tcount; i++) {
+ for(uint32_t i = 0; i != tcount; i++) {
track_info *t = tinfos + i;
if(t->info_set && t->data) {
if(!generate_track(t, image))
@@ -257,14 +257,14 @@ bool ipf_format::generate_tracks(floppy_image *image)
return true;
}
-void ipf_format::rotate(std::vector<UINT32> &track, UINT32 offset, UINT32 size)
+void ipf_format::rotate(std::vector<uint32_t> &track, uint32_t offset, uint32_t size)
{
- UINT32 done = 0;
- for(UINT32 bpos=0; done < size; bpos++) {
- UINT32 pos = bpos;
- UINT32 hold = track[pos];
+ uint32_t done = 0;
+ for(uint32_t bpos=0; done < size; bpos++) {
+ uint32_t pos = bpos;
+ uint32_t hold = track[pos];
for(;;) {
- UINT32 npos = pos+offset;
+ uint32_t npos = pos+offset;
if(npos >= size)
npos -= size;
if(npos == bpos)
@@ -278,11 +278,11 @@ void ipf_format::rotate(std::vector<UINT32> &track, UINT32 offset, UINT32 size)
}
}
-void ipf_format::mark_track_splice(std::vector<UINT32> &track, UINT32 offset, UINT32 size)
+void ipf_format::mark_track_splice(std::vector<uint32_t> &track, uint32_t offset, uint32_t size)
{
for(int i=0; i<3; i++) {
- UINT32 pos = (offset + i) % size;
- UINT32 v = track[pos];
+ uint32_t pos = (offset + i) % size;
+ uint32_t v = track[pos];
if((v & floppy_image::MG_MASK) == MG_0)
v = (v & floppy_image::TIME_MASK) | MG_1;
else if((v & floppy_image::MG_MASK) == MG_1)
@@ -291,13 +291,13 @@ void ipf_format::mark_track_splice(std::vector<UINT32> &track, UINT32 offset, UI
}
}
-void ipf_format::timing_set(std::vector<UINT32> &track, UINT32 start, UINT32 end, UINT32 time)
+void ipf_format::timing_set(std::vector<uint32_t> &track, uint32_t start, uint32_t end, uint32_t time)
{
- for(UINT32 i=start; i != end; i++)
+ for(uint32_t i=start; i != end; i++)
track[i] = (track[i] & floppy_image::MG_MASK) | time;
}
-bool ipf_format::generate_timings(track_info *t, std::vector<UINT32> &track, const std::vector<UINT32> &data_pos, const std::vector<UINT32> &gap_pos)
+bool ipf_format::generate_timings(track_info *t, std::vector<uint32_t> &track, const std::vector<uint32_t> &data_pos, const std::vector<uint32_t> &gap_pos)
{
timing_set(track, 0, t->size_cells, 2000);
@@ -362,8 +362,8 @@ bool ipf_format::generate_timings(track_info *t, std::vector<UINT32> &track, con
break;
case 9: {
- UINT32 mask = r32(t->data + 32*t->block_count + 12);
- for(UINT32 i=1; i<t->block_count; i++)
+ uint32_t mask = r32(t->data + 32*t->block_count + 12);
+ for(uint32_t i=1; i<t->block_count; i++)
timing_set(track, data_pos[i], gap_pos[i], mask & (1 << (i-1)) ? 1900 : 2100);
break;
}
@@ -391,14 +391,14 @@ bool ipf_format::generate_track(track_info *t, floppy_image *image)
if(t->index_cells >= t->size_cells)
return false;
- std::vector<UINT32> track(t->size_cells);
- std::vector<UINT32> data_pos(t->block_count+1);
- std::vector<UINT32> gap_pos(t->block_count);
- std::vector<UINT32> splice_pos(t->block_count);
+ std::vector<uint32_t> track(t->size_cells);
+ std::vector<uint32_t> data_pos(t->block_count+1);
+ std::vector<uint32_t> gap_pos(t->block_count);
+ std::vector<uint32_t> splice_pos(t->block_count);
bool context = false;
- UINT32 pos = 0;
- for(UINT32 i = 0; i != t->block_count; i++) {
+ uint32_t pos = 0;
+ for(uint32_t i = 0; i != t->block_count; i++) {
if(!generate_block(t, i, i == t->block_count-1 ? t->size_cells - t->index_cells : 0xffffffff, track, pos, data_pos[i], gap_pos[i], splice_pos[i], context)) {
return false;
}
@@ -423,19 +423,19 @@ bool ipf_format::generate_track(track_info *t, floppy_image *image)
return true;
}
-void ipf_format::track_write_raw(std::vector<UINT32>::iterator &tpos, const UINT8 *data, UINT32 cells, bool &context)
+void ipf_format::track_write_raw(std::vector<uint32_t>::iterator &tpos, const uint8_t *data, uint32_t cells, bool &context)
{
- for(UINT32 i=0; i != cells; i++)
+ for(uint32_t i=0; i != cells; i++)
*tpos++ = data[i>>3] & (0x80 >> (i & 7)) ? MG_1 : MG_0;
if(cells)
context = tpos[-1] == MG_1;
}
-void ipf_format::track_write_mfm(std::vector<UINT32>::iterator &tpos, const UINT8 *data, UINT32 start_offset, UINT32 patlen, UINT32 cells, bool &context)
+void ipf_format::track_write_mfm(std::vector<uint32_t>::iterator &tpos, const uint8_t *data, uint32_t start_offset, uint32_t patlen, uint32_t cells, bool &context)
{
patlen *= 2;
- for(UINT32 i=0; i != cells; i++) {
- UINT32 pos = (i + start_offset) % patlen;
+ for(uint32_t i=0; i != cells; i++) {
+ uint32_t pos = (i + start_offset) % patlen;
bool bit = data[pos>>4] & (0x80 >> ((pos >> 1) & 7));
if(pos & 1) {
*tpos++ = bit ? MG_1 : MG_0;
@@ -445,22 +445,22 @@ void ipf_format::track_write_mfm(std::vector<UINT32>::iterator &tpos, const UINT
}
}
-void ipf_format::track_write_weak(std::vector<UINT32>::iterator &tpos, UINT32 cells)
+void ipf_format::track_write_weak(std::vector<uint32_t>::iterator &tpos, uint32_t cells)
{
- for(UINT32 i=0; i != cells; i++)
+ for(uint32_t i=0; i != cells; i++)
*tpos++ = floppy_image::MG_N;
}
-bool ipf_format::generate_block_data(const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, std::vector<UINT32>::iterator tlimit, bool &context)
+bool ipf_format::generate_block_data(const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, std::vector<uint32_t>::iterator tlimit, bool &context)
{
for(;;) {
if(data >= dlimit)
return false;
- UINT8 val = *data++;
+ uint8_t val = *data++;
if((val >> 5) > dlimit-data)
return false;
- UINT32 param = rb(data, val >> 5);
- UINT32 tleft = tlimit - tpos;
+ uint32_t param = rb(data, val >> 5);
+ uint32_t tleft = tlimit - tpos;
switch(val & 0x1f) {
case 0: // End of description
return !tleft;
@@ -493,11 +493,11 @@ bool ipf_format::generate_block_data(const UINT8 *data, const UINT8 *dlimit, std
}
}
-bool ipf_format::generate_block_gap_0(UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, std::vector<UINT32>::iterator &tpos, bool &context)
+bool ipf_format::generate_block_gap_0(uint32_t gap_cells, uint8_t pattern, uint32_t &spos, uint32_t ipos, std::vector<uint32_t>::iterator &tpos, bool &context)
{
spos = ipos >= 16 && ipos+16 <= gap_cells ? ipos : gap_cells >> 1;
track_write_mfm(tpos, &pattern, 0, 8, spos, context);
- UINT32 delta = 0;
+ uint32_t delta = 0;
if(gap_cells & 1) {
*tpos++ = MG_0;
delta++;
@@ -506,16 +506,16 @@ bool ipf_format::generate_block_gap_0(UINT32 gap_cells, UINT8 pattern, UINT32 &s
return true;
}
-bool ipf_format::gap_description_to_reserved_size(const UINT8 *&data, const UINT8 *dlimit, UINT32 &res_size)
+bool ipf_format::gap_description_to_reserved_size(const uint8_t *&data, const uint8_t *dlimit, uint32_t &res_size)
{
res_size = 0;
for(;;) {
if(data >= dlimit)
return false;
- UINT8 val = *data++;
+ uint8_t val = *data++;
if((val >> 5) > dlimit-data)
return false;
- UINT32 param = rb(data, val >> 5);
+ uint32_t param = rb(data, val >> 5);
switch(val & 0x1f) {
case 0:
return true;
@@ -531,23 +531,23 @@ bool ipf_format::gap_description_to_reserved_size(const UINT8 *&data, const UINT
}
}
-bool ipf_format::generate_gap_from_description(const UINT8 *&data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, UINT32 size, bool pre, bool &context)
+bool ipf_format::generate_gap_from_description(const uint8_t *&data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, uint32_t size, bool pre, bool &context)
{
- const UINT8 *data1 = data;
- UINT32 res_size;
+ const uint8_t *data1 = data;
+ uint32_t res_size;
if(!gap_description_to_reserved_size(data1, dlimit, res_size))
return false;
if(res_size > size)
return false;
- UINT8 pattern[16];
+ uint8_t pattern[16];
memset(pattern, 0, sizeof(pattern));
- UINT32 pattern_size = 0;
+ uint32_t pattern_size = 0;
- UINT32 pos = 0, block_size = 0;
+ uint32_t pos = 0, block_size = 0;
for(;;) {
- UINT8 val = *data++;
- UINT32 param = rb(data, val >> 5);
+ uint8_t val = *data++;
+ uint32_t param = rb(data, val >> 5);
switch(val & 0x1f) {
case 0:
return size == pos;
@@ -601,7 +601,7 @@ bool ipf_format::generate_gap_from_description(const UINT8 *&data, const UINT8 *
}
-bool ipf_format::generate_block_gap_1(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context)
+bool ipf_format::generate_block_gap_1(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context)
{
if(ipos >= 16 && ipos < gap_cells-16)
spos = ipos;
@@ -610,7 +610,7 @@ bool ipf_format::generate_block_gap_1(UINT32 gap_cells, UINT32 &spos, UINT32 ipo
return generate_gap_from_description(data, dlimit, tpos, gap_cells, true, context);
}
-bool ipf_format::generate_block_gap_2(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context)
+bool ipf_format::generate_block_gap_2(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context)
{
if(ipos >= 16 && ipos < gap_cells-16)
spos = ipos;
@@ -619,13 +619,13 @@ bool ipf_format::generate_block_gap_2(UINT32 gap_cells, UINT32 &spos, UINT32 ipo
return generate_gap_from_description(data, dlimit, tpos, gap_cells, false, context);
}
-bool ipf_format::generate_block_gap_3(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context)
+bool ipf_format::generate_block_gap_3(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context)
{
if(ipos >= 16 && ipos < gap_cells-16)
spos = ipos;
else {
- UINT32 presize, postsize;
- const UINT8 *data1 = data;
+ uint32_t presize, postsize;
+ const uint8_t *data1 = data;
if(!gap_description_to_reserved_size(data1, dlimit, presize))
return false;
if(!gap_description_to_reserved_size(data1, dlimit, postsize))
@@ -637,7 +637,7 @@ bool ipf_format::generate_block_gap_3(UINT32 gap_cells, UINT32 &spos, UINT32 ipo
}
if(!generate_gap_from_description(data, dlimit, tpos, spos, true, context))
return false;
- UINT32 delta = 0;
+ uint32_t delta = 0;
if(gap_cells & 1) {
tpos[spos] = MG_0;
delta++;
@@ -646,7 +646,7 @@ bool ipf_format::generate_block_gap_3(UINT32 gap_cells, UINT32 &spos, UINT32 ipo
return generate_gap_from_description(data, dlimit, tpos+spos+delta, gap_cells - spos - delta, false, context);
}
-bool ipf_format::generate_block_gap(UINT32 gap_type, UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, bool &context)
+bool ipf_format::generate_block_gap(uint32_t gap_type, uint32_t gap_cells, uint8_t pattern, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, bool &context)
{
switch(gap_type) {
case 0:
@@ -662,13 +662,13 @@ bool ipf_format::generate_block_gap(UINT32 gap_type, UINT32 gap_cells, UINT8 pat
}
}
-bool ipf_format::generate_block(track_info *t, UINT32 idx, UINT32 ipos, std::vector<UINT32> &track, UINT32 &pos, UINT32 &dpos, UINT32 &gpos, UINT32 &spos, bool &context)
+bool ipf_format::generate_block(track_info *t, uint32_t idx, uint32_t ipos, std::vector<uint32_t> &track, uint32_t &pos, uint32_t &dpos, uint32_t &gpos, uint32_t &spos, bool &context)
{
- const UINT8 *data = t->data;
- const UINT8 *data_end = t->data + t->data_size;
- const UINT8 *thead = data + 32*idx;
- UINT32 data_cells = r32(thead);
- UINT32 gap_cells = r32(thead+4);
+ const uint8_t *data = t->data;
+ const uint8_t *data_end = t->data + t->data_size;
+ const uint8_t *thead = data + 32*idx;
+ uint32_t data_cells = r32(thead);
+ uint32_t gap_cells = r32(thead+4);
if(gap_cells < 8)
gap_cells = 0;
@@ -694,13 +694,13 @@ bool ipf_format::generate_block(track_info *t, UINT32 idx, UINT32 ipos, std::vec
return true;
}
-UINT32 ipf_format::block_compute_real_size(track_info *t)
+uint32_t ipf_format::block_compute_real_size(track_info *t)
{
- UINT32 size = 0;
- const UINT8 *thead = t->data;
+ uint32_t size = 0;
+ const uint8_t *thead = t->data;
for(unsigned int i=0; i != t->block_count; i++) {
- UINT32 data_cells = r32(thead);
- UINT32 gap_cells = r32(thead+4);
+ uint32_t data_cells = r32(thead);
+ uint32_t gap_cells = r32(thead+4);
if(gap_cells < 8)
gap_cells = 0;
diff --git a/src/lib/formats/ipf_dsk.h b/src/lib/formats/ipf_dsk.h
index 0df0e4c3285..d4f5fcb6ac5 100644
--- a/src/lib/formats/ipf_dsk.h
+++ b/src/lib/formats/ipf_dsk.h
@@ -10,8 +10,8 @@ class ipf_format : public floppy_image_format_t
public:
ipf_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 const char *name() const override;
virtual const char *description() const override;
@@ -20,68 +20,68 @@ public:
private:
struct track_info {
- UINT32 cylinder, head, type;
- UINT32 sigtype, process, reserved[3];
- UINT32 size_bytes, size_cells;
- UINT32 index_bytes, index_cells;
- UINT32 datasize_cells, gapsize_cells;
- UINT32 block_count, weak_bits;
+ uint32_t cylinder, head, type;
+ uint32_t sigtype, process, reserved[3];
+ uint32_t size_bytes, size_cells;
+ uint32_t index_bytes, index_cells;
+ uint32_t datasize_cells, gapsize_cells;
+ uint32_t block_count, weak_bits;
- UINT32 data_size_bits;
+ uint32_t data_size_bits;
bool info_set;
- const UINT8 *data;
- UINT32 data_size;
+ const uint8_t *data;
+ uint32_t data_size;
};
track_info *tinfos;
- UINT32 tcount;
+ uint32_t tcount;
- UINT32 type, release, revision;
- UINT32 encoder_type, encoder_revision, origin;
- UINT32 min_cylinder, max_cylinder, min_head, max_head;
- UINT32 credit_day, credit_time;
- UINT32 platform[4], extra[5];
+ uint32_t type, release, revision;
+ uint32_t encoder_type, encoder_revision, origin;
+ uint32_t min_cylinder, max_cylinder, min_head, max_head;
+ uint32_t credit_day, credit_time;
+ uint32_t platform[4], extra[5];
- UINT32 crc32r(const UINT8 *data, UINT32 size);
+ uint32_t crc32r(const uint8_t *data, uint32_t size);
- bool parse_info(const UINT8 *info);
- bool parse_imge(const UINT8 *imge);
- bool parse_data(const UINT8 *data, UINT32 &pos, UINT32 max_extra_size);
+ bool parse_info(const uint8_t *info);
+ bool parse_imge(const uint8_t *imge);
+ bool parse_data(const uint8_t *data, uint32_t &pos, uint32_t max_extra_size);
- bool scan_one_tag(std::vector<UINT8> &data, UINT32 &pos, UINT8 *&tag, UINT32 &tsize);
- bool scan_all_tags(std::vector<UINT8> &data);
- static UINT32 r32(const UINT8 *p);
- static UINT32 rb(const UINT8 *&p, int count);
+ bool scan_one_tag(std::vector<uint8_t> &data, uint32_t &pos, uint8_t *&tag, uint32_t &tsize);
+ bool scan_all_tags(std::vector<uint8_t> &data);
+ static uint32_t r32(const uint8_t *p);
+ static uint32_t rb(const uint8_t *&p, int count);
- track_info *get_index(UINT32 idx);
+ track_info *get_index(uint32_t idx);
- void track_write_raw(std::vector<UINT32>::iterator &tpos, const UINT8 *data, UINT32 cells, bool &context);
- void track_write_mfm(std::vector<UINT32>::iterator &tpos, const UINT8 *data, UINT32 start_offset, UINT32 patlen, UINT32 cells, bool &context);
- void track_write_weak(std::vector<UINT32>::iterator &tpos, UINT32 cells);
- bool generate_block_data(const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, std::vector<UINT32>::iterator tlimit, bool &context);
+ void track_write_raw(std::vector<uint32_t>::iterator &tpos, const uint8_t *data, uint32_t cells, bool &context);
+ void track_write_mfm(std::vector<uint32_t>::iterator &tpos, const uint8_t *data, uint32_t start_offset, uint32_t patlen, uint32_t cells, bool &context);
+ void track_write_weak(std::vector<uint32_t>::iterator &tpos, uint32_t cells);
+ bool generate_block_data(const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, std::vector<uint32_t>::iterator tlimit, bool &context);
- bool gap_description_to_reserved_size(const UINT8 *&data, const UINT8 *dlimit, UINT32 &res_size);
- bool generate_gap_from_description(const UINT8 *&data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, UINT32 size, bool pre, bool &context);
- bool generate_block_gap_0(UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, std::vector<UINT32>::iterator &tpos, bool &context);
- bool generate_block_gap_1(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context);
- bool generate_block_gap_2(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context);
- bool generate_block_gap_3(UINT32 gap_cells, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator &tpos, bool &context);
- bool generate_block_gap(UINT32 gap_type, UINT32 gap_cells, UINT8 pattern, UINT32 &spos, UINT32 ipos, const UINT8 *data, const UINT8 *dlimit, std::vector<UINT32>::iterator tpos, bool &context);
+ bool gap_description_to_reserved_size(const uint8_t *&data, const uint8_t *dlimit, uint32_t &res_size);
+ bool generate_gap_from_description(const uint8_t *&data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, uint32_t size, bool pre, bool &context);
+ bool generate_block_gap_0(uint32_t gap_cells, uint8_t pattern, uint32_t &spos, uint32_t ipos, std::vector<uint32_t>::iterator &tpos, bool &context);
+ bool generate_block_gap_1(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context);
+ bool generate_block_gap_2(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context);
+ bool generate_block_gap_3(uint32_t gap_cells, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator &tpos, bool &context);
+ bool generate_block_gap(uint32_t gap_type, uint32_t gap_cells, uint8_t pattern, uint32_t &spos, uint32_t ipos, const uint8_t *data, const uint8_t *dlimit, std::vector<uint32_t>::iterator tpos, bool &context);
- bool generate_block(track_info *t, UINT32 idx, UINT32 ipos, std::vector<UINT32> &track, UINT32 &pos, UINT32 &dpos, UINT32 &gpos, UINT32 &spos, bool &context);
- UINT32 block_compute_real_size(track_info *t);
+ bool generate_block(track_info *t, uint32_t idx, uint32_t ipos, std::vector<uint32_t> &track, uint32_t &pos, uint32_t &dpos, uint32_t &gpos, uint32_t &spos, bool &context);
+ uint32_t block_compute_real_size(track_info *t);
- void timing_set(std::vector<UINT32> &track, UINT32 start, UINT32 end, UINT32 time);
- bool generate_timings(track_info *t, std::vector<UINT32> &track, const std::vector<UINT32> &data_pos, const std::vector<UINT32> &gap_pos);
+ void timing_set(std::vector<uint32_t> &track, uint32_t start, uint32_t end, uint32_t time);
+ bool generate_timings(track_info *t, std::vector<uint32_t> &track, const std::vector<uint32_t> &data_pos, const std::vector<uint32_t> &gap_pos);
- void rotate(std::vector<UINT32> &track, UINT32 offset, UINT32 size);
- void mark_track_splice(std::vector<UINT32> &track, UINT32 offset, UINT32 size);
+ void rotate(std::vector<uint32_t> &track, uint32_t offset, uint32_t size);
+ void mark_track_splice(std::vector<uint32_t> &track, uint32_t offset, uint32_t size);
bool generate_track(track_info *t, floppy_image *image);
bool generate_tracks(floppy_image *image);
- bool parse(std::vector<UINT8> &data, floppy_image *image);
+ bool parse(std::vector<uint8_t> &data, floppy_image *image);
};
extern const floppy_format_type FLOPPY_IPF_FORMAT;
diff --git a/src/lib/formats/jvc_dsk.cpp b/src/lib/formats/jvc_dsk.cpp
index ce364d9efe2..30417eb3315 100644
--- a/src/lib/formats/jvc_dsk.cpp
+++ b/src/lib/formats/jvc_dsk.cpp
@@ -39,9 +39,9 @@ bool jvc_format::parse_header(io_generic *io, int &header_size, int &tracks, int
{
// The JVC format has a header whose size is the size of the image modulo 256. Currently, we only
// handle up to five header bytes
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
header_size = size % 256;
- UINT8 header[5];
+ uint8_t header[5];
// if we know that this is a header of a bad size, we can fail
// immediately; otherwise read the header
@@ -75,13 +75,13 @@ bool jvc_format::parse_header(io_generic *io, int &header_size, int &tracks, int
return tracks * heads * sectors * sector_size == (size - header_size);
}
-int jvc_format::identify(io_generic *io, UINT32 form_factor)
+int jvc_format::identify(io_generic *io, uint32_t form_factor)
{
int header_size, tracks, heads, sectors, sector_size, sector_base_id;
return parse_header(io, header_size, tracks, heads, sectors, sector_size, sector_base_id) ? 50 : 0;
}
-bool jvc_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool jvc_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int header_size, track_count, head_count, sector_count, sector_size, sector_base_id;
@@ -99,7 +99,7 @@ bool jvc_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for (int head = 0; head < head_count ; head++)
{
desc_pc_sector sectors[256];
- UINT8 sector_data[10000];
+ uint8_t sector_data[10000];
int sector_offset = 0;
for (int i = 0; i < sector_count; i++)
@@ -128,10 +128,10 @@ bool jvc_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
bool jvc_format::save(io_generic *io, floppy_image *image)
{
- UINT8 bitstream[500000/8];
- UINT8 sector_data[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sector_data[50000];
desc_xs sectors[256];
- UINT64 file_offset = 0;
+ uint64_t file_offset = 0;
int track_count, head_count;
image->get_actual_geometry(track_count, head_count);
@@ -139,7 +139,7 @@ bool jvc_format::save(io_generic *io, floppy_image *image)
// we'll write a header if the disk is two-sided
if (head_count == 2)
{
- UINT8 header[2];
+ uint8_t header[2];
header[0] = 18;
header[1] = 2;
io_generic_write(io, header, file_offset, sizeof(header));
diff --git a/src/lib/formats/jvc_dsk.h b/src/lib/formats/jvc_dsk.h
index 244c84a8592..bb74fbf8ac4 100644
--- a/src/lib/formats/jvc_dsk.h
+++ b/src/lib/formats/jvc_dsk.h
@@ -24,11 +24,11 @@ public:
struct jvc_header
{
- UINT8 sectors_per_track;
- UINT8 side_count;
- UINT8 sector_size;
- UINT8 first_sector_id;
- UINT8 sector_attribute_flag;
+ uint8_t sectors_per_track;
+ uint8_t side_count;
+ uint8_t sector_size;
+ uint8_t first_sector_id;
+ uint8_t sector_attribute_flag;
int header_size;
};
@@ -36,8 +36,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 bool supports_save() const override;
diff --git a/src/lib/formats/kc_cas.cpp b/src/lib/formats/kc_cas.cpp
index 2e9638d19c9..713def9ac83 100644
--- a/src/lib/formats/kc_cas.cpp
+++ b/src/lib/formats/kc_cas.cpp
@@ -43,7 +43,7 @@ static int kc_image_size;
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-static inline int kc_cas_cycle(INT16 *buffer, int sample_pos, int len)
+static inline int kc_cas_cycle(int16_t *buffer, int sample_pos, int len)
{
int num_samples = KC_WAV_FREQUENCY / (len * 2);
@@ -63,7 +63,7 @@ static inline int kc_cas_cycle(INT16 *buffer, int sample_pos, int len)
/*******************************************************************
Generate n samples of silence
********************************************************************/
-static inline int kc_cas_silence(INT16 *buffer, int sample_pos, int len)
+static inline int kc_cas_silence(int16_t *buffer, int sample_pos, int len)
{
int i = 0;
@@ -78,7 +78,7 @@ static inline int kc_cas_silence(INT16 *buffer, int sample_pos, int len)
/*******************************************************************
Generate samples for 1 byte
********************************************************************/
-static inline int kc_cas_byte(INT16 *buffer, int sample_pos, UINT8 data)
+static inline int kc_cas_byte(int16_t *buffer, int sample_pos, uint8_t data)
{
int samples = 0;
@@ -103,7 +103,7 @@ static inline int kc_cas_byte(INT16 *buffer, int sample_pos, UINT8 data)
return samples;
}
-static int kc_handle_cass(INT16 *buffer, const UINT8 *casdata, int type)
+static int kc_handle_cass(int16_t *buffer, const uint8_t *casdata, int type)
{
int data_pos = (type == KC_IMAGE_KCC || type == KC_IMAGE_KCM) ? 0 : 16;
int sample_count = 0;
@@ -119,7 +119,7 @@ static int kc_handle_cass(INT16 *buffer, const UINT8 *casdata, int type)
// on the entire file
while( data_pos < kc_image_size )
{
- UINT8 checksum = 0;
+ uint8_t checksum = 0;
// 200 cycles of BIT_1 every block
for (int i=0; i<200; i++)
@@ -142,7 +142,7 @@ static int kc_handle_cass(INT16 *buffer, const UINT8 *casdata, int type)
// write the 128 bytes of the block
for (int i=0; i<128; i++)
{
- UINT8 data = 0;
+ uint8_t data = 0;
if (data_pos < kc_image_size)
data = casdata[data_pos++];
@@ -184,13 +184,13 @@ static int kc_handle_cass(INT16 *buffer, const UINT8 *casdata, int type)
}
-static int kc_handle_kcc(INT16 *buffer, const UINT8 *casdata)
+static int kc_handle_kcc(int16_t *buffer, const uint8_t *casdata)
{
return kc_handle_cass(buffer, casdata, KC_IMAGE_KCC);
}
-static int kc_handle_tap(INT16 *buffer, const UINT8 *casdata)
+static int kc_handle_tap(int16_t *buffer, const uint8_t *casdata)
{
if (!strncmp((const char *)(casdata + 1), "KC-TAPE by AF", 13))
{
@@ -210,9 +210,9 @@ static int kc_handle_tap(INT16 *buffer, const UINT8 *casdata)
}
}
-static int kc_handle_sss(INT16 *buffer, const UINT8 *casdata)
+static int kc_handle_sss(int16_t *buffer, const uint8_t *casdata)
{
- std::vector<UINT8> sss(kc_image_size + 11);
+ std::vector<uint8_t> sss(kc_image_size + 11);
// tries to generate the missing head
memset(&sss[0], 0xd3, 3);
@@ -232,7 +232,7 @@ static int kc_handle_sss(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int kc_kcc_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int kc_kcc_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return kc_handle_kcc(buffer, bytes);
}
@@ -241,7 +241,7 @@ static int kc_kcc_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image classical
********************************************************************/
-static int kc_kcc_to_wav_size(const UINT8 *casdata, int caslen)
+static int kc_kcc_to_wav_size(const uint8_t *casdata, int caslen)
{
kc_image_size = caslen ;
@@ -284,7 +284,7 @@ static const struct CassetteFormat kc_kcc_format =
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int kc_tap_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int kc_tap_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return kc_handle_tap(buffer, bytes);
}
@@ -293,7 +293,7 @@ static int kc_tap_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image classical
********************************************************************/
-static int kc_tap_to_wav_size(const UINT8 *casdata, int caslen)
+static int kc_tap_to_wav_size(const uint8_t *casdata, int caslen)
{
kc_image_size = caslen ;
@@ -336,7 +336,7 @@ static const struct CassetteFormat kc_tap_format =
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int kc_sss_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int kc_sss_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return kc_handle_sss(buffer, bytes);
}
@@ -345,7 +345,7 @@ static int kc_sss_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image classical
********************************************************************/
-static int kc_sss_to_wav_size(const UINT8 *casdata, int caslen)
+static int kc_sss_to_wav_size(const uint8_t *casdata, int caslen)
{
kc_image_size = caslen ;
diff --git a/src/lib/formats/kim1_cas.cpp b/src/lib/formats/kim1_cas.cpp
index 6cef030874a..1bfccc7f8a0 100644
--- a/src/lib/formats/kim1_cas.cpp
+++ b/src/lib/formats/kim1_cas.cpp
@@ -11,7 +11,7 @@
static int cas_size;
-static inline int kim1_output_signal( INT16 *buffer, int sample_pos, int high )
+static inline int kim1_output_signal( int16_t *buffer, int sample_pos, int high )
{
int sample_count, i, j;
@@ -62,7 +62,7 @@ static inline int kim1_output_signal( INT16 *buffer, int sample_pos, int high )
}
-static inline int kim1_output_byte( INT16 *buffer, int sample_pos, UINT8 byte )
+static inline int kim1_output_byte( int16_t *buffer, int sample_pos, uint8_t byte )
{
int i;
int sample_count = 0;
@@ -78,11 +78,11 @@ static inline int kim1_output_byte( INT16 *buffer, int sample_pos, UINT8 byte )
}
-static int kim1_handle_kim(INT16 *buffer, const UINT8 *casdata)
+static int kim1_handle_kim(int16_t *buffer, const uint8_t *casdata)
{
- static const UINT8 encoding[16] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 };
+ static const uint8_t encoding[16] = { 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46 };
int i, data_pos, sample_count;
- UINT16 size, address, file_id, checksum;
+ uint16_t size, address, file_id, checksum;
if ( cas_size < 9 ) return -1;
if ( memcmp( casdata, "KIM1", 4 ) ) return -1;
@@ -115,7 +115,7 @@ static int kim1_handle_kim(INT16 *buffer, const UINT8 *casdata)
/* Output the data */
while( data_pos < cas_size && data_pos < ( size + 9 ) )
{
- UINT8 data = casdata[data_pos];
+ uint8_t data = casdata[data_pos];
sample_count += kim1_output_byte( buffer, sample_count, encoding[ data >> 4 ] );
sample_count += kim1_output_byte( buffer, sample_count, encoding[ data & 0x0f ] );
@@ -143,7 +143,7 @@ static int kim1_handle_kim(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int kim1_kim_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int kim1_kim_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return kim1_handle_kim( buffer, bytes );
}
@@ -152,7 +152,7 @@ static int kim1_kim_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int kim1_kim_to_wav_size(const UINT8 *casdata, int caslen)
+static int kim1_kim_to_wav_size(const uint8_t *casdata, int caslen)
{
cas_size = caslen;
diff --git a/src/lib/formats/lviv_lvt.cpp b/src/lib/formats/lviv_lvt.cpp
index e53a68be471..09e91eac9fd 100644
--- a/src/lib/formats/lviv_lvt.cpp
+++ b/src/lib/formats/lviv_lvt.cpp
@@ -17,7 +17,7 @@
#define LVIV_LVT_HEADER_PILOT_LENGTH 5190
#define LVIV_LVT_BLOCK_PILOT_LENGTH 1298
-static INT16 *lviv_emit_level(INT16 *p, int count, int level)
+static int16_t *lviv_emit_level(int16_t *p, int count, int level)
{
int i;
@@ -28,7 +28,7 @@ static INT16 *lviv_emit_level(INT16 *p, int count, int level)
return p;
}
-static INT16* lviv_output_bit(INT16 *p, UINT8 b)
+static int16_t* lviv_output_bit(int16_t *p, uint8_t b)
{
if (b)
{
@@ -45,7 +45,7 @@ static INT16* lviv_output_bit(INT16 *p, UINT8 b)
return p;
}
-static INT16* lviv_output_byte(INT16 *p, UINT8 byte)
+static int16_t* lviv_output_byte(int16_t *p, uint8_t byte)
{
int i;
@@ -61,7 +61,7 @@ static INT16* lviv_output_byte(INT16 *p, UINT8 byte)
/*************************************************************************************/
-static int lviv_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int lviv_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
int size;
@@ -76,10 +76,10 @@ static int lviv_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
/*************************************************************************************/
-static int lviv_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int lviv_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
int i;
- INT16 * p = buffer;
+ int16_t * p = buffer;
int data_size;
diff --git a/src/lib/formats/m20_dsk.cpp b/src/lib/formats/m20_dsk.cpp
index 5fec77cf1d5..a831547e6e7 100644
--- a/src/lib/formats/m20_dsk.cpp
+++ b/src/lib/formats/m20_dsk.cpp
@@ -40,20 +40,20 @@ bool m20_format::supports_save() const
return false;
}
-int m20_format::identify(io_generic *io, UINT32 form_factor)
+int m20_format::identify(io_generic *io, uint32_t form_factor)
{
if(io_generic_size(io) == 286720)
return 50;
return 0;
}
-bool m20_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool m20_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
for(int track = 0; track < 35; track++)
for(int head = 0; head < 2; head ++) {
bool mfm = track || head;
desc_pc_sector sects[16];
- UINT8 sectdata[16*256];
+ uint8_t sectdata[16*256];
io_generic_read(io, sectdata, 16*256*(track*2+head), 16*256);
for(int i=0; i<16; i++) {
int j = i/2 + (i & 1 ? 0 : 8);
diff --git a/src/lib/formats/m20_dsk.h b/src/lib/formats/m20_dsk.h
index 0ed3deda5ef..231728d6164 100644
--- a/src/lib/formats/m20_dsk.h
+++ b/src/lib/formats/m20_dsk.h
@@ -17,8 +17,8 @@ class m20_format : public floppy_image_format_t {
public:
m20_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
diff --git a/src/lib/formats/mbee_cas.cpp b/src/lib/formats/mbee_cas.cpp
index 738bd4e4b31..24024f66f5d 100644
--- a/src/lib/formats/mbee_cas.cpp
+++ b/src/lib/formats/mbee_cas.cpp
@@ -69,7 +69,7 @@ TAP - has an ID header of TAP_DGOS_BEE or MBEE, null terminated.
static int mbee_image_size;
static bool mbee_speed;
-static int mbee_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int mbee_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -80,7 +80,7 @@ static int mbee_put_samples(INT16 *buffer, int sample_pos, int count, int level)
return count;
}
-static int mbee_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int mbee_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
if (mbee_speed)
@@ -135,10 +135,10 @@ static int mbee_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int mbee_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int mbee_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* start */
samples += mbee_output_bit (buffer, sample_pos + samples, 0);
@@ -154,14 +154,14 @@ static int mbee_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int mbee_handle_tap(INT16 *buffer, const UINT8 *bytes)
+static int mbee_handle_tap(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 byte_count = 0;
- UINT32 i = 0;
+ uint32_t sample_count = 0;
+ uint32_t byte_count = 0;
+ uint32_t i = 0;
bool temp_speed = 0;
- UINT8 temp_blocks = 0;
- UINT16 temp_size = 0;
+ uint8_t temp_blocks = 0;
+ uint16_t temp_size = 0;
// TAP file starts with a null-terminate ID string. We just skip this.
while (bytes[byte_count])
@@ -211,7 +211,7 @@ static int mbee_handle_tap(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int mbee_tap_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int mbee_tap_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return mbee_handle_tap(buffer, bytes);
}
@@ -220,7 +220,7 @@ static int mbee_tap_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int mbee_tap_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int mbee_tap_calculate_size_in_samples(const uint8_t *bytes, int length)
{
mbee_image_size = length;
diff --git a/src/lib/formats/mfi_dsk.cpp b/src/lib/formats/mfi_dsk.cpp
index ea3eed8a29f..b6a8a18460a 100644
--- a/src/lib/formats/mfi_dsk.cpp
+++ b/src/lib/formats/mfi_dsk.cpp
@@ -94,7 +94,7 @@ bool mfi_format::supports_save() const
return true;
}
-int mfi_format::identify(io_generic *io, UINT32 form_factor)
+int mfi_format::identify(io_generic *io, uint32_t form_factor)
{
header h;
@@ -108,7 +108,7 @@ int mfi_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool mfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool mfi_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
header h;
entry entries[84*2*4];
@@ -119,7 +119,7 @@ bool mfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
image->set_variant(h.variant);
- std::vector<UINT8> compressed;
+ std::vector<uint8_t> compressed;
entry *ent = entries;
for(unsigned int cyl=0; cyl <= (h.cyl_count - 1) << 2; cyl += 4 >> resolution)
@@ -138,16 +138,16 @@ bool mfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
io_generic_read(io, &compressed[0], ent->offset, ent->compressed_size);
unsigned int cell_count = ent->uncompressed_size/4;
- std::vector<UINT32> &trackbuf = image->get_buffer(cyl >> 2, head, cyl & 3);;
+ std::vector<uint32_t> &trackbuf = image->get_buffer(cyl >> 2, head, cyl & 3);;
trackbuf.resize(cell_count);
uLongf size = ent->uncompressed_size;
if(uncompress((Bytef *)&trackbuf[0], &size, &compressed[0], ent->compressed_size) != Z_OK)
return false;
- UINT32 cur_time = 0;
+ uint32_t cur_time = 0;
for(unsigned int i=0; i != cell_count; i++) {
- UINT32 next_cur_time = cur_time + (trackbuf[i] & TIME_MASK);
+ uint32_t next_cur_time = cur_time + (trackbuf[i] & TIME_MASK);
trackbuf[i] = (trackbuf[i] & MG_MASK) | cur_time;
cur_time = next_cur_time;
}
@@ -187,12 +187,12 @@ bool mfi_format::save(io_generic *io, floppy_image *image)
int pos = sizeof(header) + (tracks << resolution)*heads*sizeof(entry);
int epos = 0;
- auto precomp = global_alloc_array(UINT32, max_track_size);
- auto postcomp = global_alloc_array(UINT8, max_track_size*4 + 1000);
+ auto precomp = global_alloc_array(uint32_t, max_track_size);
+ auto postcomp = global_alloc_array(uint8_t, max_track_size*4 + 1000);
for(int track=0; track <= (tracks-1) << 2; track += 4 >> resolution)
for(int head=0; head<heads; head++) {
- std::vector<UINT32> &buffer = image->get_buffer(track >> 2, head, track & 3);
+ std::vector<uint32_t> &buffer = image->get_buffer(track >> 2, head, track & 3);
int tsize = buffer.size();
if(!tsize) {
epos++;
diff --git a/src/lib/formats/mfi_dsk.h b/src/lib/formats/mfi_dsk.h
index dfac913d4c1..e18920bd04d 100644
--- a/src/lib/formats/mfi_dsk.h
+++ b/src/lib/formats/mfi_dsk.h
@@ -10,8 +10,8 @@ class mfi_format : public floppy_image_format_t
public:
mfi_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
diff --git a/src/lib/formats/mfm_hd.cpp b/src/lib/formats/mfm_hd.cpp
index 617ebf2b992..032be8622cb 100644
--- a/src/lib/formats/mfm_hd.cpp
+++ b/src/lib/formats/mfm_hd.cpp
@@ -139,7 +139,7 @@ void mfmhd_image_format_t::set_layout_params(mfmhd_layout_params param)
/*
Encode some value with data-type clock bits.
*/
-void mfmhd_image_format_t::mfm_encode(UINT16* trackimage, int& position, UINT8 byte, int count)
+void mfmhd_image_format_t::mfm_encode(uint16_t* trackimage, int& position, uint8_t byte, int count)
{
mfm_encode_mask(trackimage, position, byte, count, 0x00);
}
@@ -147,7 +147,7 @@ void mfmhd_image_format_t::mfm_encode(UINT16* trackimage, int& position, UINT8 b
/*
Encode an A1 value with mark-type clock bits.
*/
-void mfmhd_image_format_t::mfm_encode_a1(UINT16* trackimage, int& position)
+void mfmhd_image_format_t::mfm_encode_a1(uint16_t* trackimage, int& position)
{
m_current_crc = 0xffff;
mfm_encode_mask(trackimage, position, 0xa1, 1, 0x04);
@@ -157,11 +157,11 @@ void mfmhd_image_format_t::mfm_encode_a1(UINT16* trackimage, int& position)
Encode a byte value with a given clock bit mask. Used by both mfm_encode
and mfm_encode_a1 methods.
*/
-void mfmhd_image_format_t::mfm_encode_mask(UINT16* trackimage, int& position, UINT8 byte, int count, int mask)
+void mfmhd_image_format_t::mfm_encode_mask(uint16_t* trackimage, int& position, uint8_t byte, int count, int mask)
{
- UINT16 encclock = 0;
- UINT16 encdata = 0;
- UINT8 thisbyte = byte;
+ uint16_t encclock = 0;
+ uint16_t encdata = 0;
+ uint8_t thisbyte = byte;
bool mark = (mask != 0x00);
m_current_crc = ccitt_crc16_one(m_current_crc, byte);
@@ -226,7 +226,7 @@ void mfmhd_image_format_t::mfm_encode_mask(UINT16* trackimage, int& position, UI
Clock bits and data bits are assumed to be interleaved (cdcdcdcdcdcdcdcd);
the 8 data bits are returned.
*/
-UINT8 mfmhd_image_format_t::mfm_decode(UINT16 raw)
+uint8_t mfmhd_image_format_t::mfm_decode(uint16_t raw)
{
unsigned int value = 0;
@@ -243,7 +243,7 @@ UINT8 mfmhd_image_format_t::mfm_decode(UINT16 raw)
/*
For debugging. Outputs the byte array in a xxd-like way.
*/
-void mfmhd_image_format_t::showtrack(UINT16* enctrack, int length)
+void mfmhd_image_format_t::showtrack(uint16_t* enctrack, int length)
{
for (int i=0; i < length; i+=16)
{
@@ -268,7 +268,7 @@ const mfmhd_format_type MFMHD_GEN_FORMAT = &mfmhd_image_format_creator<mfmhd_gen
define idents beyond cylinder 1023, but formatting programs seem to
continue with 0xfd for cylinders between 1024 and 2047.
*/
-UINT8 mfmhd_generic_format::cylinder_to_ident(int cylinder)
+uint8_t mfmhd_generic_format::cylinder_to_ident(int cylinder)
{
if (cylinder < 256) return 0xfe;
if (cylinder < 512) return 0xff;
@@ -295,10 +295,10 @@ int mfmhd_generic_format::chs_to_lba(int cylinder, int head, int sector)
else return -1;
}
-chd_error mfmhd_generic_format::load(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head)
+chd_error mfmhd_generic_format::load(chd_file* chdfile, uint16_t* trackimage, int tracksize, int cylinder, int head)
{
chd_error state = CHDERR_NONE;
- UINT8 sector_content[16384];
+ uint8_t sector_content[16384];
int sectorcount = m_param.sectors_per_track;
int size = m_param.sector_size;
@@ -434,18 +434,18 @@ enum
CHECK_CRC
};
-chd_error mfmhd_generic_format::save(chd_file* chdfile, UINT16* trackimage, int tracksize, int current_cylinder, int current_head)
+chd_error mfmhd_generic_format::save(chd_file* chdfile, uint16_t* trackimage, int tracksize, int current_cylinder, int current_head)
{
if (TRACE_RWTRACK) osd_printf_verbose("%s: write back (c=%d,h=%d) to CHD\n", tag(), current_cylinder, current_head);
- UINT8 buffer[16384]; // for header or sector content
+ uint8_t buffer[16384]; // for header or sector content
int bytepos = 0;
int state = SEARCH_A1;
int count = 0;
int pos = 0;
- UINT16 crc = 0;
- UINT8 byte;
+ uint16_t crc = 0;
+ uint8_t byte;
bool search_header = true;
int ident = 0;
diff --git a/src/lib/formats/mfm_hd.h b/src/lib/formats/mfm_hd.h
index 4e583f46db8..29b23745eac 100644
--- a/src/lib/formats/mfm_hd.h
+++ b/src/lib/formats/mfm_hd.h
@@ -151,10 +151,10 @@ public:
virtual ~mfmhd_image_format_t() {};
// Load the image.
- virtual chd_error load(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head) = 0;
+ virtual chd_error load(chd_file* chdfile, uint16_t* trackimage, int tracksize, int cylinder, int head) = 0;
// Save the image.
- virtual chd_error save(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head) = 0;
+ virtual chd_error save(chd_file* chdfile, uint16_t* trackimage, int tracksize, int cylinder, int head) = 0;
// Return the original parameters of the image
mfmhd_layout_params* get_initial_params() { return &m_param_old; }
@@ -179,16 +179,16 @@ protected:
mfmhd_layout_params m_param, m_param_old;
- void mfm_encode(UINT16* trackimage, int& position, UINT8 byte, int count=1);
- void mfm_encode_a1(UINT16* trackimage, int& position);
- void mfm_encode_mask(UINT16* trackimage, int& position, UINT8 byte, int count, int mask);
- UINT8 mfm_decode(UINT16 raw);
+ void mfm_encode(uint16_t* trackimage, int& position, uint8_t byte, int count=1);
+ void mfm_encode_a1(uint16_t* trackimage, int& position);
+ void mfm_encode_mask(uint16_t* trackimage, int& position, uint8_t byte, int count, int mask);
+ uint8_t mfm_decode(uint16_t raw);
// Deliver defaults.
virtual int get_default(mfmhd_param_t type) =0;
// Debugging
- void showtrack(UINT16* enctrack, int length);
+ void showtrack(uint16_t* enctrack, int length);
virtual const char* tag() { return m_devtag.c_str(); }
};
@@ -196,15 +196,15 @@ class mfmhd_generic_format : public mfmhd_image_format_t
{
public:
mfmhd_generic_format() { m_devtag = std::string("mfmhd_generic_format"); };
- chd_error load(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head) override;
- chd_error save(chd_file* chdfile, UINT16* trackimage, int tracksize, int cylinder, int head) override;
+ chd_error load(chd_file* chdfile, uint16_t* trackimage, int tracksize, int cylinder, int head) override;
+ chd_error save(chd_file* chdfile, uint16_t* trackimage, int tracksize, int cylinder, int head) override;
// Yes, we want to save all parameters
virtual bool save_param(mfmhd_param_t type) override { return true; }
virtual int get_default(mfmhd_param_t type) override;
protected:
- virtual UINT8 cylinder_to_ident(int cylinder);
+ virtual uint8_t cylinder_to_ident(int cylinder);
virtual int chs_to_lba(int cylinder, int head, int sector);
};
diff --git a/src/lib/formats/mz_cas.cpp b/src/lib/formats/mz_cas.cpp
index 1fb9d6c1577..cfcf9f36ed8 100644
--- a/src/lib/formats/mz_cas.cpp
+++ b/src/lib/formats/mz_cas.cpp
@@ -36,7 +36,7 @@
#define STM_0 20
#define STM_L 1
-static int fill_wave_1(INT16 *buffer, int offs)
+static int fill_wave_1(int16_t *buffer, int offs)
{
buffer[offs++] = HI;
buffer[offs++] = HI;
@@ -45,14 +45,14 @@ static int fill_wave_1(INT16 *buffer, int offs)
return LONG_PULSE;
}
-static int fill_wave_0(INT16 *buffer, int offs)
+static int fill_wave_0(int16_t *buffer, int offs)
{
buffer[offs++] = HI;
buffer[offs++] = LO;
return SHORT_PULSE;
}
-static int fill_wave_b(INT16 *buffer, int offs, int byte)
+static int fill_wave_b(int16_t *buffer, int offs, int byte)
{
int i, count = 0;
@@ -69,10 +69,10 @@ static int fill_wave_b(INT16 *buffer, int offs, int byte)
return count;
}
-static int fill_wave(INT16 *buffer, int length, UINT8 *code)
+static int fill_wave(int16_t *buffer, int length, uint8_t *code)
{
- static INT16 *beg;
- static UINT16 csum = 0;
+ static int16_t *beg;
+ static uint16_t csum = 0;
static int header = 1, bytecount = 0;
int count = 0;
@@ -123,7 +123,7 @@ static int fill_wave(INT16 *buffer, int length, UINT8 *code)
if( code == CODE_TRAILER )
{
int i, file_length;
- INT16 *end = buffer;
+ int16_t *end = buffer;
/* is there insufficient space for the CHKF? */
if( count + 2 * BYTE_SAMPLES > length )
@@ -145,12 +145,12 @@ static int fill_wave(INT16 *buffer, int length, UINT8 *code)
for (i = 0; i < 256; i++)
count += fill_wave_0(buffer, count);
- file_length = (int)(end - beg) / sizeof(INT16);
+ file_length = (int)(end - beg) / sizeof(int16_t);
/* is there insufficient space for the FILEC ? */
if( count + file_length > length )
return -1;
LOG(1,"mz700_fill_wave",("FILEC %d samples\n", file_length));
- memcpy(buffer + count, beg, file_length * sizeof(INT16));
+ memcpy(buffer + count, beg, file_length * sizeof(int16_t));
count += file_length;
/* is there insufficient space for the CHKF ? */
@@ -177,7 +177,7 @@ static int fill_wave(INT16 *buffer, int length, UINT8 *code)
if( header == 1 && bytecount == 128 )
{
int i, hdr_length;
- INT16 *end = buffer;
+ int16_t *end = buffer;
/* is there insufficient space for the CHKH ? */
if( count + 2 * BYTE_SAMPLES > length )
@@ -199,12 +199,12 @@ static int fill_wave(INT16 *buffer, int length, UINT8 *code)
for (i = 0; i < 256; i++)
count += fill_wave_0(buffer, count);
- hdr_length = (int)(end - beg) / sizeof(INT16);
+ hdr_length = (int)(end - beg) / sizeof(int16_t);
/* is there insufficient space for the HDRC ? */
if( count + hdr_length > length )
return -1;
LOG(1,"mz700_fill_wave",("HDRC %d samples\n", hdr_length));
- memcpy(buffer + count, beg, hdr_length * sizeof(INT16));
+ memcpy(buffer + count, beg, hdr_length * sizeof(int16_t));
count += hdr_length;
/* is there insufficient space for CHKH ? */
diff --git a/src/lib/formats/naslite_dsk.cpp b/src/lib/formats/naslite_dsk.cpp
index 342407a7c95..cea109c2dc2 100644
--- a/src/lib/formats/naslite_dsk.cpp
+++ b/src/lib/formats/naslite_dsk.cpp
@@ -39,7 +39,7 @@ const naslite_format::format naslite_format::formats[] = {
{}
};
-void naslite_format::build_sector_description(const format &f, UINT8 *sectdata, desc_s *sectors, int track, int head) const
+void naslite_format::build_sector_description(const format &f, uint8_t *sectdata, desc_s *sectors, int track, int head) const
{
for(int i=0; i<f.sector_count; i++) {
int cur_offset = 0;
diff --git a/src/lib/formats/naslite_dsk.h b/src/lib/formats/naslite_dsk.h
index 00f9df1567e..0a3df5535d5 100644
--- a/src/lib/formats/naslite_dsk.h
+++ b/src/lib/formats/naslite_dsk.h
@@ -24,7 +24,7 @@ public:
protected:
static const format formats[];
- virtual void build_sector_description(const format &d, UINT8 *sectdata, desc_s *sectors, int track, int head) const override;
+ virtual void build_sector_description(const format &d, uint8_t *sectdata, desc_s *sectors, int track, int head) const override;
};
extern const floppy_format_type FLOPPY_NASLITE_FORMAT;
diff --git a/src/lib/formats/nes_dsk.cpp b/src/lib/formats/nes_dsk.cpp
index f6560d5f053..60dbba5dafa 100644
--- a/src/lib/formats/nes_dsk.cpp
+++ b/src/lib/formats/nes_dsk.cpp
@@ -24,8 +24,8 @@
static FLOPPY_IDENTIFY( nes_dsk_identify )
{
- UINT64 size;
- UINT8 header[3];
+ uint64_t size;
+ uint8_t header[3];
*vote = 0;
diff --git a/src/lib/formats/nfd_dsk.cpp b/src/lib/formats/nfd_dsk.cpp
index 0691543cce6..4d9d8fab980 100644
--- a/src/lib/formats/nfd_dsk.cpp
+++ b/src/lib/formats/nfd_dsk.cpp
@@ -100,9 +100,9 @@ const char *nfd_format::extensions() const
return "nfd";
}
-int nfd_format::identify(io_generic *io, UINT32 form_factor)
+int nfd_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[16];
+ uint8_t h[16];
io_generic_read(io, h, 0, 16);
if (strncmp((const char *)h, "T98FDDIMAGE.R0", 14) == 0 || strncmp((const char *)h, "T98FDDIMAGE.R1", 14) == 0)
@@ -111,25 +111,25 @@ int nfd_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool nfd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
- UINT8 h[0x120], hsec[0x10];
+ uint64_t size = io_generic_size(io);
+ uint8_t h[0x120], hsec[0x10];
io_generic_read(io, h, 0, 0x120);
int format_version = !strncmp((const char *)h, "T98FDDIMAGE.R0", 14) ? 0 : 1;
// sector map (the 164th entry is only used by rev.1 format, loops with track < 163 are correct for rev.0)
- UINT8 disk_type = 0;
- UINT8 num_secs[164];
- UINT8 num_specials[164];
- UINT32 track_sizes[164];
- UINT8 tracks[164 * 26];
- UINT8 heads[164 * 26];
- UINT8 secs[164 * 26];
- UINT8 mfm[164 * 26];
- UINT8 sec_sizes[164 * 26];
-
- UINT32 hsize = little_endianize_int32(*(UINT32 *)(h+0x110));
+ uint8_t disk_type = 0;
+ uint8_t num_secs[164];
+ uint8_t num_specials[164];
+ uint32_t track_sizes[164];
+ uint8_t tracks[164 * 26];
+ uint8_t heads[164 * 26];
+ uint8_t secs[164 * 26];
+ uint8_t mfm[164 * 26];
+ uint8_t sec_sizes[164 * 26];
+
+ uint32_t hsize = little_endianize_int32(*(uint32_t *)(h+0x110));
int pos = 0x120;
@@ -142,7 +142,7 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
// read sector map absolute location
io_generic_read(io, hsec, pos, 4);
pos += 4;
- UINT32 secmap_addr = little_endianize_int32(*(UINT32 *)(hsec));
+ uint32_t secmap_addr = little_endianize_int32(*(uint32_t *)(hsec));
if (secmap_addr)
{
@@ -151,8 +151,8 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
// first WORD is # of sectors, second WORD is # of special data sectors
io_generic_read(io, hsec, secmap_addr, 0x10);
secmap_addr += 0x10;
- num_secs[track] = little_endianize_int16(*(UINT16 *)(hsec));
- num_specials[track] = little_endianize_int16(*(UINT16 *)(hsec + 0x2));
+ num_secs[track] = little_endianize_int16(*(uint16_t *)(hsec));
+ num_specials[track] = little_endianize_int16(*(uint16_t *)(hsec + 0x2));
for (int sect = 0; sect < num_secs[track]; sect++)
{
@@ -177,7 +177,7 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
io_generic_read(io, hsec, secmap_addr, 0x10);
secmap_addr += 0x10;
- curr_track_size += (hsec[9] + 1) * little_endianize_int32(*(UINT32 *)(hsec + 0x0a));
+ curr_track_size += (hsec[9] + 1) * little_endianize_int32(*(uint32_t *)(hsec + 0x0a));
}
}
}
@@ -239,7 +239,7 @@ bool nfd_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
}
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
int cur_sec_map = 0, sector_size;
pos = hsize;
diff --git a/src/lib/formats/nfd_dsk.h b/src/lib/formats/nfd_dsk.h
index 005196399ba..9721f23478d 100644
--- a/src/lib/formats/nfd_dsk.h
+++ b/src/lib/formats/nfd_dsk.h
@@ -19,8 +19,8 @@ class nfd_format : public floppy_image_format_t
public:
nfd_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/orao_cas.cpp b/src/lib/formats/orao_cas.cpp
index a97d8aa691f..2d0f96b2a14 100644
--- a/src/lib/formats/orao_cas.cpp
+++ b/src/lib/formats/orao_cas.cpp
@@ -19,10 +19,10 @@
#define ORAO_HEADER_SIZE 360
-static INT16 wave_data;
+static int16_t wave_data;
static int len;
-static void orao_output_wave( INT16 **buffer, int length ) {
+static void orao_output_wave( int16_t **buffer, int length ) {
if ( buffer == nullptr ) {
return;
}
@@ -32,9 +32,9 @@ static void orao_output_wave( INT16 **buffer, int length ) {
*buffer = *buffer + 1;
}
}
-static int orao_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int orao_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
int i,j,size;
- UINT8 b;
+ uint8_t b;
if (casdata == nullptr) return -1;
if (caslen <= ORAO_HEADER_SIZE) {
@@ -55,9 +55,9 @@ static int orao_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
return size;
}
-static int orao_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int orao_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int i,j,size;
- UINT8 b;
+ uint8_t b;
size = 0;
if (bytes == nullptr) return -1;
for (i=ORAO_HEADER_SIZE;i<len-ORAO_HEADER_SIZE;i++) {
diff --git a/src/lib/formats/oric_dsk.cpp b/src/lib/formats/oric_dsk.cpp
index 5d3071e77c1..45cbcab0fee 100644
--- a/src/lib/formats/oric_dsk.cpp
+++ b/src/lib/formats/oric_dsk.cpp
@@ -35,9 +35,9 @@ bool oric_dsk_format::supports_save() const
return true;
}
-int oric_dsk_format::identify(io_generic *io, UINT32 form_factor)
+int oric_dsk_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[256];
+ uint8_t h[256];
io_generic_read(io, h, 0, 256);
if(memcmp(h, "MFM_DISK", 8))
@@ -54,10 +54,10 @@ int oric_dsk_format::identify(io_generic *io, UINT32 form_factor)
return 100;
}
-bool oric_dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool oric_dsk_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 h[256];
- UINT8 t[6250+3];
+ uint8_t h[256];
+ uint8_t t[6250+3];
t[6250] = t[6251] = t[6252] = 0;
io_generic_read(io, h, 0, 256);
@@ -68,7 +68,7 @@ bool oric_dsk_format::load(io_generic *io, UINT32 form_factor, floppy_image *ima
for(int side=0; side<sides; side++)
for(int track=0; track<tracks; track++) {
io_generic_read(io, t, 256+6400*(tracks*side + track), 6250);
- std::vector<UINT32> stream;
+ std::vector<uint32_t> stream;
int sector_size = 128;
for(int i=0; i<6250; i++) {
if(t[i] == 0xc2 && t[i+1] == 0xc2 && t[i+2] == 0xc2) {
diff --git a/src/lib/formats/oric_dsk.h b/src/lib/formats/oric_dsk.h
index 3eeb719eed0..23125546931 100644
--- a/src/lib/formats/oric_dsk.h
+++ b/src/lib/formats/oric_dsk.h
@@ -17,8 +17,8 @@ class oric_dsk_format : public floppy_image_format_t
{
public:
oric_dsk_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
diff --git a/src/lib/formats/oric_tap.cpp b/src/lib/formats/oric_tap.cpp
index 5c24d40f47e..c9f84dc7c2a 100644
--- a/src/lib/formats/oric_tap.cpp
+++ b/src/lib/formats/oric_tap.cpp
@@ -51,7 +51,7 @@ static oric_t oric;
/* 8 periods at 2400Hz */
/* hi,lo, hi,lo, hi,lo, hi,lo */
-static INT16 *oric_emit_level(INT16 *p, int count, INT16 wave_state)
+static int16_t *oric_emit_level(int16_t *p, int count, int16_t wave_state)
{
int i;
@@ -63,7 +63,7 @@ static INT16 *oric_emit_level(INT16 *p, int count, INT16 wave_state)
}
/* 4 periods at 1200Hz */
-static INT16* oric_output_bit(INT16 *p, UINT8 b)
+static int16_t* oric_output_bit(int16_t *p, uint8_t b)
{
p = oric_emit_level(p, 1, WAVEENTRY_HIGH);
p = oric_emit_level(p, b ? 1 : 2, WAVEENTRY_LOW);
@@ -71,7 +71,7 @@ static INT16* oric_output_bit(INT16 *p, UINT8 b)
return p;
}
-static int oric_get_bit_size_in_samples(UINT8 b)
+static int oric_get_bit_size_in_samples(uint8_t b)
{
int count;
@@ -119,12 +119,12 @@ static int oric_get_bit_size_in_samples(UINT8 b)
1 * ? -> ???
*/
-static int oric_calculate_byte_size_in_samples(UINT8 byte)
+static int oric_calculate_byte_size_in_samples(uint8_t byte)
{
int count;
int i;
- UINT8 parity;
- UINT8 data;
+ uint8_t parity;
+ uint8_t data;
count = 0;
@@ -139,7 +139,7 @@ static int oric_calculate_byte_size_in_samples(UINT8 byte)
data = byte;
for (i=0; i<8; i++)
{
- UINT8 data_bit;
+ uint8_t data_bit;
data_bit = data & 0x01;
@@ -162,11 +162,11 @@ static int oric_calculate_byte_size_in_samples(UINT8 byte)
}
-static INT16 *oric_output_byte(INT16 *p, UINT8 byte)
+static int16_t *oric_output_byte(int16_t *p, uint8_t byte)
{
int i;
- UINT8 parity;
- UINT8 data;
+ uint8_t parity;
+ uint8_t data;
/* start bit */
p = oric_output_bit(p, 0);
@@ -178,7 +178,7 @@ static INT16 *oric_output_byte(INT16 *p, UINT8 byte)
data = byte;
for (i=0; i<8; i++)
{
- UINT8 data_bit;
+ uint8_t data_bit;
data_bit = data & 0x01;
@@ -200,7 +200,7 @@ static INT16 *oric_output_byte(INT16 *p, UINT8 byte)
return p;
}
-static INT16 *oric_fill_pause(INT16 *p, int sample_count)
+static int16_t *oric_fill_pause(int16_t *p, int sample_count)
{
int i;
@@ -218,14 +218,14 @@ static int oric_seconds_to_samples(float seconds)
}
/* length is length of .tap file! */
-static int oric_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int oric_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
unsigned char header[9];
int count;
- const UINT8 *data_ptr;
+ const uint8_t *data_ptr;
int i;
- UINT8 data;
+ uint8_t data;
oric.tap_size = length;
@@ -302,7 +302,7 @@ static int oric_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
/* got end of filename? */
if (data==0)
{
- UINT16 end, start;
+ uint16_t end, start;
LOG_FORMATS("got end of filename\n");
/* 100 1 bits to separate header from data */
@@ -343,13 +343,13 @@ static int oric_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
}
/* length is length of sample buffer to fill! */
-static int oric_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int oric_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
unsigned char header[9];
- UINT8 *data_ptr;
- INT16 *p;
+ uint8_t *data_ptr;
+ int16_t *p;
int i;
- UINT8 data;
+ uint8_t data;
p = buffer;
@@ -438,7 +438,7 @@ static int oric_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
/* got end of filename? */
if (data==0)
{
- UINT16 end, start;
+ uint16_t end, start;
LOG_FORMATS("got end of filename\n");
/* oric includes a small delay, but I don't see
diff --git a/src/lib/formats/p6001_cas.cpp b/src/lib/formats/p6001_cas.cpp
index bcaf97d94ba..37e1ffcfa2c 100644
--- a/src/lib/formats/p6001_cas.cpp
+++ b/src/lib/formats/p6001_cas.cpp
@@ -13,7 +13,7 @@
static int cas_size;
-static int pc6001_fill_wave(INT16* buffer, UINT8 data, int sample_pos)
+static int pc6001_fill_wave(int16_t* buffer, uint8_t data, int sample_pos)
{
int x;
int sample_count = 0;
@@ -29,7 +29,7 @@ static int pc6001_fill_wave(INT16* buffer, UINT8 data, int sample_pos)
return sample_count;
}
-static int pc6001_handle_cas(INT16* buffer, const UINT8* casdata)
+static int pc6001_handle_cas(int16_t* buffer, const uint8_t* casdata)
{
int sample_count = 0;
int data_pos = 0;
@@ -46,7 +46,7 @@ static int pc6001_handle_cas(INT16* buffer, const UINT8* casdata)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int pc6001_cas_to_wav_size (const UINT8 *casdata, int caslen)
+static int pc6001_cas_to_wav_size (const uint8_t *casdata, int caslen)
{
cas_size = caslen*8;
@@ -56,7 +56,7 @@ static int pc6001_cas_to_wav_size (const UINT8 *casdata, int caslen)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int pc6001_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int pc6001_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return pc6001_handle_cas(buffer,bytes);
}
diff --git a/src/lib/formats/pasti_dsk.cpp b/src/lib/formats/pasti_dsk.cpp
index 9ddce45138a..3bf5fa7a243 100644
--- a/src/lib/formats/pasti_dsk.cpp
+++ b/src/lib/formats/pasti_dsk.cpp
@@ -37,9 +37,9 @@ bool pasti_format::supports_save() const
return false;
}
-int pasti_format::identify(io_generic *io, UINT32 form_factor)
+int pasti_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[16];
+ uint8_t h[16];
io_generic_read(io, h, 0, 16);
if(!memcmp(h, "RSY\0\3\0", 6) &&
@@ -49,7 +49,7 @@ int pasti_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-static void hexdump(const UINT8 *d, int s)
+static void hexdump(const uint8_t *d, int s)
{
for(int i=0; i<s; i+=32) {
printf("%04x:", i);
@@ -59,12 +59,12 @@ static void hexdump(const UINT8 *d, int s)
}
}
-bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool pasti_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 fh[16];
+ uint8_t fh[16];
io_generic_read(io, fh, 0, 16);
- std::vector<UINT8> raw_track;
+ std::vector<uint8_t> raw_track;
int tracks = fh[10];
int heads = 1+(tracks >= 160);
@@ -76,7 +76,7 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for(int track=0; track < tracks; track++) {
for(int head=0; head < heads; head++) {
- UINT8 th[16];
+ uint8_t th[16];
io_generic_read(io, th, pos, 16);
int entry_len = th[0] | (th[1] << 8) | (th[2] << 16) | (th[3] << 24);
int fuzz_len = th[4] | (th[5] << 8) | (th[6] << 16) | (th[7] << 24);
@@ -90,9 +90,9 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
io_generic_read(io, &raw_track[0], pos+16, entry_len-16);
- UINT8 *fuzz = fuzz_len ? &raw_track[16*sect] : nullptr;
- UINT8 *bdata = fuzz ? fuzz+fuzz_len : &raw_track[16*sect];
- UINT8 *tdata = bdata;
+ uint8_t *fuzz = fuzz_len ? &raw_track[16*sect] : nullptr;
+ uint8_t *bdata = fuzz ? fuzz+fuzz_len : &raw_track[16*sect];
+ uint8_t *tdata = bdata;
int syncpos = -1;
if(flags & 0x0080) {
@@ -126,7 +126,7 @@ bool pasti_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
}
for(int s=0; s<sect; s++) {
- UINT8 *sh = &raw_track[16*s];
+ uint8_t *sh = &raw_track[16*s];
int s_off = sh[0] | (sh[1] << 8) | (sh[2] << 16) | (sh[3] << 24);
int s_pos = sh[4] | (sh[5] << 8);
int s_time = sh[6] | (sh[7] << 8);
@@ -170,7 +170,7 @@ void pasti_format::wd_generate_track_from_observations(int track, int head, flop
wd_generate_track_from_sectors_and_track(track, head, image, obs);
}
-void pasti_format::wd_generate_unsynced_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, UINT32 cell_size)
+void pasti_format::wd_generate_unsynced_gap(std::vector<uint32_t> &track, const wd_obs &obs, int tstart, int tend, uint32_t cell_size)
{
for(int i=tstart; i != tend;) {
unsigned char v = obs.track_data[i];
@@ -196,7 +196,7 @@ void pasti_format::wd_generate_unsynced_gap(std::vector<UINT32> &track, const wd
}
}
-void pasti_format::wd_generate_synced_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, UINT32 cell_size)
+void pasti_format::wd_generate_synced_gap(std::vector<uint32_t> &track, const wd_obs &obs, int tstart, int tend, uint32_t cell_size)
{
for(int i = tstart; i != tend; i++) {
unsigned char v = obs.track_data[i];
@@ -214,7 +214,7 @@ void pasti_format::wd_generate_synced_gap(std::vector<UINT32> &track, const wd_o
}
}
-void pasti_format::wd_generate_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, bool synced, UINT32 cell_size_start, UINT32 cell_size_end)
+void pasti_format::wd_generate_gap(std::vector<uint32_t> &track, const wd_obs &obs, int tstart, int tend, bool synced, uint32_t cell_size_start, uint32_t cell_size_end)
{
unsigned int spos = track.size();
if(!synced) {
@@ -231,10 +231,10 @@ void pasti_format::wd_generate_gap(std::vector<UINT32> &track, const wd_obs &obs
wd_generate_synced_gap(track, obs, tstart, tend, cell_size_start);
if(cell_size_end != cell_size_start) {
- INT32 total_size = 0;
+ int32_t total_size = 0;
for(unsigned int i=spos; i != track.size(); i++)
total_size += track[i] & floppy_image::TIME_MASK;
- INT64 cur_size = 0;
+ int64_t cur_size = 0;
for(unsigned int i=spos; i != track.size(); i++) {
cur_size += track[i] & floppy_image::TIME_MASK;
track[i] = (track[i] & floppy_image::MG_MASK) |
@@ -243,7 +243,7 @@ void pasti_format::wd_generate_gap(std::vector<UINT32> &track, const wd_obs &obs
}
}
-void pasti_format::wd_generate_sector_header(std::vector<UINT32> &track, const wd_obs &obs, int sector, int tstart, UINT32 cell_size)
+void pasti_format::wd_generate_sector_header(std::vector<uint32_t> &track, const wd_obs &obs, int sector, int tstart, uint32_t cell_size)
{
raw_w(track, 16, 0x4489, cell_size);
raw_w(track, 16, 0x4489, cell_size);
@@ -253,7 +253,7 @@ void pasti_format::wd_generate_sector_header(std::vector<UINT32> &track, const w
mfm_w(track, 8, obs.sectors[sector].id[i], cell_size);
}
-void pasti_format::wd_generate_sector_data(std::vector<UINT32> &track, const wd_obs &obs, int sector, int tstart, UINT32 cell_size)
+void pasti_format::wd_generate_sector_data(std::vector<uint32_t> &track, const wd_obs &obs, int sector, int tstart, uint32_t cell_size)
{
const wd_sect &s = obs.sectors[sector];
raw_w(track, 16, 0x4489, cell_size);
@@ -262,7 +262,7 @@ void pasti_format::wd_generate_sector_data(std::vector<UINT32> &track, const wd_
mfm_w(track, 8, obs.track_data[tstart+3], cell_size);
for(int i=0; i<128 << (s.id[3] & 3); i++)
mfm_w(track, 8, s.data[i], cell_size);
- UINT16 crc = calc_crc_ccitt(track, track.size() - (2048 << (s.id[3] & 3)) - 16*4, track.size());
+ uint16_t crc = calc_crc_ccitt(track, track.size() - (2048 << (s.id[3] & 3)) - 16*4, track.size());
mfm_w(track, 8, crc >> 8, cell_size);
mfm_w(track, 8, crc, cell_size);
}
@@ -271,7 +271,7 @@ void pasti_format::wd_generate_track_from_sectors_and_track(int track, int head,
{
if(0)
printf("Track %d head %d sectors %d\n", track, head, obs.sector_count);
- std::vector<UINT32> trackbuf;
+ std::vector<uint32_t> trackbuf;
wd_sect_info sect_infos[256];
@@ -306,7 +306,7 @@ void pasti_format::wd_generate_track_from_sectors_and_track(int track, int head,
return;
}
- UINT32 cell_size = UINT32(obs.sectors[0].time_ratio * 1000+0.5);
+ uint32_t cell_size = uint32_t(obs.sectors[0].time_ratio * 1000+0.5);
wd_generate_gap(trackbuf, obs, 0, sect_infos[0].hstart, false, cell_size, cell_size);
for(int i=0; i != obs.sector_count; i++) {
@@ -318,7 +318,7 @@ void pasti_format::wd_generate_track_from_sectors_and_track(int track, int head,
}
}
- UINT32 ncell_size = UINT32(obs.sectors[i+1 != obs.sector_count ? i+1 : 0].time_ratio * 1000+0.5);
+ uint32_t ncell_size = uint32_t(obs.sectors[i+1 != obs.sector_count ? i+1 : 0].time_ratio * 1000+0.5);
wd_generate_sector_header(trackbuf, obs, i, s->hstart, cell_size);
@@ -361,7 +361,7 @@ void pasti_format::wd_generate_track_from_sectors_only(int track, int head, flop
}
}
- std::vector<UINT32> tdata;
+ std::vector<uint32_t> tdata;
for(int i=0; i != obs.sector_count; i++) {
const wd_sect &s = obs.sectors[i];
if(i+1 != obs.sector_count && obs.sectors[i+1].position < s.position+10+44+4+(128 << (s.id[3] & 3))) {
@@ -407,7 +407,7 @@ void pasti_format::wd_generate_track_from_sectors_only(int track, int head, flop
mfm_w(tdata, 8, 0xfb);
for(int j=0; j<128 << (s.id[3] & 3); j++)
mfm_w(tdata, 8, s.data[j]);
- UINT16 crc = calc_crc_ccitt(tdata, tdata.size() - (2048 << (s.id[3] & 3)) - 16*4, tdata.size());
+ uint16_t crc = calc_crc_ccitt(tdata, tdata.size() - (2048 << (s.id[3] & 3)) - 16*4, tdata.size());
mfm_w(tdata, 8, crc >> 8);
mfm_w(tdata, 8, crc);
}
@@ -419,9 +419,9 @@ void pasti_format::wd_generate_track_from_sectors_only(int track, int head, flop
generate_track_from_levels(track, head, tdata, 0, image);
}
-UINT16 pasti_format::byte_to_mfm(UINT8 data, bool context)
+uint16_t pasti_format::byte_to_mfm(uint8_t data, bool context)
{
- static const UINT8 expand[32] = {
+ static const uint8_t expand[32] = {
0xaa, 0xa9, 0xa4, 0xa5, 0x92, 0x91, 0x94, 0x95, 0x4a, 0x49, 0x44, 0x45, 0x52, 0x51, 0x54, 0x55,
0x2a, 0x29, 0x24, 0x25, 0x12, 0x11, 0x14, 0x15, 0x4a, 0x49, 0x44, 0x45, 0x52, 0x51, 0x54, 0x55,
};
@@ -429,15 +429,15 @@ UINT16 pasti_format::byte_to_mfm(UINT8 data, bool context)
return (expand[(data >> 4) | (context ? 16 : 0)] << 8) | expand[data & 0x1f];
}
-void pasti_format::match_mfm_data(wd_obs &obs, int tpos, const UINT8 *data, int size, UINT8 context, int &bcount, int &tend, bool &synced)
+void pasti_format::match_mfm_data(wd_obs &obs, int tpos, const uint8_t *data, int size, uint8_t context, int &bcount, int &tend, bool &synced)
{
- UINT16 shift = byte_to_mfm(context, true);
+ uint16_t shift = byte_to_mfm(context, true);
int bc = 0;
int bc_phase = 0;
int bi = 0;
- UINT8 dbyte = 0;
+ uint8_t dbyte = 0;
bool ds_phase = false;
- UINT16 inshift = byte_to_mfm(data[bi++], shift & 1);
+ uint16_t inshift = byte_to_mfm(data[bi++], shift & 1);
synced = false;
for(;;) {
int bit = (inshift >> (15-bc)) & 1;
@@ -474,7 +474,7 @@ void pasti_format::match_mfm_data(wd_obs &obs, int tpos, const UINT8 *data, int
}
}
-void pasti_format::match_raw_data(wd_obs &obs, int tpos, const UINT8 *data, int size, UINT8 context, int &bcount, int &tend)
+void pasti_format::match_raw_data(wd_obs &obs, int tpos, const uint8_t *data, int size, uint8_t context, int &bcount, int &tend)
{
tend = tpos;
for(bcount=0; bcount != size; bcount++) {
@@ -486,9 +486,9 @@ void pasti_format::match_raw_data(wd_obs &obs, int tpos, const UINT8 *data, int
}
}
-UINT16 pasti_format::calc_crc(const UINT8 *data, int size, UINT16 crc1)
+uint16_t pasti_format::calc_crc(const uint8_t *data, int size, uint16_t crc1)
{
- UINT32 crc = crc1;
+ uint32_t crc = crc1;
for(int i=0; i<size; i++) {
crc = (crc << 8) ^ (*data++ << 16);
if(crc & 0x800000) crc ^= 0x881080;
@@ -514,7 +514,7 @@ void pasti_format::map_sectors_in_track(wd_obs &obs, wd_sect_info *sect_infos)
sect_infos[i].dsynced = false;
}
- const UINT8 *tdata = obs.track_data;
+ const uint8_t *tdata = obs.track_data;
int tsize = obs.track_size;
for(int i=0; i != tsize; i++)
@@ -522,7 +522,7 @@ void pasti_format::map_sectors_in_track(wd_obs &obs, wd_sect_info *sect_infos)
tdata[(i+1) % tsize] == 0xa1 &&
(tdata[(i+2) % tsize] == 0xfe ||
tdata[(i+2) % tsize] == 0xff)) {
- UINT8 hbyte = tdata[(i+2) % tsize];
+ uint8_t hbyte = tdata[(i+2) % tsize];
int hpos = (i+3) % tsize;
int j;
bool synced = false;
@@ -575,7 +575,7 @@ void pasti_format::map_sectors_in_track(wd_obs &obs, wd_sect_info *sect_infos)
}
if(dpos != -1) {
int bcount2, tend2;
- UINT8 dhbyte = tdata[(dpos+tsize-1) % tsize];
+ uint8_t dhbyte = tdata[(dpos+tsize-1) % tsize];
int ssize = 128 << (obs.sectors[j].id[3] & 3);
match_mfm_data(obs, dpos, obs.sectors[j].data, ssize, dhbyte, bcount, tend, synced);
if(bcount < ssize) {
@@ -587,7 +587,7 @@ void pasti_format::map_sectors_in_track(wd_obs &obs, wd_sect_info *sect_infos)
synced = true;
}
}
- UINT16 crc = calc_crc(obs.sectors[j].data, ssize, calc_crc(tdata+((dpos+tsize-1) % tsize), 1, 0xcdb4));
+ uint16_t crc = calc_crc(obs.sectors[j].data, ssize, calc_crc(tdata+((dpos+tsize-1) % tsize), 1, 0xcdb4));
if(synced && tdata[tend] == (crc >> 8) && tdata[(tend+1) % tsize] == (crc & 0xff)) {
tend = (tend+2) % tsize;
bcount += 2;
diff --git a/src/lib/formats/pasti_dsk.h b/src/lib/formats/pasti_dsk.h
index fe724fb1fb5..f1fc1a75aaa 100644
--- a/src/lib/formats/pasti_dsk.h
+++ b/src/lib/formats/pasti_dsk.h
@@ -10,8 +10,8 @@ class pasti_format : public floppy_image_format_t
public:
pasti_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 const char *name() const override;
virtual const char *description() const override;
@@ -22,15 +22,15 @@ public:
protected:
struct wd_sect {
- const UINT8 *data;
- const UINT8 *fuzzy_mask;
- UINT8 id[6];
+ const uint8_t *data;
+ const uint8_t *fuzzy_mask;
+ uint8_t id[6];
int position;
double time_ratio;
};
struct wd_obs {
- const UINT8 *track_data;
+ const uint8_t *track_data;
wd_sect sectors[256];
int track_size, sector_count;
};
@@ -45,16 +45,16 @@ private:
};
void map_sectors_in_track(wd_obs &obs, wd_sect_info *sect_infos);
- void match_mfm_data(wd_obs &obs, int tpos, const UINT8 *data, int size, UINT8 context, int &bcount, int &ccount, bool &synced);
- void match_raw_data(wd_obs &obs, int tpos, const UINT8 *data, int size, UINT8 context, int &bcount, int &ccount);
- UINT16 byte_to_mfm(UINT8 data, bool context);
- UINT16 calc_crc(const UINT8 *data, int size, UINT16 crc);
+ void match_mfm_data(wd_obs &obs, int tpos, const uint8_t *data, int size, uint8_t context, int &bcount, int &ccount, bool &synced);
+ void match_raw_data(wd_obs &obs, int tpos, const uint8_t *data, int size, uint8_t context, int &bcount, int &ccount);
+ uint16_t byte_to_mfm(uint8_t data, bool context);
+ uint16_t calc_crc(const uint8_t *data, int size, uint16_t crc);
- void wd_generate_unsynced_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, UINT32 cell_size);
- void wd_generate_synced_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, UINT32 cell_size);
- void wd_generate_gap(std::vector<UINT32> &track, const wd_obs &obs, int tstart, int tend, bool synced, UINT32 cell_size_start, UINT32 cell_size_end);
- void wd_generate_sector_header(std::vector<UINT32> &track, const wd_obs &obs, int sector, int tstart, UINT32 cell_size);
- void wd_generate_sector_data(std::vector<UINT32> &track, const wd_obs &obs, int sector, int tstart, UINT32 cell_size);
+ void wd_generate_unsynced_gap(std::vector<uint32_t> &track, const wd_obs &obs, int tstart, int tend, uint32_t cell_size);
+ void wd_generate_synced_gap(std::vector<uint32_t> &track, const wd_obs &obs, int tstart, int tend, uint32_t cell_size);
+ void wd_generate_gap(std::vector<uint32_t> &track, const wd_obs &obs, int tstart, int tend, bool synced, uint32_t cell_size_start, uint32_t cell_size_end);
+ void wd_generate_sector_header(std::vector<uint32_t> &track, const wd_obs &obs, int sector, int tstart, uint32_t cell_size);
+ void wd_generate_sector_data(std::vector<uint32_t> &track, const wd_obs &obs, int sector, int tstart, uint32_t cell_size);
void wd_generate_track_from_sectors_and_track(int track, int head, floppy_image *image, wd_obs &obs);
void wd_generate_track_from_sectors_only(int track, int head, floppy_image *image, wd_obs &obs);
};
diff --git a/src/lib/formats/pc98fdi_dsk.cpp b/src/lib/formats/pc98fdi_dsk.cpp
index c4c21d937f6..5b37b1ede37 100644
--- a/src/lib/formats/pc98fdi_dsk.cpp
+++ b/src/lib/formats/pc98fdi_dsk.cpp
@@ -30,35 +30,35 @@ const char *pc98fdi_format::extensions() const
return "fdi";
}
-int pc98fdi_format::identify(io_generic *io, UINT32 form_factor)
+int pc98fdi_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
- UINT8 h[32];
+ uint64_t size = io_generic_size(io);
+ uint8_t h[32];
io_generic_read(io, h, 0, 32);
- UINT32 hsize = little_endianize_int32(*(UINT32 *) (h + 0x8));
- UINT32 psize = little_endianize_int32(*(UINT32 *) (h + 0xc));
- UINT32 ssize = little_endianize_int32(*(UINT32 *) (h + 0x10));
- UINT32 scnt = little_endianize_int32(*(UINT32 *) (h + 0x14));
- UINT32 sides = little_endianize_int32(*(UINT32 *) (h + 0x18));
- UINT32 ntrk = little_endianize_int32(*(UINT32 *) (h + 0x1c));
+ uint32_t hsize = little_endianize_int32(*(uint32_t *) (h + 0x8));
+ uint32_t psize = little_endianize_int32(*(uint32_t *) (h + 0xc));
+ uint32_t ssize = little_endianize_int32(*(uint32_t *) (h + 0x10));
+ uint32_t scnt = little_endianize_int32(*(uint32_t *) (h + 0x14));
+ uint32_t sides = little_endianize_int32(*(uint32_t *) (h + 0x18));
+ uint32_t ntrk = little_endianize_int32(*(uint32_t *) (h + 0x1c));
if(size == hsize + psize && psize == ssize*scnt*sides*ntrk)
return 100;
return 0;
}
-bool pc98fdi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool pc98fdi_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 h[32];
+ uint8_t h[32];
io_generic_read(io, h, 0, 32);
- UINT32 hsize = little_endianize_int32(*(UINT32 *)(h+0x8));
- UINT32 sector_size = little_endianize_int32(*(UINT32 *)(h+0x10));
- UINT32 sector_count = little_endianize_int32(*(UINT32 *)(h+0x14));
- UINT32 head_count = little_endianize_int32(*(UINT32 *)(h+0x18));
- UINT32 track_count = little_endianize_int32(*(UINT32 *)(h+0x1c));
+ uint32_t hsize = little_endianize_int32(*(uint32_t *)(h+0x8));
+ uint32_t sector_size = little_endianize_int32(*(uint32_t *)(h+0x10));
+ uint32_t sector_count = little_endianize_int32(*(uint32_t *)(h+0x14));
+ uint32_t head_count = little_endianize_int32(*(uint32_t *)(h+0x18));
+ uint32_t track_count = little_endianize_int32(*(uint32_t *)(h+0x1c));
int cell_count = form_factor == floppy_image::FF_35 ? 200000 : 166666;
@@ -66,7 +66,7 @@ bool pc98fdi_format::load(io_generic *io, UINT32 form_factor, floppy_image *imag
for(ssize=0; (128 << ssize) < sector_size; ssize++) {};
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
for(int track=0; track < track_count; track++)
for(int head=0; head < head_count; head++) {
diff --git a/src/lib/formats/pc98fdi_dsk.h b/src/lib/formats/pc98fdi_dsk.h
index 05fd1ccc361..46503c81d9c 100644
--- a/src/lib/formats/pc98fdi_dsk.h
+++ b/src/lib/formats/pc98fdi_dsk.h
@@ -19,8 +19,8 @@ class pc98fdi_format : public floppy_image_format_t
public:
pc98fdi_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 const char *name() const override;
virtual const char *description() const override;
diff --git a/src/lib/formats/pc_dsk.cpp b/src/lib/formats/pc_dsk.cpp
index a2e597294f0..73ef727cdaf 100644
--- a/src/lib/formats/pc_dsk.cpp
+++ b/src/lib/formats/pc_dsk.cpp
@@ -16,7 +16,7 @@
struct pc_disk_sizes
{
- UINT32 image_size;
+ uint32_t image_size;
int sectors;
int heads;
};
@@ -43,7 +43,7 @@ static const struct pc_disk_sizes disk_sizes[] =
static floperr_t pc_dsk_compute_geometry(floppy_image_legacy *floppy, struct basicdsk_geometry *geometry)
{
int i;
- UINT64 size;
+ uint64_t size;
memset(geometry, 0, sizeof(*geometry));
size = floppy_image_size(floppy);
@@ -67,12 +67,12 @@ static floperr_t pc_dsk_compute_geometry(floppy_image_legacy *floppy, struct bas
* get info from boot sector.
* not correct on all disks
*/
- UINT8 scl, spt, heads;
+ uint8_t scl, spt, heads;
floppy_image_read(floppy, &scl, 0x0c, 1);
floppy_image_read(floppy, &spt, 0x18, 1);
floppy_image_read(floppy, &heads, 0x1A, 1);
- if (size == ((UINT64) scl) * spt * heads * 0x200)
+ if (size == ((uint64_t) scl) * spt * heads * 0x200)
{
geometry->sectors = spt;
geometry->heads = heads;
diff --git a/src/lib/formats/phc25_cas.cpp b/src/lib/formats/phc25_cas.cpp
index 16a38120441..2cc9ea013e6 100644
--- a/src/lib/formats/phc25_cas.cpp
+++ b/src/lib/formats/phc25_cas.cpp
@@ -42,7 +42,7 @@ enough to make it work.
// image size
static int phc25_image_size;
-static int phc25_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int phc25_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -53,7 +53,7 @@ static int phc25_put_samples(INT16 *buffer, int sample_pos, int count, int level
return count;
}
-static int phc25_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int phc25_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -73,10 +73,10 @@ static int phc25_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int phc25_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int phc25_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* start */
samples += phc25_output_bit (buffer, sample_pos + samples, 0);
@@ -92,11 +92,11 @@ static int phc25_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int phc25_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int phc25_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 byte_count = 0;
- UINT32 i;
+ uint32_t sample_count = 0;
+ uint32_t byte_count = 0;
+ uint32_t i;
// silence
// sample_count += phc25_put_samples(buffer, 6640, 2, WAVEENTRY_HIGH);
@@ -131,7 +131,7 @@ static int phc25_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int phc25_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int phc25_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return phc25_handle_cassette(buffer, bytes);
}
@@ -140,7 +140,7 @@ static int phc25_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int phc25_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int phc25_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
phc25_image_size = length;
diff --git a/src/lib/formats/pmd_cas.cpp b/src/lib/formats/pmd_cas.cpp
index 516f8cf867b..79e8820b4bb 100644
--- a/src/lib/formats/pmd_cas.cpp
+++ b/src/lib/formats/pmd_cas.cpp
@@ -28,7 +28,7 @@
// image size
static int pmd85_image_size;
-static int pmd85_emit_level(INT16 *buffer, int sample_pos, int count, int level)
+static int pmd85_emit_level(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -39,7 +39,7 @@ static int pmd85_emit_level(INT16 *buffer, int sample_pos, int count, int level)
return count;
}
-static int pmd85_output_bit(INT16 *buffer, int sample_pos, UINT8 bit)
+static int pmd85_output_bit(int16_t *buffer, int sample_pos, uint8_t bit)
{
int samples = 0;
@@ -57,7 +57,7 @@ static int pmd85_output_bit(INT16 *buffer, int sample_pos, UINT8 bit)
return samples;
}
-static int pmd85_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int pmd85_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
@@ -75,7 +75,7 @@ static int pmd85_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static bool pmd85_is_header_block(const UINT8 *bytes)
+static bool pmd85_is_header_block(const uint8_t *bytes)
{
for (int i=0; i<0x10; i++)
{
@@ -86,12 +86,12 @@ static bool pmd85_is_header_block(const UINT8 *bytes)
return true;
}
-static void pmd85_printf_image_info(const UINT8 *bytes, int sample_count)
+static void pmd85_printf_image_info(const uint8_t *bytes, int sample_count)
{
#if 0
char track_name[9];
- UINT32 sec = (UINT32)(sample_count/PMD85_WAV_FREQUENCY);
- UINT16 addr = (bytes[0x33]<<8) | bytes[0x32];
+ uint32_t sec = (uint32_t)(sample_count/PMD85_WAV_FREQUENCY);
+ uint16_t addr = (bytes[0x33]<<8) | bytes[0x32];
strncpy(track_name, (char*)&bytes[0x36], 8);
track_name[8] = '\0';
@@ -99,7 +99,7 @@ static void pmd85_printf_image_info(const UINT8 *bytes, int sample_count)
#endif
}
-static int pmd85_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int pmd85_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
int sample_count = 0;
@@ -137,7 +137,7 @@ static int pmd85_handle_cassette(INT16 *buffer, const UINT8 *bytes)
int data_pos = 0;
while (data_pos < pmd85_image_size)
{
- UINT16 block_size = (bytes[data_pos + 1]<<8) | bytes[data_pos];
+ uint16_t block_size = (bytes[data_pos + 1]<<8) | bytes[data_pos];
int pause_len = PMD85_PAUSE_BITS;
data_pos += 2;
@@ -168,7 +168,7 @@ static int pmd85_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int pmd85_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int pmd85_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return pmd85_handle_cassette(buffer, bytes);
}
@@ -177,7 +177,7 @@ static int pmd85_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int pmd85_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int pmd85_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
pmd85_image_size = length;
diff --git a/src/lib/formats/primoptp.cpp b/src/lib/formats/primoptp.cpp
index b3c1875ffb1..5c6779b6613 100644
--- a/src/lib/formats/primoptp.cpp
+++ b/src/lib/formats/primoptp.cpp
@@ -26,9 +26,9 @@
#define PRIMO_FILE_PILOT_LENGTH ((4*PRIMO_BIT_1_LENGTH + 4*PRIMO_BIT_0_LENGTH)*512)
#define PRIMO_BLOCK_PILOT_LENGTH ((8*PRIMO_BIT_1_LENGTH)*96 + (5*PRIMO_BIT_1_LENGTH + 3*PRIMO_BIT_0_LENGTH)*3)
-static UINT32 primo_tape_image_length;
+static uint32_t primo_tape_image_length;
-static INT16 *primo_emit_level(INT16 *p, int count, int level)
+static int16_t *primo_emit_level(int16_t *p, int count, int level)
{
int i;
@@ -37,7 +37,7 @@ static INT16 *primo_emit_level(INT16 *p, int count, int level)
return p;
}
-static INT16* primo_output_bit(INT16 *p, UINT8 bit)
+static int16_t* primo_output_bit(int16_t *p, uint8_t bit)
{
if (bit)
{
@@ -52,7 +52,7 @@ static INT16* primo_output_bit(INT16 *p, UINT8 bit)
return p;
}
-static INT16* primo_output_byte(INT16 *p, UINT8 byte)
+static int16_t* primo_output_byte(int16_t *p, uint8_t byte)
{
int i;
@@ -62,11 +62,11 @@ static INT16* primo_output_byte(INT16 *p, UINT8 byte)
return p;
}
-static UINT32 primo_cassette_calculate_number_of_1(const UINT8 *bytes, UINT16 length)
+static uint32_t primo_cassette_calculate_number_of_1(const uint8_t *bytes, uint16_t length)
{
int i,j;
- UINT32 number_of_1 = 0;
+ uint32_t number_of_1 = 0;
for (i=0; i<length; i++)
for (j=0; j<8; j++)
@@ -76,18 +76,18 @@ static UINT32 primo_cassette_calculate_number_of_1(const UINT8 *bytes, UINT16 le
return number_of_1;
}
-static int primo_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int primo_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
int i = 0, j = 0;
- UINT8 *b = (UINT8*) bytes;
+ uint8_t *b = (uint8_t*) bytes;
- UINT32 file_size = 0;
- UINT16 block_size = 0;
+ uint32_t file_size = 0;
+ uint16_t block_size = 0;
- UINT32 number_of_1 = 0;
- UINT32 number_of_0 = 0;
- UINT32 size_in_samples = 0;
+ uint32_t number_of_1 = 0;
+ uint32_t number_of_0 = 0;
+ uint32_t size_in_samples = 0;
primo_tape_image_length = length;
@@ -142,15 +142,15 @@ static int primo_cassette_calculate_size_in_samples(const UINT8 *bytes, int leng
return size_in_samples;
}
-static int primo_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int primo_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
int i = 0, j = 0, k;
- INT16 *p = buffer;
- UINT8 *b = bytes;
+ int16_t *p = buffer;
+ uint8_t *b = bytes;
- UINT32 file_size = 0;
- UINT16 block_size = 0;
+ uint32_t file_size = 0;
+ uint16_t block_size = 0;
LOG_FORMATS ("Image size: %d\n", length);
diff --git a/src/lib/formats/rk_cas.cpp b/src/lib/formats/rk_cas.cpp
index 8c422506451..18504fcb130 100644
--- a/src/lib/formats/rk_cas.cpp
+++ b/src/lib/formats/rk_cas.cpp
@@ -22,7 +22,7 @@
static int data_size;
-static INT16 *rk_emit_level(INT16 *p, int count, int level)
+static int16_t *rk_emit_level(int16_t *p, int count, int level)
{
int i;
@@ -33,7 +33,7 @@ static INT16 *rk_emit_level(INT16 *p, int count, int level)
return p;
}
-static INT16* rk_output_bit(INT16 *p, UINT8 b,int bitsize)
+static int16_t* rk_output_bit(int16_t *p, uint8_t b,int bitsize)
{
if (b)
{
@@ -49,7 +49,7 @@ static INT16* rk_output_bit(INT16 *p, UINT8 b,int bitsize)
return p;
}
-static INT16* rk_output_byte(INT16 *p, UINT8 byte,int bitsize)
+static int16_t* rk_output_byte(int16_t *p, uint8_t byte,int bitsize)
{
int i;
for (i=7; i>=0; i--)
@@ -59,29 +59,29 @@ static INT16* rk_output_byte(INT16 *p, UINT8 byte,int bitsize)
}
-static int rk20_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int rk20_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
data_size = caslen;
return (RK_HEADER_LEN * 8 * 2 + 8*2 + caslen * 8 * 2) * RK_SIZE_20;
}
-static int rk22_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int rk22_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
data_size = caslen;
return (RK_HEADER_LEN * 8 * 2 + 8*2 + caslen * 8 * 2) * RK_SIZE_22;
}
-static int rk60_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int rk60_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
data_size = caslen;
return (RK_HEADER_LEN * 8 * 2 + 8*2 + caslen * 8 * 2) * RK_SIZE_60;
}
-static int gam_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int gam_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
data_size = caslen;
return (RK_HEADER_LEN * 8 * 2 + caslen * 8 * 2) * RK_SIZE_20;
}
-static int rk20_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int rk20_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int i;
- INT16 * p = buffer;
+ int16_t * p = buffer;
for (i=0; i<RK_HEADER_LEN; i++) {
p = rk_output_byte (p, 0x00, RK_SIZE_20 );
@@ -95,9 +95,9 @@ static int rk20_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
return p - buffer;
}
-static int rk22_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int rk22_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int i;
- INT16 * p = buffer;
+ int16_t * p = buffer;
for (i=0; i<RK_HEADER_LEN; i++) {
p = rk_output_byte (p, 0x00, RK_SIZE_22 );
@@ -111,9 +111,9 @@ static int rk22_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
return p - buffer;
}
-static int rk60_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int rk60_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int i;
- INT16 * p = buffer;
+ int16_t * p = buffer;
for (i=0; i<RK_HEADER_LEN; i++) {
p = rk_output_byte (p, 0x00, RK_SIZE_60 );
@@ -127,9 +127,9 @@ static int rk60_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
return p - buffer;
}
-static int gam_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int gam_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int i;
- INT16 * p = buffer;
+ int16_t * p = buffer;
for (i=0; i<RK_HEADER_LEN; i++) {
p = rk_output_byte (p, 0x00, RK_SIZE_20 );
diff --git a/src/lib/formats/rx50_dsk.cpp b/src/lib/formats/rx50_dsk.cpp
index dd92318450b..a58a8c5e59c 100644
--- a/src/lib/formats/rx50_dsk.cpp
+++ b/src/lib/formats/rx50_dsk.cpp
@@ -95,12 +95,12 @@ bool rx50img_format::supports_save() const
return true;
}
-void rx50img_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count)
+void rx50img_format::find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count)
{
head_count = 1;
- UINT32 expected_size = 0;
- UINT64 size = io_generic_size(io);
+ uint32_t expected_size = 0;
+ uint64_t size = io_generic_size(io);
track_count = 80;
sector_count = 10;
@@ -124,9 +124,9 @@ void rx50img_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_c
track_count = head_count = sector_count = 0;
}
-int rx50img_format::identify(io_generic *io, UINT32 form_factor)
+int rx50img_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
if(track_count)
@@ -135,14 +135,14 @@ int rx50img_format::identify(io_generic *io, UINT32 form_factor)
}
// /* Sectors are numbered 1 to 10 */
-bool rx50img_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool rx50img_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
if(track_count == 0)
return false;
- UINT8 sectdata[10*512];
+ uint8_t sectdata[10*512];
desc_s sectors[10];
for(int i=0; i<sector_count; i++) {
sectors[i].data = sectdata + 512*i;
@@ -193,7 +193,7 @@ bool rx50img_format::save(io_generic *io, floppy_image *image)
}
}
*/
- UINT8 sectdata[11*512];
+ uint8_t sectdata[11*512];
int track_size = sector_count*512;
for(int track=0; track < track_count; track++) {
diff --git a/src/lib/formats/rx50_dsk.h b/src/lib/formats/rx50_dsk.h
index 37decb2fa09..b6d40bceeb8 100644
--- a/src/lib/formats/rx50_dsk.h
+++ b/src/lib/formats/rx50_dsk.h
@@ -22,8 +22,8 @@ class rx50img_format : public floppy_image_format_t
public:
rx50img_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
@@ -34,7 +34,7 @@ public:
static const desc_e rx50_10_desc[];
private:
- void find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count);
+ void find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count);
};
extern const floppy_format_type FLOPPY_RX50IMG_FORMAT;
diff --git a/src/lib/formats/sc3000_bit.cpp b/src/lib/formats/sc3000_bit.cpp
index 8143c52e14d..c656b54ee95 100644
--- a/src/lib/formats/sc3000_bit.cpp
+++ b/src/lib/formats/sc3000_bit.cpp
@@ -56,11 +56,11 @@ static cassette_image::error sc3000_bit_identify(cassette_image *cassette, struc
static cassette_image::error sc3000_bit_load(cassette_image *cassette)
{
cassette_image::error err;
- UINT64 image_size = cassette_image_size(cassette);
- UINT64 image_pos = 0;
+ uint64_t image_size = cassette_image_size(cassette);
+ uint64_t image_pos = 0;
double time_index = 0.0;
double time_displacement;
- UINT8 data;
+ uint8_t data;
while (image_pos < image_size)
{
diff --git a/src/lib/formats/sol_cas.cpp b/src/lib/formats/sol_cas.cpp
index d42c8d45101..ac668535b51 100644
--- a/src/lib/formats/sol_cas.cpp
+++ b/src/lib/formats/sol_cas.cpp
@@ -44,13 +44,13 @@ SVT - The full explanation may be found on the Solace web site,
#define SOL20_WAV_FREQUENCY 4800
// image size
-static UINT32 sol20_image_size;
+static uint32_t sol20_image_size;
static bool level;
-static UINT8 sol20_cksm_byte;
-static UINT32 sol20_byte_num;
-static UINT8 sol20_header[16];
+static uint8_t sol20_cksm_byte;
+static uint32_t sol20_byte_num;
+static uint8_t sol20_header[16];
-static int sol20_put_samples(INT16 *buffer, int sample_pos, int count)
+static int sol20_put_samples(int16_t *buffer, int sample_pos, int count)
{
if (buffer)
{
@@ -63,7 +63,7 @@ static int sol20_put_samples(INT16 *buffer, int sample_pos, int count)
return count;
}
-static int sol20_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int sol20_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -80,10 +80,10 @@ static int sol20_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int sol20_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int sol20_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* start */
samples += sol20_output_bit (buffer, sample_pos + samples, 0);
@@ -100,7 +100,7 @@ static int sol20_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
}
// Calculate checksum
-static UINT8 sol20_calc_cksm(UINT8 cksm, UINT8 data)
+static uint8_t sol20_calc_cksm(uint8_t cksm, uint8_t data)
{
data -= cksm;
cksm = data;
@@ -111,7 +111,7 @@ static UINT8 sol20_calc_cksm(UINT8 cksm, UINT8 data)
}
// Ignore remainder of line
-static void sol20_scan_to_eol(const UINT8 *bytes)
+static void sol20_scan_to_eol(const uint8_t *bytes)
{
bool t = 1;
while (t)
@@ -130,7 +130,7 @@ static void sol20_scan_to_eol(const UINT8 *bytes)
}
// skip spaces and symbols looking for a hex digit
-static void sol20_scan_to_hex(const UINT8 *bytes)
+static void sol20_scan_to_hex(const uint8_t *bytes)
{
bool t = 1;
while (t)
@@ -142,7 +142,7 @@ static void sol20_scan_to_hex(const UINT8 *bytes)
}
else
{
- UINT8 chr = bytes[sol20_byte_num];
+ uint8_t chr = bytes[sol20_byte_num];
if (chr == 0x0d)
t = 0;
else
@@ -155,10 +155,10 @@ static void sol20_scan_to_hex(const UINT8 *bytes)
}
// Turn n digits into hex
-static int sol20_read_hex(const UINT8 *bytes, UINT8 numdigits)
+static int sol20_read_hex(const uint8_t *bytes, uint8_t numdigits)
{
int data = 0;
- UINT8 i,chr;
+ uint8_t i,chr;
for (i = 0; i < numdigits; i++)
{
@@ -181,7 +181,7 @@ static int sol20_read_hex(const UINT8 *bytes, UINT8 numdigits)
}
// Turn digits into decimal
-static int sol20_read_dec(const UINT8 *bytes)
+static int sol20_read_dec(const uint8_t *bytes)
{
int data = 0;
@@ -194,14 +194,14 @@ static int sol20_read_dec(const UINT8 *bytes)
return data;
}
-static int sol20_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int sol20_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 i = 0,t = 0;
- UINT16 cc = 0;
+ uint32_t sample_count = 0;
+ uint32_t i = 0,t = 0;
+ uint16_t cc = 0;
sol20_byte_num = 1;
bool process_d = 0;
- UINT16 length = 0;
+ uint16_t length = 0;
// 1st line of file must say SVT
if ((bytes[0] == 'S') && (bytes[1] == 'V') && (bytes[2] == 'T'))
@@ -216,7 +216,7 @@ static int sol20_handle_cassette(INT16 *buffer, const UINT8 *bytes)
while (sol20_byte_num)
{
sol20_byte_num+=2; // bump to start of next line
- UINT8 chr = bytes[sol20_byte_num]; // Get command
+ uint8_t chr = bytes[sol20_byte_num]; // Get command
if (sol20_byte_num >= sol20_image_size)
sol20_byte_num = 0;
else
@@ -340,7 +340,7 @@ static int sol20_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int sol20_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int sol20_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return sol20_handle_cassette(buffer, bytes);
}
@@ -349,7 +349,7 @@ static int sol20_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int sol20_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int sol20_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
sol20_image_size = length;
diff --git a/src/lib/formats/sorc_cas.cpp b/src/lib/formats/sorc_cas.cpp
index da31aaa6e49..10fb26197f1 100644
--- a/src/lib/formats/sorc_cas.cpp
+++ b/src/lib/formats/sorc_cas.cpp
@@ -38,7 +38,7 @@ header and leader bytes.
static int sorcerer_image_size;
static bool level;
-static int sorcerer_put_samples(INT16 *buffer, int sample_pos, int count)
+static int sorcerer_put_samples(int16_t *buffer, int sample_pos, int count)
{
if (buffer)
{
@@ -51,7 +51,7 @@ static int sorcerer_put_samples(INT16 *buffer, int sample_pos, int count)
return count;
}
-static int sorcerer_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int sorcerer_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -68,10 +68,10 @@ static int sorcerer_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int sorcerer_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int sorcerer_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
- UINT8 i;
+ uint8_t i;
/* start */
samples += sorcerer_output_bit (buffer, sample_pos + samples, 0);
@@ -87,10 +87,10 @@ static int sorcerer_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int sorcerer_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int sorcerer_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
- UINT32 i;
+ uint32_t sample_count = 0;
+ uint32_t i;
/* idle */
for (i=0; i<2000; i++)
@@ -108,7 +108,7 @@ static int sorcerer_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int sorcerer_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int sorcerer_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return sorcerer_handle_cassette(buffer, bytes);
}
@@ -117,7 +117,7 @@ static int sorcerer_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int sorcerer_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int sorcerer_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
sorcerer_image_size = length;
diff --git a/src/lib/formats/sorc_dsk.cpp b/src/lib/formats/sorc_dsk.cpp
index 27dc4270f05..ef99fd7ec11 100644
--- a/src/lib/formats/sorc_dsk.cpp
+++ b/src/lib/formats/sorc_dsk.cpp
@@ -30,14 +30,14 @@ static int sorc_get_tracks_per_disk(floppy_image_legacy *floppy)
return 77;
}
-static UINT64 sorc_translate_offset(floppy_image_legacy *floppy, int track, int head, int sector)
+static uint64_t sorc_translate_offset(floppy_image_legacy *floppy, int track, int head, int sector)
{
return 270*(16*track+sector);
}
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
- UINT64 offs;
+ uint64_t offs;
/* translate the sector to a raw sector */
if (!sector_is_index)
{
@@ -57,7 +57,7 @@ static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, in
static floperr_t internal_sorc_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
if (err)
@@ -71,7 +71,7 @@ static floperr_t internal_sorc_read_sector(floppy_image_legacy *floppy, int head
static floperr_t internal_sorc_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
@@ -104,7 +104,7 @@ static floperr_t sorc_write_indexed_sector(floppy_image_legacy *floppy, int head
return internal_sorc_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam);
}
-static floperr_t sorc_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t sorc_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
@@ -119,7 +119,7 @@ static floperr_t sorc_get_sector_length(floppy_image_legacy *floppy, int head, i
-static floperr_t sorc_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t sorc_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
sector_index += 1;
if (cylinder)
diff --git a/src/lib/formats/sord_cas.cpp b/src/lib/formats/sord_cas.cpp
index f535216e18e..bc11c388915 100644
--- a/src/lib/formats/sord_cas.cpp
+++ b/src/lib/formats/sord_cas.cpp
@@ -16,7 +16,7 @@
#define SORDM5_WAVESAMPLES_TRAILER 1
#define SORDM5_WAVESAMPLES_BLOCK 1
-static const UINT8 SORDM5_CAS_HEADER[6] = { 'S', 'O', 'R', 'D', 'M', '5'};
+static const uint8_t SORDM5_CAS_HEADER[6] = { 'S', 'O', 'R', 'D', 'M', '5'};
static const struct CassetteModulation sordm5_cas_modulation =
{
@@ -25,9 +25,9 @@ static const struct CassetteModulation sordm5_cas_modulation =
3150.0 - 600, 3150.0, 3150.0 + 600
};
-static UINT8 cassette_image_read_uint8( cassette_image *cassette, UINT64 offset)
+static uint8_t cassette_image_read_uint8( cassette_image *cassette, uint64_t offset)
{
- UINT8 data;
+ uint8_t data;
cassette_image_read( cassette, &data, offset, 1);
return data;
}
@@ -40,13 +40,13 @@ static cassette_image::error sordm5_tap_identify( cassette_image *cassette, stru
static cassette_image::error sordm5_tap_load( cassette_image *cassette)
{
cassette_image::error err;
- UINT64 image_size;
+ uint64_t image_size;
double time_index = 0.0;
double time_displacement;
- UINT8 header[16];
- UINT64 image_pos;
- UINT8 block_type, byte, bit;
- UINT32 block_size, i, j;
+ uint8_t header[16];
+ uint64_t image_pos;
+ uint8_t block_type, byte, bit;
+ uint32_t block_size, i, j;
size_t filler_length;
// init
image_size = cassette_image_size(cassette);
diff --git a/src/lib/formats/spc1000_cas.cpp b/src/lib/formats/spc1000_cas.cpp
index 6d3a2af52fb..d13021b0047 100644
--- a/src/lib/formats/spc1000_cas.cpp
+++ b/src/lib/formats/spc1000_cas.cpp
@@ -33,7 +33,7 @@ IPL: This seems a quickload format containing RAM dump, not a real tape
// image size
static int spc1000_image_size;
-static int spc1000_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int spc1000_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -44,7 +44,7 @@ static int spc1000_put_samples(INT16 *buffer, int sample_pos, int count, int lev
return count;
}
-static int spc1000_output_bit(INT16 *buffer, int sample_pos, bool bit)
+static int spc1000_output_bit(int16_t *buffer, int sample_pos, bool bit)
{
int samples = 0;
@@ -62,23 +62,23 @@ static int spc1000_output_bit(INT16 *buffer, int sample_pos, bool bit)
return samples;
}
-static int spc1000_handle_tap(INT16 *buffer, const UINT8 *bytes)
+static int spc1000_handle_tap(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
+ uint32_t sample_count = 0;
/* data */
- for (UINT32 i = 0; i < spc1000_image_size; i++)
+ for (uint32_t i = 0; i < spc1000_image_size; i++)
sample_count += spc1000_output_bit(buffer, sample_count, bytes[i] & 1);
return sample_count;
}
-static int spc1000_handle_cas(INT16 *buffer, const UINT8 *bytes)
+static int spc1000_handle_cas(int16_t *buffer, const uint8_t *bytes)
{
- UINT32 sample_count = 0;
+ uint32_t sample_count = 0;
/* data (skipping first 16 bytes, which is CAS header) */
- for (UINT32 i = 0x10; i < spc1000_image_size; i++)
+ for (uint32_t i = 0x10; i < spc1000_image_size; i++)
for (int j = 0; j < 8; j++)
sample_count += spc1000_output_bit(buffer, sample_count, (bytes[i] >> (7 - j)) & 1);
@@ -90,12 +90,12 @@ static int spc1000_handle_cas(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int spc1000_tap_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int spc1000_tap_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return spc1000_handle_tap(buffer, bytes);
}
-static int spc1000_cas_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int spc1000_cas_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return spc1000_handle_cas(buffer, bytes);
}
@@ -104,14 +104,14 @@ static int spc1000_cas_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int spc1000_tap_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int spc1000_tap_calculate_size_in_samples(const uint8_t *bytes, int length)
{
spc1000_image_size = length;
return spc1000_handle_tap(nullptr, bytes);
}
-static int spc1000_cas_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int spc1000_cas_calculate_size_in_samples(const uint8_t *bytes, int length)
{
spc1000_image_size = length;
diff --git a/src/lib/formats/st_dsk.cpp b/src/lib/formats/st_dsk.cpp
index a30165993ea..9808dc56ff9 100644
--- a/src/lib/formats/st_dsk.cpp
+++ b/src/lib/formats/st_dsk.cpp
@@ -36,20 +36,20 @@ bool st_format::supports_save() const
return true;
}
-void st_format::find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count)
+void st_format::find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(track_count=80; track_count <= 82; track_count++)
for(head_count=1; head_count <= 2; head_count++)
for(sector_count=9; sector_count <= 11; sector_count++)
- if(size == (UINT32)512*track_count*head_count*sector_count)
+ if(size == (uint32_t)512*track_count*head_count*sector_count)
return;
track_count = head_count = sector_count = 0;
}
-int st_format::identify(io_generic *io, UINT32 form_factor)
+int st_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
if(track_count)
@@ -57,12 +57,12 @@ int st_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool st_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool st_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 track_count, head_count, sector_count;
+ uint8_t track_count, head_count, sector_count;
find_size(io, track_count, head_count, sector_count);
- UINT8 sectdata[11*512];
+ uint8_t sectdata[11*512];
desc_s sectors[11];
for(int i=0; i<sector_count; i++) {
sectors[i].data = sectdata + 512*i;
@@ -103,7 +103,7 @@ bool st_format::save(io_generic *io, floppy_image *image)
else if(sector_count < 9)
sector_count = 9;
- UINT8 sectdata[11*512];
+ uint8_t sectdata[11*512];
int track_size = sector_count*512;
for(int track=0; track < track_count; track++) {
@@ -141,9 +141,9 @@ bool msa_format::supports_save() const
return true;
}
-void msa_format::read_header(io_generic *io, UINT16 &sign, UINT16 &sect, UINT16 &head, UINT16 &strack, UINT16 &etrack)
+void msa_format::read_header(io_generic *io, uint16_t &sign, uint16_t &sect, uint16_t &head, uint16_t &strack, uint16_t &etrack)
{
- UINT8 h[10];
+ uint8_t h[10];
io_generic_read(io, h, 0, 10);
sign = (h[0] << 8) | h[1];
sect = (h[2] << 8) | h[3];
@@ -152,9 +152,9 @@ void msa_format::read_header(io_generic *io, UINT16 &sign, UINT16 &sect, UINT16
etrack = (h[8] << 8) | h[9];
}
-bool msa_format::uncompress(UINT8 *buffer, int csize, int usize)
+bool msa_format::uncompress(uint8_t *buffer, int csize, int usize)
{
- UINT8 sectdata[11*512];
+ uint8_t sectdata[11*512];
int src=0, dst=0;
while(src<csize && dst<usize) {
unsigned char c = buffer[src++];
@@ -178,7 +178,7 @@ bool msa_format::uncompress(UINT8 *buffer, int csize, int usize)
return true;
}
-bool msa_format::compress(const UINT8 *buffer, int usize, UINT8 *dest, int &csize)
+bool msa_format::compress(const uint8_t *buffer, int usize, uint8_t *dest, int &csize)
{
int src=0, dst=0;
while(src<usize && dst<usize) {
@@ -206,9 +206,9 @@ bool msa_format::compress(const UINT8 *buffer, int usize, UINT8 *dest, int &csiz
return dst < usize;
}
-int msa_format::identify(io_generic *io, UINT32 form_factor)
+int msa_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT16 sign, sect, head, strack, etrack;
+ uint16_t sign, sect, head, strack, etrack;
read_header(io, sign, sect, head, strack, etrack);
if(sign == 0x0e0f &&
@@ -220,12 +220,12 @@ int msa_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool msa_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool msa_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT16 sign, sect, heads, strack, etrack;
+ uint16_t sign, sect, heads, strack, etrack;
read_header(io, sign, sect, heads, strack, etrack);
- UINT8 sectdata[11*512];
+ uint8_t sectdata[11*512];
desc_s sectors[11];
for(int i=0; i<sect; i++) {
sectors[i].data = sectdata + 512*1;
@@ -238,7 +238,7 @@ bool msa_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for(int track=strack; track <= etrack; track++) {
for(int head=0; head <= heads; head++) {
- UINT8 th[2];
+ uint8_t th[2];
io_generic_read(io, th, pos, 2);
pos += 2;
int tsize = (th[0] << 8) | th[1];
@@ -277,7 +277,7 @@ bool msa_format::save(io_generic *io, floppy_image *image)
else if(sector_count < 9)
sector_count = 9;
- UINT8 header[10];
+ uint8_t header[10];
header[0] = 0x0e;
header[1] = 0x0f;
header[2] = 0;
@@ -293,8 +293,8 @@ bool msa_format::save(io_generic *io, floppy_image *image)
int pos = 10;
- UINT8 sectdata[11*512];
- UINT8 compdata[11*512];
+ uint8_t sectdata[11*512];
+ uint8_t compdata[11*512];
int track_size = sector_count*512;
for(int track=0; track < track_count; track++) {
@@ -302,14 +302,14 @@ bool msa_format::save(io_generic *io, floppy_image *image)
get_track_data_mfm_pc(track, head, image, 2000, 512, sector_count, sectdata);
int csize;
if(compress(sectdata, track_size, compdata, csize)) {
- UINT8 th[2];
+ uint8_t th[2];
th[0] = csize >> 8;
th[1] = csize;
io_generic_write(io, th, pos, 2);
io_generic_write(io, compdata, pos+2, csize);
pos += 2+csize;
} else {
- UINT8 th[2];
+ uint8_t th[2];
th[0] = track_size >> 8;
th[1] = track_size;
io_generic_write(io, th, pos, 2);
diff --git a/src/lib/formats/st_dsk.h b/src/lib/formats/st_dsk.h
index 242d7e9cf5b..9245e861eae 100644
--- a/src/lib/formats/st_dsk.h
+++ b/src/lib/formats/st_dsk.h
@@ -18,8 +18,8 @@ class st_format : public floppy_image_format_t
public:
st_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
@@ -28,7 +28,7 @@ public:
virtual bool supports_save() const override;
private:
- void find_size(io_generic *io, UINT8 &track_count, UINT8 &head_count, UINT8 &sector_count);
+ void find_size(io_generic *io, uint8_t &track_count, uint8_t &head_count, uint8_t &sector_count);
};
class msa_format : public floppy_image_format_t
@@ -36,8 +36,8 @@ class msa_format : public floppy_image_format_t
public:
msa_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
@@ -46,9 +46,9 @@ public:
virtual bool supports_save() const override;
private:
- bool uncompress(UINT8 *buffer, int csize, int usize);
- bool compress(const UINT8 *src, int usize, UINT8 *dest, int &csize);
- void read_header(io_generic *io, UINT16 &sign, UINT16 &sect, UINT16 &head, UINT16 &strack, UINT16 &etrack);
+ bool uncompress(uint8_t *buffer, int csize, int usize);
+ bool compress(const uint8_t *src, int usize, uint8_t *dest, int &csize);
+ void read_header(io_generic *io, uint16_t &sign, uint16_t &sect, uint16_t &head, uint16_t &strack, uint16_t &etrack);
};
extern const floppy_format_type FLOPPY_ST_FORMAT;
diff --git a/src/lib/formats/svi_cas.cpp b/src/lib/formats/svi_cas.cpp
index 4030fedc051..c681c36d9dd 100644
--- a/src/lib/formats/svi_cas.cpp
+++ b/src/lib/formats/svi_cas.cpp
@@ -10,7 +10,7 @@
#define CAS_EMPTY_SAMPLES (24220)
#define CAS_INIT_SAMPLES (200)
-static const UINT8 CasHeader[17] =
+static const uint8_t CasHeader[17] =
{
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x7f
@@ -24,7 +24,7 @@ static int cas_size;
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int svi_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int svi_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
int cas_pos, samples_pos, n, i;
@@ -112,7 +112,7 @@ static int svi_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int svi_cas_to_wav_size(const UINT8 *casdata, int caslen)
+static int svi_cas_to_wav_size(const uint8_t *casdata, int caslen)
{
int cas_pos, samples_pos, size, i;
diff --git a/src/lib/formats/svi_dsk.cpp b/src/lib/formats/svi_dsk.cpp
index aaa6a45e709..aae08ba329d 100644
--- a/src/lib/formats/svi_dsk.cpp
+++ b/src/lib/formats/svi_dsk.cpp
@@ -29,9 +29,9 @@ const char *svi_format::extensions() const
return "dsk";
}
-int svi_format::identify(io_generic *io, UINT32 form_factor)
+int svi_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
if (size == 172032 || size == 346112)
return 50;
@@ -39,9 +39,9 @@ int svi_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool svi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool svi_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
int head_count;
switch (size)
@@ -61,7 +61,7 @@ bool svi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
int sector_size = (track == 0 && head == 0) ? 128 : 256;
desc_pc_sector sectors[20];
- UINT8 sector_data[5000];
+ uint8_t sector_data[5000];
int sector_offset = 0;
for (int i = 0; i < sector_count; i++)
@@ -93,11 +93,11 @@ bool svi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
bool svi_format::save(io_generic *io, floppy_image *image)
{
- UINT8 bitstream[500000/8];
- UINT8 sector_data[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sector_data[50000];
desc_xs sectors[256];
int track_size;
- UINT64 file_offset = 0;
+ uint64_t file_offset = 0;
int track_count, head_count;
image->get_actual_geometry(track_count, head_count);
diff --git a/src/lib/formats/svi_dsk.h b/src/lib/formats/svi_dsk.h
index 9ae933572df..f7ffbfeaf5c 100644
--- a/src/lib/formats/svi_dsk.h
+++ b/src/lib/formats/svi_dsk.h
@@ -24,8 +24,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 bool supports_save() const override;
};
diff --git a/src/lib/formats/td0_dsk.cpp b/src/lib/formats/td0_dsk.cpp
index 51fa59488a6..375cf3cdb42 100644
--- a/src/lib/formats/td0_dsk.cpp
+++ b/src/lib/formats/td0_dsk.cpp
@@ -44,51 +44,51 @@ struct td0dsk_tag
int heads;
int tracks;
int sector_size;
- UINT64 track_offsets[84*2]; /* offset within data for each track */
- UINT8 *data;
+ uint64_t track_offsets[84*2]; /* offset within data for each track */
+ uint8_t *data;
};
struct tdlzhuf {
- UINT16 r,
+ uint16_t r,
bufcnt,bufndx,bufpos, // string buffer
// the following to allow block reads from input in next_word()
ibufcnt,ibufndx; // input buffer counters
- UINT8 inbuf[BUFSZ]; // input buffer
+ uint8_t inbuf[BUFSZ]; // input buffer
};
struct td0dsk_t
{
io_generic *floppy_file;
- UINT64 floppy_file_offset;
+ uint64_t floppy_file_offset;
struct tdlzhuf tdctl;
- UINT8 text_buf[N + F - 1];
- UINT16 freq[T + 1]; /* cumulative freq table */
+ uint8_t text_buf[N + F - 1];
+ uint16_t freq[T + 1]; /* cumulative freq table */
/*
* pointing parent nodes.
* area [T..(T + N_CHAR - 1)] are pointers for leaves
*/
- INT16 prnt[T + N_CHAR];
+ int16_t prnt[T + N_CHAR];
/* pointing children nodes (son[], son[] + 1)*/
- INT16 son[T];
+ int16_t son[T];
- UINT16 getbuf;
- UINT8 getlen;
+ uint16_t getbuf;
+ uint8_t getlen;
- int data_read(UINT8 *buf, UINT16 size);
+ int data_read(uint8_t *buf, uint16_t size);
int next_word();
int GetBit();
int GetByte();
void StartHuff();
void reconst();
void update(int c);
- INT16 DecodeChar();
- INT16 DecodePosition();
+ int16_t DecodeChar();
+ int16_t DecodePosition();
void init_Decode();
- int Decode(UINT8 *buf, int len);
+ int Decode(uint8_t *buf, int len);
};
//static td0dsk_t td0dsk;
@@ -103,10 +103,10 @@ struct floppy_image_legacy
/* loaded track stuff */
int loaded_track_head;
int loaded_track_index;
- UINT32 loaded_track_size;
+ uint32_t loaded_track_size;
void *loaded_track_data;
- UINT8 loaded_track_status;
- UINT8 flags;
+ uint8_t loaded_track_status;
+ uint8_t flags;
/* tagging system */
object_pool *tags;
@@ -125,7 +125,7 @@ static struct td0dsk_tag *get_tag(floppy_image_legacy *floppy)
FLOPPY_IDENTIFY( td0_dsk_identify )
{
- UINT8 header[2];
+ uint8_t header[2];
floppy_image_read(floppy, header, 0, 2);
if (header[0]=='T' && header[1]=='D') {
@@ -148,16 +148,16 @@ static int td0_get_tracks_per_disk(floppy_image_legacy *floppy)
return get_tag(floppy)->tracks;
}
-static UINT64 td0_get_track_offset(floppy_image_legacy *floppy, int head, int track)
+static uint64_t td0_get_track_offset(floppy_image_legacy *floppy, int head, int track)
{
return get_tag(floppy)->track_offsets[(track<<1) + head];
}
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
- UINT64 offs;
- UINT8 *header;
- UINT8 sectors_per_track;
+ uint64_t offs;
+ uint8_t *header;
+ uint8_t sectors_per_track;
int i;
if ((head < 0) || (head >= get_tag(floppy)->heads) || (track < 0) || (track >= get_tag(floppy)->tracks)
@@ -202,16 +202,16 @@ static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, in
static floperr_t internal_td0_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
- UINT8 *header;
+ uint8_t *header;
int size,realsize,i;
int buff_pos;
int data_pos;
- UINT8 *data;
- UINT8 *buf;
+ uint8_t *data;
+ uint8_t *buf;
- buf = (UINT8*)buffer;
+ buf = (uint8_t*)buffer;
// take sector offset
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
if (err)
@@ -295,7 +295,7 @@ static floperr_t td0_read_indexed_sector(floppy_image_legacy *floppy, int head,
return internal_td0_read_sector(floppy, head, track, sector, TRUE, buffer, buflen);
}
-static floperr_t td0_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t td0_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
@@ -308,11 +308,11 @@ static floperr_t td0_get_sector_length(floppy_image_legacy *floppy, int head, in
return FLOPPY_ERROR_SUCCESS;
}
-static floperr_t td0_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t td0_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
floperr_t retVal;
- UINT64 offset = 0;
- UINT8 *sector_info;
+ uint64_t offset = 0;
+ uint8_t *sector_info;
retVal = get_offset(floppy, head, track, sector_index, FALSE, &offset);
sector_info = get_tag(floppy)->data + offset;
@@ -334,9 +334,9 @@ static floperr_t td0_get_indexed_sector_info(floppy_image_legacy *floppy, int he
return retVal;
}
-int td0dsk_t::data_read(UINT8 *buf, UINT16 size)
+int td0dsk_t::data_read(uint8_t *buf, uint16_t size)
{
- UINT64 image_size = io_generic_size(floppy_file);
+ uint64_t image_size = io_generic_size(floppy_file);
if (size > image_size - floppy_file_offset) {
size = image_size - floppy_file_offset;
}
@@ -352,7 +352,7 @@ int td0dsk_t::data_read(UINT8 *buf, UINT16 size)
*/
/* decoder table */
-static const UINT8 d_code[256] = {
+static const uint8_t d_code[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -387,7 +387,7 @@ static const UINT8 d_code[256] = {
0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
};
-static const UINT8 d_len[256] = {
+static const uint8_t d_len[256] = {
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
@@ -441,7 +441,7 @@ int td0dsk_t::next_word()
int td0dsk_t::GetBit() /* get one bit */
{
- INT16 i;
+ int16_t i;
if(next_word() < 0)
return(-1);
i = getbuf;
@@ -455,7 +455,7 @@ int td0dsk_t::GetBit() /* get one bit */
int td0dsk_t::GetByte() /* get a byte */
{
- UINT16 i;
+ uint16_t i;
if(next_word() != 0)
return(-1);
i = getbuf;
@@ -494,8 +494,8 @@ void td0dsk_t::StartHuff()
void td0dsk_t::reconst()
{
- INT16 i, j, k;
- UINT16 f, l;
+ int16_t i, j, k;
+ uint16_t f, l;
/* halven cumulative freq for leaf nodes */
j = 0;
@@ -572,10 +572,10 @@ void td0dsk_t::update(int c)
}
-INT16 td0dsk_t::DecodeChar()
+int16_t td0dsk_t::DecodeChar()
{
int ret;
- UINT16 c;
+ uint16_t c;
c = son[R];
@@ -595,16 +595,16 @@ INT16 td0dsk_t::DecodeChar()
return c;
}
-INT16 td0dsk_t::DecodePosition()
+int16_t td0dsk_t::DecodePosition()
{
- INT16 bit;
- UINT16 i, j, c;
+ int16_t bit;
+ uint16_t i, j, c;
/* decode upper 6 bits from given table */
if((bit=GetByte()) < 0)
return(-1);
- i = (UINT16) bit;
- c = (UINT16)d_code[i] << 6;
+ i = (uint16_t) bit;
+ c = (uint16_t)d_code[i] << 6;
j = d_len[i];
/* input lower 6 bits directly */
@@ -637,9 +637,9 @@ void td0dsk_t::init_Decode()
}
-int td0dsk_t::Decode(UINT8 *buf, int len) /* Decoding/Uncompressing */
+int td0dsk_t::Decode(uint8_t *buf, int len) /* Decoding/Uncompressing */
{
- INT16 c,pos;
+ int16_t c,pos;
int count; // was an unsigned long, seems unnecessary
for (count = 0; count < len; ) {
if(tdctl.bufcnt == 0) {
@@ -682,7 +682,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct )
td0dsk_t state;
struct FloppyCallbacks *callbacks;
struct td0dsk_tag *tag;
- UINT8 *header;
+ uint8_t *header;
int number_of_sectors;
int position;
int i;
@@ -698,7 +698,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct )
if (!tag)
return FLOPPY_ERROR_OUTOFMEMORY;
- tag->data = (UINT8*)malloc(floppy_image_size(floppy));
+ tag->data = (uint8_t*)malloc(floppy_image_size(floppy));
if (tag->data==nullptr) {
return FLOPPY_ERROR_OUTOFMEMORY;
}
@@ -706,7 +706,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct )
header = tag->data;
if (header[0]=='t') {
- UINT8 obuf[BUFSZ];
+ uint8_t obuf[BUFSZ];
int rd;
int off = 12;
int size = 0;
@@ -719,7 +719,7 @@ FLOPPY_CONSTRUCT( td0_dsk_construct )
} while(rd == BUFSZ);
memcpy(obuf,tag->data,12);
free(tag->data);
- tag->data = (UINT8*)malloc(size+12);
+ tag->data = (uint8_t*)malloc(size+12);
if (tag->data==nullptr) {
return FLOPPY_ERROR_OUTOFMEMORY;
}
@@ -819,9 +819,9 @@ const char *td0_format::extensions() const
return "td0";
}
-int td0_format::identify(io_generic *io, UINT32 form_factor)
+int td0_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 h[7];
+ uint8_t h[7];
io_generic_read(io, h, 0, 7);
if(((h[0] == 'T') && (h[1] == 'D')) || ((h[0] == 't') && (h[1] == 'd')))
@@ -831,15 +831,15 @@ int td0_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool td0_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int track_count = 0;
int head_count = 0;
int track_spt;
int offset = 0;
const int max_size = 4*1024*1024; // 4MB ought to be large enough for any floppy
- std::vector<UINT8> imagebuf(max_size);
- UINT8 header[12];
+ std::vector<uint8_t> imagebuf(max_size);
+ uint8_t header[12];
io_generic_read(io, header, 0, 12);
head_count = header[9];
@@ -917,7 +917,7 @@ bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
while(track_spt != 255)
{
desc_pc_sector sects[256];
- UINT8 sect_data[65536];
+ uint8_t sect_data[65536];
int sdatapos = 0;
int track = imagebuf[offset + 1];
int head = imagebuf[offset + 2] & 1;
@@ -925,8 +925,8 @@ bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
offset += 4;
for(int i = 0; i < track_spt; i++)
{
- UINT8 *hs = &imagebuf[offset];
- UINT16 size;
+ uint8_t *hs = &imagebuf[offset];
+ uint16_t size;
offset += 6;
sects[i].track = hs[0];
@@ -967,8 +967,8 @@ bool td0_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
k = 0;
while(k < size)
{
- UINT16 len = imagebuf[offset];
- UINT16 rep = imagebuf[offset + 1];
+ uint16_t len = imagebuf[offset];
+ uint16_t rep = imagebuf[offset + 1];
offset += 2;
if(!len)
{
diff --git a/src/lib/formats/td0_dsk.h b/src/lib/formats/td0_dsk.h
index eae873e30e0..2207b993c21 100644
--- a/src/lib/formats/td0_dsk.h
+++ b/src/lib/formats/td0_dsk.h
@@ -11,8 +11,8 @@ class td0_format : public floppy_image_format_t
public:
td0_format();
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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;
diff --git a/src/lib/formats/thom_cas.cpp b/src/lib/formats/thom_cas.cpp
index c6ab5a2d004..45f89ac2a29 100644
--- a/src/lib/formats/thom_cas.cpp
+++ b/src/lib/formats/thom_cas.cpp
@@ -46,8 +46,8 @@
#define TO7_PERIOD_CASS_0 ( 1. / TO7_FREQ_CASS_0 )
#define TO7_PERIOD_CASS_1 ( 1. / TO7_FREQ_CASS_1 )
-static UINT32 to7_k7_bitsize;
-static UINT8* to7_k7_bits;
+static uint32_t to7_k7_bitsize;
+static uint8_t* to7_k7_bits;
#define MO5_BIT_LENGTH 0.000833
#define MO5_HBIT_LENGTH (MO5_BIT_LENGTH / 2.)
@@ -106,12 +106,12 @@ static cassette_image::error to7_k7_identify ( cassette_image *cass, struct Cass
static cassette_image::error to7_k7_load( cassette_image *cass )
{
#if ! K7_SPEED_HACK
- static const INT8 square_wave[] = { -128, 127 };
+ static const int8_t square_wave[] = { -128, 127 };
double time = 0.;
#endif
size_t size = cassette_image_size( cass ), pos = 0;
int i, sz, sz2, bitmax = 1024, invalid = 0;
- UINT8 in, typ, block[264];
+ uint8_t in, typ, block[264];
LOG (( "to7_k7_load: start conversion, size=%li\n", (long)size ));
PRINT (( "to7_k7_load: open cassette, length: %li bytes\n", (long) size ));
@@ -123,7 +123,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass )
}
to7_k7_bitsize = 0;
- to7_k7_bits = (UINT8*)malloc(bitmax );
+ to7_k7_bits = (uint8_t*)malloc(bitmax );
/* store one period */
#if K7_SPEED_HACK
@@ -158,7 +158,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass )
} \
if ( to7_k7_bitsize + 1 >= bitmax ) \
{ \
- UINT8* a = (UINT8*)malloc(bitmax * 2); \
+ uint8_t* a = (uint8_t*)malloc(bitmax * 2); \
memcpy ( a, to7_k7_bits, bitmax ); \
bitmax *= 2; \
to7_k7_bits = a; \
@@ -170,7 +170,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass )
#define K7_PUT_BYTE( BYTE ) \
do \
{ \
- UINT8 x; \
+ uint8_t x; \
K7_PUT_BIT( 0 ); \
for ( x = 0; x < 8; x++ ) \
K7_PUT_BIT( ( (BYTE) >> x ) & 1 ); \
@@ -290,8 +290,8 @@ static cassette_image::error to7_k7_load( cassette_image *cass )
if ( typ == 0 )
{
char name[] = "01234567.ABC";
- UINT8 t = block[15];
- UINT8 u = block[16];
+ uint8_t t = block[15];
+ uint8_t u = block[16];
int p = (to7_k7_bitsize - sz2 - 4 - sz) * TO7_BIT_LENGTH;
memcpy( name, block+4, 8 );
memcpy( name+9, block+12, 3 );
@@ -331,7 +331,7 @@ static cassette_image::error to7_k7_load( cassette_image *cass )
}
if ( invalid < 10 && sz > 4 && in == 0x01 && pos + 4 <= size )
{
- UINT8 in1,in2;
+ uint8_t in1,in2;
cassette_image_read( cass, &in1, pos+1, 1 );
cassette_image_read( cass, &in2, pos+2, 1 );
if ( (in1 == 0x3c) && ((in2 == 0x00) || (in2 == 0x01) ) )
@@ -466,7 +466,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass )
{
size_t size = cassette_image_size( cass ), pos = 0;
int i, sz, sz2, hbit = 0;
- UINT8 in, in2, in3, typ, block[264], sum;
+ uint8_t in, in2, in3, typ, block[264], sum;
int invalid = 0, hbitsize = 0, dcmoto = 0;
LOG (( "mo5_k5_load: start conversion, size=%li\n", (long)size ));
@@ -502,7 +502,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass )
#define K5_PUT_BYTE( BYTE ) \
do \
{ \
- UINT8 b = BYTE; \
+ uint8_t b = BYTE; \
int x; \
for ( x = 0; x < 8; x++ ) \
K5_PUT_BIT( (b >> (7 - x)) & 1 ); \
@@ -596,7 +596,7 @@ static cassette_image::error mo5_k5_load( cassette_image *cass )
}
cassette_image_read( cass, block, pos, 4 );
typ = block[2];
- sz2 = (UINT8) (block[3]-1);
+ sz2 = (uint8_t) (block[3]-1);
if ( block[0] != 0x3c || block[1] != 0x5a || ( typ != 0x00 && typ != 0x01 && typ != 0xff ) || pos+sz2 > size )
{
pos -= sz;
@@ -635,8 +635,8 @@ static cassette_image::error mo5_k5_load( cassette_image *cass )
if ( typ == 0 )
{
char name[] = "01234567.ABC";
- UINT8 t = block[15];
- UINT8 u = block[16];
+ uint8_t t = block[15];
+ uint8_t u = block[16];
int p = (hbitsize - sz2 - 4 - sz) * MO5_HBIT_LENGTH;
memcpy( name, block+4, 8 );
memcpy( name+9, block+12, 3 );
diff --git a/src/lib/formats/thom_dsk.cpp b/src/lib/formats/thom_dsk.cpp
index df4d66c84e3..6249d785705 100644
--- a/src/lib/formats/thom_dsk.cpp
+++ b/src/lib/formats/thom_dsk.cpp
@@ -23,7 +23,7 @@ static const char sap_header[] =
"(c) Alexandre PUKALL Avril 1998";
-static const UINT16 sap_crc[] =
+static const uint16_t sap_crc[] =
{
0x0000, 0x1081, 0x2102, 0x3183, 0x4204, 0x5285, 0x6306, 0x7387,
0x8408, 0x9489, 0xa50a, 0xb58b, 0xc60c, 0xd68d, 0xe70e, 0xf78f,
@@ -36,10 +36,10 @@ struct sap_dsk_tag
int sector_pos[80][16]; /* remember sector position in file */
};
-static UINT16 thom_sap_crc( UINT8* data, int size )
+static uint16_t thom_sap_crc( uint8_t* data, int size )
{
int i;
- UINT16 crc = 0xffff, crc2;
+ uint16_t crc = 0xffff, crc2;
for ( i = 0; i < size; i++ )
{
crc2 = ( crc >> 4 ) ^ sap_crc[ ( crc ^ data[i] ) & 15 ];
@@ -79,9 +79,9 @@ static int sap_get_tracks_per_disk(floppy_image_legacy *floppy)
}
-static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, UINT64 *offset)
+static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, uint64_t *offset)
{
- UINT64 offs;
+ uint64_t offs;
struct sap_dsk_tag *tag = get_tag(floppy);
/* translate the sector to a raw sector */
if (!sector_is_index)
@@ -106,16 +106,16 @@ static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, in
static floperr_t internal_sap_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, void *buffer, size_t buflen)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
int i;
- UINT8 *buf;
+ uint8_t *buf;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
if (err)
return err;
floppy_image_read(floppy, buffer, offset+4, buflen);
- buf = (UINT8*)buffer;
+ buf = (uint8_t*)buffer;
for (i=0;i<buflen;i++) {
buf[i] ^= sap_magic_num;
}
@@ -126,10 +126,10 @@ static floperr_t internal_sap_read_sector(floppy_image_legacy *floppy, int head,
static floperr_t internal_sap_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, int sector_is_index, const void *buffer, size_t buflen, int ddam)
{
- UINT64 offset;
+ uint64_t offset;
floperr_t err;
- UINT8 buf[256+6];
- UINT16 crc;
+ uint8_t buf[256+6];
+ uint16_t crc;
int i;
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
if (err)
@@ -138,7 +138,7 @@ static floperr_t internal_sap_write_sector(floppy_image_legacy *floppy, int head
/* buf = 4-byte header + sector + 2-byte CRC */
floppy_image_read(floppy, buf, offset, 4);
for (i=0;i<buflen;i++) {
- buf[i+4] = ((UINT8*)buffer)[i];
+ buf[i+4] = ((uint8_t*)buffer)[i];
}
crc = thom_sap_crc( buf, buflen+4 );
buf[buflen+4] = crc >> 8;
@@ -172,7 +172,7 @@ static floperr_t sap_write_indexed_sector(floppy_image_legacy *floppy, int head,
return internal_sap_write_sector(floppy, head, track, sector, TRUE, buffer, buflen, ddam);
}
-static floperr_t sap_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, UINT32 *sector_length)
+static floperr_t sap_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
{
floperr_t err;
err = get_offset(floppy, head, track, sector, FALSE, nullptr);
@@ -187,11 +187,11 @@ static floperr_t sap_get_sector_length(floppy_image_legacy *floppy, int head, in
-static floperr_t sap_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, UINT32 *sector_length, unsigned long *flags)
+static floperr_t sap_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
{
floperr_t err;
- UINT8 header[4];
- UINT64 offset = 0;
+ uint8_t header[4];
+ uint64_t offset = 0;
sector_index += 1;
err = get_offset(floppy, head, track, sector_index, FALSE, &offset);
@@ -214,7 +214,7 @@ static floperr_t sap_post_format(floppy_image_legacy *floppy, util::option_resol
{
int track,sector;
int pos;
- UINT8 buf[256], header[4];
+ uint8_t buf[256], header[4];
struct sap_dsk_tag *tag;
tag = (struct sap_dsk_tag *) floppy_create_tag(floppy, sizeof(struct sap_dsk_tag));
@@ -255,7 +255,7 @@ static FLOPPY_CONSTRUCT(sap_dsk_construct)
struct FloppyCallbacks *callbacks;
struct sap_dsk_tag *tag;
int j;
- UINT8 fmt;
+ uint8_t fmt;
tag = (struct sap_dsk_tag *) floppy_create_tag(floppy, sizeof(struct sap_dsk_tag));
if (!tag)
return FLOPPY_ERROR_OUTOFMEMORY;
@@ -271,9 +271,9 @@ static FLOPPY_CONSTRUCT(sap_dsk_construct)
tag->sector_pos[i][j] = 0;
/* count tracks & fill sector offset table */
- for ( UINT64 i = 0x42; i+4 < floppy_image_size(floppy); i += tag->sector_size + 6 ) // CRC 2 bytes + 4 bytes sector header
+ for ( uint64_t i = 0x42; i+4 < floppy_image_size(floppy); i += tag->sector_size + 6 ) // CRC 2 bytes + 4 bytes sector header
{
- UINT8 sector, track;
+ uint8_t sector, track;
floppy_image_read(floppy, &track, i+2, 1);
floppy_image_read(floppy, &sector, i+3, 1);
if ( track >= 80 || sector < 1 || sector > 16 ) continue;
diff --git a/src/lib/formats/ti99_dsk.cpp b/src/lib/formats/ti99_dsk.cpp
index 0d03cf4fce0..ce8def17289 100644
--- a/src/lib/formats/ti99_dsk.cpp
+++ b/src/lib/formats/ti99_dsk.cpp
@@ -58,7 +58,7 @@
As said above, let's not spend too much effort allowing format deviations.
If the image does not exactly adhere to the format, give up.
*/
-bool ti99_floppy_format::check_for_address_marks(UINT8* trackdata, int encoding)
+bool ti99_floppy_format::check_for_address_marks(uint8_t* trackdata, int encoding)
{
int i=0;
@@ -94,7 +94,7 @@ int ti99_floppy_format::get_encoding(int cell_size)
/*
Load the image from disk and convert it into a sequence of flux levels.
*/
-bool ti99_floppy_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool ti99_floppy_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int cell_size = 0;
int sector_count = 0;
@@ -105,7 +105,7 @@ bool ti99_floppy_format::load(io_generic *io, UINT32 form_factor, floppy_image *
if (cell_size == 0) return false;
// Be ready to hold a track of up to 36 sectors (with gaps and marks)
- UINT8 trackdata[13000];
+ uint8_t trackdata[13000];
int maxtrack, maxheads;
image->get_maximal_geometry(maxtrack, maxheads);
@@ -188,8 +188,8 @@ bool ti99_floppy_format::save(io_generic *io, floppy_image *image)
{
int act_track_size = 0;
- UINT8 bitstream[500000/8];
- UINT8 trackdata[9216]; // max size
+ uint8_t bitstream[500000/8];
+ uint8_t trackdata[9216]; // max size
int cellsizes[] = { 2000, 4000, 1000, 2000 };
@@ -299,10 +299,10 @@ bool ti99_floppy_format::save(io_generic *io, floppy_image *image)
return true;
}
-void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, UINT8* trackdata, floppy_image *image)
+void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, uint8_t* trackdata, floppy_image *image)
{
int track_size_cells = 200000000/cell_size;
- std::vector<UINT32> buffer;
+ std::vector<uint32_t> buffer;
// The TDF has a long track lead-out that makes the track length sum up
// to 3253; this is too long for the number of cells in the real track.
@@ -399,10 +399,10 @@ void ti99_floppy_format::generate_track_fm(int track, int head, int cell_size, U
generate_track_from_levels(track, head, buffer, 0, image);
}
-void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size, UINT8* trackdata, floppy_image *image)
+void ti99_floppy_format::generate_track_mfm(int track, int head, int cell_size, uint8_t* trackdata, floppy_image *image)
{
int track_size_cells = 200000000/cell_size;
- std::vector<UINT32> buffer;
+ std::vector<uint32_t> buffer;
// See above
// We limit the track size to cell_number / 16, which means 6250 for MFM
@@ -510,15 +510,15 @@ enum
Decodes the bitstream into a TDF track image.
Returns the number of detected marks.
*/
-int ti99_floppy_format::decode_bitstream(const UINT8 *bitstream, UINT8 *trackdata, int* sector, int cell_count, int encoding, UINT8 gapbytes, int track_size)
+int ti99_floppy_format::decode_bitstream(const uint8_t *bitstream, uint8_t *trackdata, int* sector, int cell_count, int encoding, uint8_t gapbytes, int track_size)
{
int databytes = 0;
int a1count = 0;
int lastpos = 0;
int headerbytes = 0;
int curpos = 0;
- UINT8 curbyte = 0;
- UINT16 shift_reg = 0;
+ uint8_t curbyte = 0;
+ uint16_t shift_reg = 0;
int tpos = 0;
int pos = 0;
int state;
@@ -695,7 +695,7 @@ int ti99_floppy_format::decode_bitstream(const UINT8 *bitstream, UINT8 *trackdat
return marks;
}
-UINT8 ti99_floppy_format::get_data_from_encoding(UINT16 raw)
+uint8_t ti99_floppy_format::get_data_from_encoding(uint16_t raw)
{
return (raw & 0x4000 ? 0x80 : 0x00) |
(raw & 0x1000 ? 0x40 : 0x00) |
@@ -750,9 +750,9 @@ const char *ti99_sdf_format::extensions() const
return "dsk";
}
-int ti99_sdf_format::identify(io_generic *io, UINT32 form_factor)
+int ti99_sdf_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 file_size = io_generic_size(io);
+ uint64_t file_size = io_generic_size(io);
int vote = 0;
// Adding support for another sector image format which adds 768 bytes
@@ -810,7 +810,7 @@ int ti99_sdf_format::identify(io_generic *io, UINT32 form_factor)
void ti99_sdf_format::determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads, int& tracks)
{
- UINT64 file_size = io_generic_size(io);
+ uint64_t file_size = io_generic_size(io);
ti99vib vib;
cell_size = 0;
@@ -910,7 +910,7 @@ int ti99_sdf_format::get_track_size(int cell_size, int sector_count)
acttrack is the actual track when double stepping is used and changes
every two physical tracks.
*/
-void ti99_sdf_format::load_track(io_generic *io, UINT8 *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize)
+void ti99_sdf_format::load_track(io_generic *io, uint8_t *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize)
{
bool fm = (cellsize==4000);
int tracksize = sectorcount * SECTOR_SIZE;
@@ -999,7 +999,7 @@ void ti99_sdf_format::load_track(io_generic *io, UINT8 *trackdata, int head, int
/*
For debugging. Outputs the byte array in a xxd-like way.
*/
-void ti99_floppy_format::showtrack(UINT8* trackdata, int length)
+void ti99_floppy_format::showtrack(uint8_t* trackdata, int length)
{
for (int i=0; i < length; i+=16)
{
@@ -1023,7 +1023,7 @@ void ti99_floppy_format::showtrack(UINT8* trackdata, int length)
Write the data to the disk. We have a list of sector positions, so we
just need to go through that list and save each sector in the track data.
*/
-void ti99_sdf_format::write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes)
+void ti99_sdf_format::write_track(io_generic *io, uint8_t *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes)
{
int logicaltrack = head * maxtrack;
logicaltrack += ((head&1)==0)? track : (maxtrack - 1 - track);
@@ -1091,11 +1091,11 @@ const char *ti99_tdf_format::extensions() const
/*
Determine whether the image file can be interpreted as a track dump
*/
-int ti99_tdf_format::identify(io_generic *io, UINT32 form_factor)
+int ti99_tdf_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT64 file_size = io_generic_size(io);
+ uint64_t file_size = io_generic_size(io);
int vote = 0;
- UINT8 trackdata[2000];
+ uint8_t trackdata[2000];
// Do we have a plausible image size? From the size alone we only give a 50 percent vote.
if ((file_size == 260240) || (file_size == 549760) || (file_size == 1099520))
@@ -1124,7 +1124,7 @@ int ti99_tdf_format::identify(io_generic *io, UINT32 form_factor)
*/
void ti99_tdf_format::determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads, int& tracks)
{
- UINT64 file_size = io_generic_size(io);
+ uint64_t file_size = io_generic_size(io);
heads = 2; // TDF only supports two-sided recordings
if (file_size % get_track_size(2000, 0)==0) cell_size = 2000;
@@ -1138,7 +1138,7 @@ void ti99_tdf_format::determine_sizes(io_generic *io, int& cell_size, int& secto
For TDF this just amounts to loading the track from the image file.
acttrack is not used here, since the file contains the track data.
*/
-void ti99_tdf_format::load_track(io_generic *io, UINT8 *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize)
+void ti99_tdf_format::load_track(io_generic *io, uint8_t *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize)
{
int offset = ((trackcount * head) + track) * get_track_size(cellsize, 0);
io_generic_read(io, trackdata, offset, get_track_size(cellsize, 0));
@@ -1147,7 +1147,7 @@ void ti99_tdf_format::load_track(io_generic *io, UINT8 *trackdata, int head, int
/*
Also here, we just need to write the complete track on the image file.
*/
-void ti99_tdf_format::write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes)
+void ti99_tdf_format::write_track(io_generic *io, uint8_t *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes)
{
int offset = ((maxtrack * head) + track) * numbytes;
io_generic_write(io, trackdata, offset, numbytes);
diff --git a/src/lib/formats/ti99_dsk.h b/src/lib/formats/ti99_dsk.h
index a34e73d8bd8..d596f4bb17c 100644
--- a/src/lib/formats/ti99_dsk.h
+++ b/src/lib/formats/ti99_dsk.h
@@ -20,29 +20,29 @@ class ti99_floppy_format : public floppy_image_format_t
{
public:
bool supports_save() const override { return true; }
- bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ bool load(io_generic *io, uint32_t form_factor, floppy_image *image) override;
bool save(io_generic *io, floppy_image *image) override;
protected:
- int decode_bitstream(const UINT8 *bitstream, UINT8 *trackdata, int *sector, int cell_count, int encoding, UINT8 gapbytes, int track_size);
- UINT8 get_data_from_encoding(UINT16 raw);
+ int decode_bitstream(const uint8_t *bitstream, uint8_t *trackdata, int *sector, int cell_count, int encoding, uint8_t gapbytes, int track_size);
+ uint8_t get_data_from_encoding(uint16_t raw);
virtual int min_heads() =0;
virtual void determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads, int& tracks) =0;
virtual int get_track_size(int cell_size, int sector_count) =0;
- virtual void load_track(io_generic *io, UINT8 *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize) =0;
- virtual void write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) =0;
+ virtual void load_track(io_generic *io, uint8_t *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize) =0;
+ virtual void write_track(io_generic *io, uint8_t *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) =0;
int get_encoding(int cell_size);
- void generate_track_fm(int track, int head, int cell_size, UINT8* trackdata, floppy_image *image);
- void generate_track_mfm(int track, int head, int cell_size, UINT8* trackdata, floppy_image *image);
+ void generate_track_fm(int track, int head, int cell_size, uint8_t* trackdata, floppy_image *image);
+ void generate_track_mfm(int track, int head, int cell_size, uint8_t* trackdata, floppy_image *image);
- bool check_for_address_marks(UINT8* trackdata, int encoding);
+ bool check_for_address_marks(uint8_t* trackdata, int encoding);
// Debugging
- void showtrack(UINT8* trackdata, int length);
+ void showtrack(uint8_t* trackdata, int length);
};
/*
@@ -51,7 +51,7 @@ protected:
class ti99_sdf_format : public ti99_floppy_format
{
public:
- int identify(io_generic *io, UINT32 form_factor) override;
+ int identify(io_generic *io, uint32_t form_factor) override;
const char *name() const override;
const char *description() const override;
const char *extensions() const override;
@@ -59,8 +59,8 @@ public:
private:
void determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads, int& tracks) override;
int get_track_size(int cell_size, int sector_count) override;
- void write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) override;
- void load_track(io_generic *io, UINT8 *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize) override;
+ void write_track(io_generic *io, uint8_t *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) override;
+ void load_track(io_generic *io, uint8_t *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize) override;
// This format supports single-sided images
int min_heads() override { return 1; }
@@ -68,16 +68,16 @@ private:
struct ti99vib
{
char name[10]; // volume name (10 characters, pad with spaces)
- UINT8 totsecsMSB; // disk length in sectors (big-endian) (usually 360, 720 or 1440)
- UINT8 totsecsLSB;
- UINT8 secspertrack; // sectors per track (usually 9 (FM) or 18 (MFM))
- UINT8 id[3]; // String "DSK"
- UINT8 protection; // 'P' if disk is protected, ' ' otherwise.
- UINT8 tracksperside; // tracks per side (usually 40)
- UINT8 sides; // sides (1 or 2)
- UINT8 density; // 0,1 (FM) or 2,3,4 (MFM)
- UINT8 res[36]; // Empty for traditional disks, or up to 3 directory pointers
- UINT8 abm[200]; // allocation bitmap: a 1 for each sector in use (sector 0 is LSBit of byte 0,
+ uint8_t totsecsMSB; // disk length in sectors (big-endian) (usually 360, 720 or 1440)
+ uint8_t totsecsLSB;
+ uint8_t secspertrack; // sectors per track (usually 9 (FM) or 18 (MFM))
+ uint8_t id[3]; // String "DSK"
+ uint8_t protection; // 'P' if disk is protected, ' ' otherwise.
+ uint8_t tracksperside; // tracks per side (usually 40)
+ uint8_t sides; // sides (1 or 2)
+ uint8_t density; // 0,1 (FM) or 2,3,4 (MFM)
+ uint8_t res[36]; // Empty for traditional disks, or up to 3 directory pointers
+ uint8_t abm[200]; // allocation bitmap: a 1 for each sector in use (sector 0 is LSBit of byte 0,
// sector 7 is MSBit of byte 0, sector 8 is LSBit of byte 1, etc.)
};
};
@@ -90,15 +90,15 @@ extern const floppy_format_type FLOPPY_TI99_SDF_FORMAT;
class ti99_tdf_format : public ti99_floppy_format
{
public:
- int identify(io_generic *io, UINT32 form_factor) override;
+ int identify(io_generic *io, uint32_t form_factor) override;
const char *name() const override;
const char *description() const override;
const char *extensions() const override;
private:
void determine_sizes(io_generic *io, int& cell_size, int& sector_count, int& heads, int& tracks) override;
- void load_track(io_generic *io, UINT8 *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize) override;
- void write_track(io_generic *io, UINT8 *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) override;
+ void load_track(io_generic *io, uint8_t *trackdata, int head, int track, int acttrack, int sectorcount, int trackcount, int cellsize) override;
+ void write_track(io_generic *io, uint8_t *trackdata, int *sector, int track, int head, int maxsect, int maxtrack, int numbytes) override;
int get_track_size(int cell_size, int sector_count) override;
// This format only supports double-sided images
diff --git a/src/lib/formats/trs_cas.cpp b/src/lib/formats/trs_cas.cpp
index 9f00989bc02..a6701ed1263 100644
--- a/src/lib/formats/trs_cas.cpp
+++ b/src/lib/formats/trs_cas.cpp
@@ -21,7 +21,7 @@ static int cas_size;
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-static inline int trs80l2_cas_cycle(INT16 *buffer, int sample_pos, int silence, int high, int low)
+static inline int trs80l2_cas_cycle(int16_t *buffer, int sample_pos, int silence, int high, int low)
{
int i = 0;
@@ -48,7 +48,7 @@ static inline int trs80l2_cas_cycle(INT16 *buffer, int sample_pos, int silence,
}
-static int trs80l2_handle_cas(INT16 *buffer, const UINT8 *casdata)
+static int trs80l2_handle_cas(int16_t *buffer, const uint8_t *casdata)
{
int data_pos, sample_count;
@@ -57,7 +57,7 @@ static int trs80l2_handle_cas(INT16 *buffer, const UINT8 *casdata)
while( data_pos < cas_size )
{
- UINT8 data = casdata[data_pos];
+ uint8_t data = casdata[data_pos];
int i;
for ( i = 0; i < 8; i++ )
@@ -83,7 +83,7 @@ static int trs80l2_handle_cas(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int trs80l2_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int trs80l2_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return trs80l2_handle_cas( buffer, bytes );
}
@@ -92,7 +92,7 @@ static int trs80l2_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int trs80l2_cas_to_wav_size(const UINT8 *casdata, int caslen)
+static int trs80l2_cas_to_wav_size(const uint8_t *casdata, int caslen)
{
cas_size = caslen;
diff --git a/src/lib/formats/tvc_cas.cpp b/src/lib/formats/tvc_cas.cpp
index c7c60829945..9177491278c 100644
--- a/src/lib/formats/tvc_cas.cpp
+++ b/src/lib/formats/tvc_cas.cpp
@@ -28,7 +28,7 @@ static void tvc64_emit_level(cassette_image *cass, double &time, int freq, int l
time += period;
}
-static cassette_image::error tvc64_output_byte(cassette_image *cass, double &time, UINT8 byte)
+static cassette_image::error tvc64_output_byte(cassette_image *cass, double &time, uint8_t byte)
{
for (int i=0; i<8; i++)
{
@@ -58,15 +58,15 @@ static int tvc64_output_predata(cassette_image *cass, double &time, int number)
return (int)cassette_image::error::SUCCESS;
}
-static UINT16 tvc64_calc_crc(const UINT8 *bytes, int size)
+static uint16_t tvc64_calc_crc(const uint8_t *bytes, int size)
{
- UINT16 crc = 0;
+ uint16_t crc = 0;
for (int i=0; i<size; i++)
{
for (int b=0; b<8; b++)
{
- UINT8 al = (bytes[i] & (1<<b)) ? 0x80 : 0x00;
+ uint8_t al = (bytes[i] & (1<<b)) ? 0x80 : 0x00;
al ^= ((crc>>8) & 0xff);
@@ -84,13 +84,13 @@ static UINT16 tvc64_calc_crc(const UINT8 *bytes, int size)
static cassette_image::error tvc64_cassette_load(cassette_image *cassette)
{
- UINT8 tmp_buff[512];
+ uint8_t tmp_buff[512];
int buff_idx = 0;
double time = 0.0;
- UINT8 header[TVC64_HEADER_BYTES];
+ uint8_t header[TVC64_HEADER_BYTES];
cassette_image_read(cassette, header, 0, TVC64_HEADER_BYTES);
- UINT16 cas_size = (header[0x83]<<8) | header[0x82];
+ uint16_t cas_size = (header[0x83]<<8) | header[0x82];
// tape header
tmp_buff[buff_idx++] = 0x00;
@@ -117,7 +117,7 @@ static cassette_image::error tvc64_cassette_load(cassette_image *cassette)
tmp_buff[buff_idx++] = 0x00; // no last sector
// updates the header CRC
- UINT16 crc = tvc64_calc_crc(tmp_buff, buff_idx);
+ uint16_t crc = tvc64_calc_crc(tmp_buff, buff_idx);
tmp_buff[buff_idx++] = crc & 0xff;
tmp_buff[buff_idx++] = (crc>>8) & 0xff;
@@ -155,9 +155,9 @@ static cassette_image::error tvc64_cassette_load(cassette_image *cassette)
tmp_buff[buff_idx++] = 0x00; // data sector
tmp_buff[buff_idx++] = 0x11; // not puffered
tmp_buff[buff_idx++] = 0x00; // not write protected
- tmp_buff[buff_idx++] = (UINT8)((cas_size / 256) + ((cas_size % 256) > 0 ? 1 : 0)); // number of sectors
+ tmp_buff[buff_idx++] = (uint8_t)((cas_size / 256) + ((cas_size % 256) > 0 ? 1 : 0)); // number of sectors
- UINT8 sect_num = 1;
+ uint8_t sect_num = 1;
int sector_num = cas_size / 256;
for (int i=0; i<=sector_num; i++)
{
@@ -202,7 +202,7 @@ static cassette_image::error tvc64_cassette_load(cassette_image *cassette)
static cassette_image::error tvc64_cassette_identify(cassette_image *cassette, struct CassetteOptions *opts)
{
- UINT8 byte;
+ uint8_t byte;
cassette_image_read(cassette, &byte, 0, 1);
if (byte == 0x11)
diff --git a/src/lib/formats/tzx_cas.cpp b/src/lib/formats/tzx_cas.cpp
index bf8142f9b95..748f0227c65 100644
--- a/src/lib/formats/tzx_cas.cpp
+++ b/src/lib/formats/tzx_cas.cpp
@@ -56,7 +56,7 @@ We are currently using the numbers from the TZX specification...
#define INITIAL_MAX_BLOCK_COUNT 256
#define BLOCK_COUNT_INCREMENTS 256
-static const UINT8 TZX_HEADER[8] = { 'Z','X','T','a','p','e','!',0x1a };
+static const uint8_t TZX_HEADER[8] = { 'Z','X','T','a','p','e','!',0x1a };
/*
Global variables
@@ -64,9 +64,9 @@ static const UINT8 TZX_HEADER[8] = { 'Z','X','T','a','p','e','!',0x1a };
Initialized by tzx_cas_get_wave_size, used (and cleaned up) by tzx_cas_fill_wave
*/
-static INT16 wave_data = 0;
+static int16_t wave_data = 0;
static int block_count = 0;
-static UINT8** blocks = nullptr;
+static uint8_t** blocks = nullptr;
static float t_scale = 1; /* for scaling T-states to the 4MHz CPC */
static void toggle_wave_data(void)
@@ -81,32 +81,32 @@ static void toggle_wave_data(void)
}
}
-static void tzx_cas_get_blocks( const UINT8 *casdata, int caslen )
+static void tzx_cas_get_blocks( const uint8_t *casdata, int caslen )
{
int pos = sizeof(TZX_HEADER) + 2;
int max_block_count = INITIAL_MAX_BLOCK_COUNT;
int loopcount = 0, loopoffset = 0;
- blocks = (UINT8**)malloc(max_block_count * sizeof(UINT8*));
+ blocks = (uint8_t**)malloc(max_block_count * sizeof(uint8_t*));
memset(blocks,0,max_block_count);
block_count = 0;
while (pos < caslen)
{
- UINT32 datasize;
- UINT8 blocktype = casdata[pos];
+ uint32_t datasize;
+ uint8_t blocktype = casdata[pos];
if (block_count == max_block_count)
{
void *old_blocks = blocks;
int old_max_block_count = max_block_count;
max_block_count = max_block_count + BLOCK_COUNT_INCREMENTS;
- blocks = (UINT8**)malloc(max_block_count * sizeof(UINT8*)); // SHOULD NOT BE USING auto_alloc_array()
+ blocks = (uint8_t**)malloc(max_block_count * sizeof(uint8_t*)); // SHOULD NOT BE USING auto_alloc_array()
memset(blocks, 0, max_block_count);
- memcpy(blocks, old_blocks, old_max_block_count * sizeof(UINT8*));
+ memcpy(blocks, old_blocks, old_max_block_count * sizeof(uint8_t*));
free(old_blocks);
}
- blocks[block_count] = (UINT8*)&casdata[pos];
+ blocks[block_count] = (uint8_t*)&casdata[pos];
pos += 1;
@@ -217,7 +217,7 @@ static inline int tcycles_to_samplecount( int tcycles )
return (int) ((0.5 + (((double)TZX_WAV_FREQUENCY / 3500000) * (double)tcycles)) * (double) t_scale);
}
-static void tzx_output_wave( INT16 **buffer, int length )
+static void tzx_output_wave( int16_t **buffer, int length )
{
if (buffer == nullptr)
{
@@ -231,7 +231,7 @@ static void tzx_output_wave( INT16 **buffer, int length )
}
}
-static int tzx_cas_handle_block( INT16 **buffer, const UINT8 *bytes, int pause, int data_size, int pilot, int pilot_length, int sync1, int sync2, int bit0, int bit1, int bits_in_last_byte )
+static int tzx_cas_handle_block( int16_t **buffer, const uint8_t *bytes, int pause, int data_size, int pilot, int pilot_length, int sync1, int sync2, int bit0, int bit1, int bits_in_last_byte )
{
int pilot_samples = tcycles_to_samplecount(pilot);
int sync1_samples = tcycles_to_samplecount(sync1);
@@ -268,7 +268,7 @@ static int tzx_cas_handle_block( INT16 **buffer, const UINT8 *bytes, int pause,
/* data */
for (data_index = 0; data_index < data_size; data_index++)
{
- UINT8 byte = bytes[data_index];
+ uint8_t byte = bytes[data_index];
int bits_to_go = (data_index == (data_size - 1)) ? bits_in_last_byte : 8;
for ( ; bits_to_go > 0; byte <<= 1, bits_to_go--)
@@ -297,7 +297,7 @@ static int tzx_cas_handle_block( INT16 **buffer, const UINT8 *bytes, int pause,
return size;
}
-static int tzx_handle_direct(INT16 **buffer, const UINT8 *bytes, int pause, int data_size, int tstates, int bits_in_last_byte)
+static int tzx_handle_direct(int16_t **buffer, const uint8_t *bytes, int pause, int data_size, int tstates, int bits_in_last_byte)
{
int size = 0;
int samples = tcycles_to_samplecount(tstates);
@@ -305,7 +305,7 @@ static int tzx_handle_direct(INT16 **buffer, const UINT8 *bytes, int pause, int
/* data */
for (int data_index = 0; data_index < data_size; data_index++)
{
- UINT8 byte = bytes[data_index];
+ uint8_t byte = bytes[data_index];
int bits_to_go = (data_index == (data_size - 1)) ? bits_in_last_byte : 8;
for ( ; bits_to_go > 0; byte <<= 1, bits_to_go--)
@@ -335,12 +335,12 @@ static int tzx_handle_direct(INT16 **buffer, const UINT8 *bytes, int pause, int
}
-static inline int tzx_handle_symbol(INT16 **buffer, const UINT8 *symtable, UINT8 symbol, int maxp)
+static inline int tzx_handle_symbol(int16_t **buffer, const uint8_t *symtable, uint8_t symbol, int maxp)
{
int size = 0;
- const UINT8 *cursymb = symtable + (2 * maxp + 1)*symbol;
+ const uint8_t *cursymb = symtable + (2 * maxp + 1)*symbol;
- UINT8 starttype = cursymb[0];
+ uint8_t starttype = cursymb[0];
// printf("start polarity %01x (max number of symbols is %d)\n", starttype, maxp);
@@ -370,7 +370,7 @@ static inline int tzx_handle_symbol(INT16 **buffer, const UINT8 *symtable, UINT8
for (int i = 0; i < maxp; i++)
{
- UINT16 pulse_length = cursymb[1 + (i*2)] | (cursymb[2 + (i*2)] << 8);
+ uint16_t pulse_length = cursymb[1 + (i*2)] | (cursymb[2 + (i*2)] << 8);
// printf("pulse_length %04x\n", pulse_length);
// shorter lists can be terminated with a pulse_length of 0
@@ -395,12 +395,12 @@ static inline int tzx_handle_symbol(INT16 **buffer, const UINT8 *symtable, UINT8
return size;
}
-static inline int stream_get_bit(const UINT8 *bytes, UINT8 &stream_bit, UINT32 &stream_byte)
+static inline int stream_get_bit(const uint8_t *bytes, uint8_t &stream_bit, uint32_t &stream_byte)
{
// get bit here
- UINT8 retbit = 0;
+ uint8_t retbit = 0;
- UINT8 byte = bytes[stream_byte];
+ uint8_t byte = bytes[stream_byte];
byte = byte << stream_bit;
if (byte & 0x80) retbit = 1;
@@ -417,7 +417,7 @@ static inline int stream_get_bit(const UINT8 *bytes, UINT8 &stream_bit, UINT32 &
return retbit;
}
-static int tzx_handle_generalized(INT16 **buffer, const UINT8 *bytes, int pause, int data_size, UINT32 totp, int npp, int asp, UINT32 totd, int npd, int asd )
+static int tzx_handle_generalized(int16_t **buffer, const uint8_t *bytes, int pause, int data_size, uint32_t totp, int npp, int asp, uint32_t totd, int npd, int asd )
{
int size = 0;
@@ -425,14 +425,14 @@ static int tzx_handle_generalized(INT16 **buffer, const UINT8 *bytes, int pause,
{
// printf("pilot block table %04x\n", totp);
- const UINT8 *symtable = bytes;
- const UINT8 *table2 = symtable + (2 * npp + 1)*asp;
+ const uint8_t *symtable = bytes;
+ const uint8_t *table2 = symtable + (2 * npp + 1)*asp;
// the Pilot and sync data stream has an RLE encoding
for (int i = 0; i < totp; i+=3)
{
- UINT8 symbol = table2[i + 0];
- UINT16 repetitions = table2[i + 1] + (table2[i + 2] << 8);
+ uint8_t symbol = table2[i + 0];
+ uint16_t repetitions = table2[i + 1] + (table2[i + 2] << 8);
//printf("symbol %02x repititions %04x\n", symbol, repetitions); // does 1 mean repeat once, or that it only occurs once?
for (int j = 0; j < repetitions; j++)
@@ -456,18 +456,18 @@ static int tzx_handle_generalized(INT16 **buffer, const UINT8 *bytes, int pause,
{
printf("data block table %04x (has %0d symbols, max symbol length is %d)\n", totd, asd, npd);
- const UINT8 *symtable = bytes;
- const UINT8 *table2 = bytes + (2 * npd + 1)*asd;
+ const uint8_t *symtable = bytes;
+ const uint8_t *table2 = bytes + (2 * npd + 1)*asd;
int NB = ceil(compute_log2(asd)); // number of bits needed to represent each symbol
printf("NB is %d\n", NB);
- UINT8 stream_bit = 0;
- UINT32 stream_byte = 0;
+ uint8_t stream_bit = 0;
+ uint32_t stream_byte = 0;
for (int i = 0; i < totd; i++)
{
- UINT8 symbol = 0;
+ uint8_t symbol = 0;
for (int j = 0; j < NB; j++)
{
@@ -503,7 +503,7 @@ static int tzx_handle_generalized(INT16 **buffer, const UINT8 *bytes, int pause,
-static void ascii_block_common_log( const char *block_type_string, UINT8 block_type )
+static void ascii_block_common_log( const char *block_type_string, uint8_t block_type )
{
LOG_FORMATS("%s (type %02x) encountered.\n", block_type_string, block_type);
LOG_FORMATS("This block contains info on the .tzx file you are loading.\n");
@@ -533,7 +533,7 @@ static const char *const hw_info[] =
/* Will go through blocks and calculate number of samples needed.
If buffer is not nullptr the sample data will also be written. */
-static int tzx_cas_do_work( INT16 **buffer )
+static int tzx_cas_do_work( int16_t **buffer )
{
int current_block = 0;
int size = 0;
@@ -545,13 +545,13 @@ static int tzx_cas_do_work( INT16 **buffer )
while (current_block < block_count)
{
int pause_time;
- UINT32 data_size;
+ uint32_t data_size;
int text_size, total_size, i;
int pilot, pilot_length, sync1, sync2;
int bit0, bit1, bits_in_last_byte;
- UINT8 *cur_block = blocks[current_block];
- UINT8 block_type = cur_block[0];
- UINT16 tstates = 0;
+ uint8_t *cur_block = blocks[current_block];
+ uint8_t block_type = cur_block[0];
+ uint16_t tstates = 0;
/* Uncomment this to include into error.log a list of the types each block */
LOG_FORMATS("tzx_cas_fill_wave: block %d, block_type %02x\n", current_block, block_type);
@@ -749,12 +749,12 @@ static int tzx_cas_do_work( INT16 **buffer )
data_size = cur_block[1] + (cur_block[2] << 8) + (cur_block[3] << 16) + (cur_block[4] << 24);
pause_time= cur_block[5] + (cur_block[6] << 8);
- UINT32 totp = cur_block[7] + (cur_block[8] << 8) + (cur_block[9] << 16) + (cur_block[10] << 24);
+ uint32_t totp = cur_block[7] + (cur_block[8] << 8) + (cur_block[9] << 16) + (cur_block[10] << 24);
int npp = cur_block[11];
int asp = cur_block[12];
if (asp == 0) asp = 256;
- UINT32 totd = cur_block[13] + (cur_block[14] << 8) + (cur_block[15] << 16) + (cur_block[16] << 24);
+ uint32_t totd = cur_block[13] + (cur_block[14] << 8) + (cur_block[15] << 16) + (cur_block[16] << 24);
int npd = cur_block[17];
int asd = cur_block[18];
if (asd == 0) asd = 256;
@@ -770,7 +770,7 @@ static int tzx_cas_do_work( INT16 **buffer )
return size;
}
-static int tzx_cas_to_wav_size( const UINT8 *casdata, int caslen )
+static int tzx_cas_to_wav_size( const uint8_t *casdata, int caslen )
{
int size = 0;
@@ -813,28 +813,28 @@ cleanup:
return -1;
}
-static int tzx_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
+static int tzx_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes )
{
- INT16 *p = buffer;
+ int16_t *p = buffer;
int size = 0;
t_scale = 1.0;
size = tzx_cas_do_work(&p);
return size;
}
-static int cdt_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
+static int cdt_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes )
{
- INT16 *p = buffer;
+ int16_t *p = buffer;
int size = 0;
t_scale = (40 / 35); /* scale to 4MHz */
size = tzx_cas_do_work(&p);
return size;
}
-static int tap_cas_to_wav_size( const UINT8 *casdata, int caslen )
+static int tap_cas_to_wav_size( const uint8_t *casdata, int caslen )
{
int size = 0;
- const UINT8 *p = casdata;
+ const uint8_t *p = casdata;
while (p < casdata + caslen)
{
@@ -850,9 +850,9 @@ static int tap_cas_to_wav_size( const UINT8 *casdata, int caslen )
return size;
}
-static int tap_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes )
+static int tap_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes )
{
- INT16 *p = buffer;
+ int16_t *p = buffer;
int size = 0;
while (size < length)
diff --git a/src/lib/formats/uef_cas.cpp b/src/lib/formats/uef_cas.cpp
index 39a03349bc2..d3b95022f9e 100644
--- a/src/lib/formats/uef_cas.cpp
+++ b/src/lib/formats/uef_cas.cpp
@@ -31,8 +31,8 @@ Not nice, but it works...
#define WAVE_HIGH 32767
#define WAVE_NULL 0
-static const UINT8 UEF_HEADER[10] = { 0x55, 0x45, 0x46, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x21, 0x00 };
-static const UINT8 GZ_HEADER[2] = { 0x1f, 0x8b };
+static const uint8_t UEF_HEADER[10] = { 0x55, 0x45, 0x46, 0x20, 0x46, 0x69, 0x6c, 0x65, 0x21, 0x00 };
+static const uint8_t GZ_HEADER[2] = { 0x1f, 0x8b };
/*
bytes are stored as
@@ -49,8 +49,8 @@ static const UINT8 GZ_HEADER[2] = { 0x1f, 0x8b };
#define COMMENT 0x10 /* bit 4 set: file comment present */
#define RESERVED 0xE0 /* bits 5..7: reserved */
-static const UINT8* skip_gz_header( const UINT8 *p ) {
- UINT8 method, flags;
+static const uint8_t* skip_gz_header( const uint8_t *p ) {
+ uint8_t method, flags;
/* skip initial 1f 8b header */
p += 2;
/* get method and flags */
@@ -82,9 +82,9 @@ static const UINT8* skip_gz_header( const UINT8 *p ) {
return p;
}
-static UINT8 *gz_ptr = nullptr;
+static uint8_t *gz_ptr = nullptr;
-static float get_uef_float( const UINT8 *Float)
+static float get_uef_float( const uint8_t *Float)
{
int Mantissa;
float Result;
@@ -112,19 +112,19 @@ static float get_uef_float( const UINT8 *Float)
return Result;
}
-static int uef_cas_to_wav_size( const UINT8 *casdata, int caslen ) {
+static int uef_cas_to_wav_size( const uint8_t *casdata, int caslen ) {
int pos, size;
if ( casdata[0] == 0x1f && casdata[1] == 0x8b ) {
int err;
z_stream d_stream;
int inflate_size = ( casdata[ caslen - 1 ] << 24 ) | ( casdata[ caslen - 2 ] << 16 ) | ( casdata[ caslen - 3 ] << 8 ) | casdata[ caslen - 4 ];
- const UINT8 *in_ptr = skip_gz_header( casdata );
+ const uint8_t *in_ptr = skip_gz_header( casdata );
if ( in_ptr == nullptr ) {
goto cleanup;
}
- gz_ptr = (UINT8 *)malloc( inflate_size );
+ gz_ptr = (uint8_t *)malloc( inflate_size );
d_stream.zalloc = nullptr;
d_stream.zfree = nullptr;
@@ -222,7 +222,7 @@ cleanup:
return -1;
}
-static INT16* uef_cas_fill_bit( INT16 *buffer, int bit ) {
+static int16_t* uef_cas_fill_bit( int16_t *buffer, int bit ) {
if ( bit ) {
*buffer = WAVE_LOW; buffer++;
*buffer = WAVE_HIGH; buffer++;
@@ -237,9 +237,9 @@ static INT16* uef_cas_fill_bit( INT16 *buffer, int bit ) {
return buffer;
}
-static int uef_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
+static int uef_cas_fill_wave( int16_t *buffer, int length, uint8_t *bytes ) {
int pos;
- INT16 *p = buffer;
+ int16_t *p = buffer;
if ( bytes[0] == 0x1f && bytes[1] == 0x8b ) {
if ( gz_ptr == nullptr ) {
@@ -255,12 +255,12 @@ static int uef_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
int chunk_length = ( bytes[pos+5] << 24 ) | ( bytes[pos+4] << 16 ) | ( bytes[pos+3] << 8 ) | bytes[pos+2];
int baud_length, i, j;
- UINT8 *c;
+ uint8_t *c;
pos += 6;
switch( chunk_type ) {
case 0x0100: /* implicit start/stop bit data block */
for( j = 0; j < chunk_length; j++ ) {
- UINT8 byte = bytes[pos+j];
+ uint8_t byte = bytes[pos+j];
p = uef_cas_fill_bit( p, 0 );
for( i = 0; i < 8; i++ ) {
p = uef_cas_fill_bit( p, byte & 1 );
@@ -278,7 +278,7 @@ static int uef_cas_fill_wave( INT16 *buffer, int length, UINT8 *bytes ) {
j = ( chunk_length * 10 ) - bytes[pos];
c = bytes + pos;
while( j ) {
- UINT8 byte = *c;
+ uint8_t byte = *c;
for( i = 0; i < 8 && i < j; i++ ) {
p = uef_cas_fill_bit( p, byte & 1 );
byte = byte >> 1;
@@ -324,7 +324,7 @@ static const struct CassetteLegacyWaveFiller uef_legacy_fill_wave = {
};
static cassette_image::error uef_cassette_identify( cassette_image *cassette, struct CassetteOptions *opts ) {
- UINT8 header[10];
+ uint8_t header[10];
cassette_image_read(cassette, header, 0, sizeof(header));
if (memcmp(&header[0], GZ_HEADER, sizeof(GZ_HEADER)) && memcmp(&header[0], UEF_HEADER, sizeof(UEF_HEADER))) {
diff --git a/src/lib/formats/upd765_dsk.cpp b/src/lib/formats/upd765_dsk.cpp
index 97d0daa7d6a..ae11f7080dc 100644
--- a/src/lib/formats/upd765_dsk.cpp
+++ b/src/lib/formats/upd765_dsk.cpp
@@ -16,21 +16,21 @@ upd765_format::upd765_format(const format *_formats)
formats = _formats;
}
-int upd765_format::find_size(io_generic *io, UINT32 form_factor) const
+int upd765_format::find_size(io_generic *io, uint32_t form_factor) const
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].form_factor; i++) {
const format &f = formats[i];
if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
- if(size == (UINT64) compute_track_size(f) * f.track_count * f.head_count)
+ if(size == (uint64_t) compute_track_size(f) * f.track_count * f.head_count)
return i;
}
return -1;
}
-int upd765_format::identify(io_generic *io, UINT32 form_factor)
+int upd765_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -52,7 +52,7 @@ int upd765_format::compute_track_size(const format &f) const
return track_size;
}
-void upd765_format::build_sector_description(const format &f, UINT8 *sectdata, desc_s *sectors, int track, int head) const
+void upd765_format::build_sector_description(const format &f, uint8_t *sectdata, desc_s *sectors, int track, int head) const
{
if(f.sector_base_id == -1) {
for(int i=0; i<f.sector_count; i++) {
@@ -174,7 +174,7 @@ floppy_image_format_t::desc_e* upd765_format::get_desc_mfm(const format &f, int
return desc;
}
-bool upd765_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool upd765_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int type = find_size(io, form_factor);
if(type == -1)
@@ -214,7 +214,7 @@ bool upd765_format::load(io_generic *io, UINT32 form_factor, floppy_image *image
int track_size = compute_track_size(f);
- UINT8 sectdata[40*512];
+ uint8_t sectdata[40*512];
desc_s sectors[40];
for(int track=0; track < f.track_count; track++)
@@ -337,7 +337,7 @@ bool upd765_format::save(io_generic *io, floppy_image *image)
const format &f = formats[chosen_candidate];
int track_size = compute_track_size(f);
- UINT8 sectdata[40*512];
+ uint8_t sectdata[40*512];
desc_s sectors[40];
for(int track=0; track < f.track_count; track++)
@@ -352,8 +352,8 @@ bool upd765_format::save(io_generic *io, floppy_image *image)
void upd765_format::check_compatibility(floppy_image *image, std::vector<int> &candidates)
{
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -406,8 +406,8 @@ void upd765_format::check_compatibility(floppy_image *image, std::vector<int> &c
void upd765_format::extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head)
{
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -431,7 +431,7 @@ void upd765_format::extract_sectors(floppy_image *image, const format &f, desc_s
memset((void *)ds.data, 0, ds.size);
else if(xs.size < ds.size) {
memcpy((void *)ds.data, xs.data, xs.size);
- memset((UINT8 *)ds.data + xs.size, 0, xs.size - ds.size);
+ memset((uint8_t *)ds.data + xs.size, 0, xs.size - ds.size);
} else
memcpy((void *)ds.data, xs.data, ds.size);
}
diff --git a/src/lib/formats/upd765_dsk.h b/src/lib/formats/upd765_dsk.h
index a108931d89b..5bd675de9e8 100644
--- a/src/lib/formats/upd765_dsk.h
+++ b/src/lib/formats/upd765_dsk.h
@@ -17,9 +17,9 @@ class upd765_format : public floppy_image_format_t
{
public:
struct format {
- UINT32 form_factor; // See floppy_image for possible values
- UINT32 variant; // See floppy_image for possible values
- UINT32 encoding; // See floppy_image for possible values
+ uint32_t form_factor; // See floppy_image for possible values
+ uint32_t variant; // See floppy_image for possible values
+ uint32_t encoding; // See floppy_image for possible values
int cell_size; // See floppy_image_format_t for details
int sector_count;
@@ -38,17 +38,17 @@ public:
// End the array with {}
upd765_format(const format *formats);
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 bool supports_save() const override;
protected:
floppy_image_format_t::desc_e* get_desc_fm(const format &f, int &current_size, int &end_gap_index);
floppy_image_format_t::desc_e* get_desc_mfm(const format &f, int &current_size, int &end_gap_index);
- int find_size(io_generic *io, UINT32 form_factor) const;
+ int find_size(io_generic *io, uint32_t form_factor) const;
int compute_track_size(const format &f) const;
- virtual void build_sector_description(const format &d, UINT8 *sectdata, desc_s *sectors, int track, int head) const;
+ virtual void build_sector_description(const format &d, uint8_t *sectdata, desc_s *sectors, int track, int head) const;
void check_compatibility(floppy_image *image, std::vector<int> &candidates);
void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head);
diff --git a/src/lib/formats/vdk_dsk.cpp b/src/lib/formats/vdk_dsk.cpp
index 896815c26ad..308f544e2d3 100644
--- a/src/lib/formats/vdk_dsk.cpp
+++ b/src/lib/formats/vdk_dsk.cpp
@@ -32,9 +32,9 @@ const char *vdk_format::extensions() const
return "vdk";
}
-int vdk_format::identify(io_generic *io, UINT32 form_factor)
+int vdk_format::identify(io_generic *io, uint32_t form_factor)
{
- UINT8 id[2];
+ uint8_t id[2];
io_generic_read(io, id, 0, 2);
if (id[0] == 'd' && id[1] == 'k')
@@ -43,9 +43,9 @@ int vdk_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-bool vdk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool vdk_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
- UINT8 header[0x100];
+ uint8_t header[0x100];
io_generic_read(io, header, 0, 0x100);
int header_size = header[3] * 0x100 + header[2];
@@ -59,7 +59,7 @@ bool vdk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
for (int head = 0; head < head_count ; head++)
{
desc_pc_sector sectors[SECTOR_COUNT];
- UINT8 sector_data[SECTOR_COUNT * SECTOR_SIZE];
+ uint8_t sector_data[SECTOR_COUNT * SECTOR_SIZE];
int sector_offset = 0;
for (int i = 0; i < SECTOR_COUNT; i++)
@@ -88,16 +88,16 @@ bool vdk_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
bool vdk_format::save(io_generic *io, floppy_image *image)
{
- UINT8 bitstream[500000/8];
- UINT8 sector_data[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sector_data[50000];
desc_xs sectors[256];
- UINT64 file_offset = 0;
+ uint64_t file_offset = 0;
int track_count, head_count;
image->get_actual_geometry(track_count, head_count);
// write header
- UINT8 header[12];
+ uint8_t header[12];
header[0] = 'd';
header[1] = 'k';
diff --git a/src/lib/formats/vdk_dsk.h b/src/lib/formats/vdk_dsk.h
index b685cb32f8b..270c1ff9071 100644
--- a/src/lib/formats/vdk_dsk.h
+++ b/src/lib/formats/vdk_dsk.h
@@ -26,8 +26,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 bool supports_save() const override;
diff --git a/src/lib/formats/vg5k_cas.cpp b/src/lib/formats/vg5k_cas.cpp
index 2c298f79304..898507e7139 100644
--- a/src/lib/formats/vg5k_cas.cpp
+++ b/src/lib/formats/vg5k_cas.cpp
@@ -20,7 +20,7 @@ static int k7_size;
/*******************************************************************
Generate one high-low cycle of sample data
********************************************************************/
-static inline int vg5k_cas_cycle(INT16 *buffer, int sample_pos, int len)
+static inline int vg5k_cas_cycle(int16_t *buffer, int sample_pos, int len)
{
int i = 0;
@@ -45,7 +45,7 @@ static inline int vg5k_cas_cycle(INT16 *buffer, int sample_pos, int len)
/*******************************************************************
Generate n samples of silence
********************************************************************/
-static inline int vg5k_cas_silence(INT16 *buffer, int sample_pos, int len)
+static inline int vg5k_cas_silence(int16_t *buffer, int sample_pos, int len)
{
int i = 0;
@@ -60,7 +60,7 @@ static inline int vg5k_cas_silence(INT16 *buffer, int sample_pos, int len)
/*******************************************************************
Generate the end-byte samples
********************************************************************/
-static inline int vg5k_cas_eob(INT16 *buffer, int sample_pos)
+static inline int vg5k_cas_eob(int16_t *buffer, int sample_pos)
{
int i, samples = 0;
@@ -73,7 +73,7 @@ static inline int vg5k_cas_eob(INT16 *buffer, int sample_pos)
}
-static inline int vg5k_cas_byte(INT16 *buffer, int sample_pos, UINT8 data)
+static inline int vg5k_cas_byte(int16_t *buffer, int sample_pos, uint8_t data)
{
/* Writing an entire byte */
int i, samples;
@@ -100,7 +100,7 @@ static inline int vg5k_cas_byte(INT16 *buffer, int sample_pos, UINT8 data)
/*******************************************************************
Generate n sample of synchro
********************************************************************/
-static inline int vg5k_k7_synchro(INT16 *buffer, int sample_pos, int len)
+static inline int vg5k_k7_synchro(int16_t *buffer, int sample_pos, int len)
{
int i, samples = 0;
@@ -113,7 +113,7 @@ static inline int vg5k_k7_synchro(INT16 *buffer, int sample_pos, int len)
}
-static int vg5k_handle_tap(INT16 *buffer, const UINT8 *casdata)
+static int vg5k_handle_tap(int16_t *buffer, const uint8_t *casdata)
{
int data_pos, sample_count;
@@ -127,7 +127,7 @@ static int vg5k_handle_tap(INT16 *buffer, const UINT8 *casdata)
/* on the entire file*/
while( data_pos < k7_size )
{
- UINT16 block_size = 0;
+ uint16_t block_size = 0;
/* Identify type of block */
if (casdata[data_pos] == 0xd3)
@@ -183,7 +183,7 @@ static int vg5k_handle_tap(INT16 *buffer, const UINT8 *casdata)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int vg5k_k7_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int vg5k_k7_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return vg5k_handle_tap(buffer, bytes);
}
@@ -192,7 +192,7 @@ static int vg5k_k7_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
/*******************************************************************
Calculate the number of samples needed for this tape image classical
********************************************************************/
-static int vg5k_k7_to_wav_size(const UINT8 *casdata, int caslen)
+static int vg5k_k7_to_wav_size(const uint8_t *casdata, int caslen)
{
k7_size = caslen ;
diff --git a/src/lib/formats/victor9k_dsk.cpp b/src/lib/formats/victor9k_dsk.cpp
index 5f0936a8048..1fbba7502be 100644
--- a/src/lib/formats/victor9k_dsk.cpp
+++ b/src/lib/formats/victor9k_dsk.cpp
@@ -119,18 +119,18 @@ const char *victor9k_format::extensions() const
return "img";
}
-int victor9k_format::find_size(io_generic *io, UINT32 form_factor)
+int victor9k_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].sector_count; i++) {
const format &f = formats[i];
- if(size == (UINT32) f.sector_count*f.sector_base_size*f.head_count)
+ if(size == (uint32_t) f.sector_count*f.sector_base_size*f.head_count)
return i;
}
return -1;
}
-int victor9k_format::identify(io_generic *io, UINT32 form_factor)
+int victor9k_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -140,7 +140,7 @@ int victor9k_format::identify(io_generic *io, UINT32 form_factor)
return 0;
}
-void victor9k_format::log_boot_sector(UINT8 *data)
+void victor9k_format::log_boot_sector(uint8_t *data)
{
// System disc ID
osd_printf_verbose("System disc: %s\n", ((data[0] == 0xff) && (data[1] == 0x00)) ? "yes" : "no");
@@ -237,7 +237,7 @@ floppy_image_format_t::desc_e* victor9k_format::get_sector_desc(const format &f,
return desc;
}
-void victor9k_format::build_sector_description(const format &f, UINT8 *sectdata, UINT32 sect_offs, desc_s *sectors, int sector_count) const
+void victor9k_format::build_sector_description(const format &f, uint8_t *sectdata, uint32_t sect_offs, desc_s *sectors, int sector_count) const
{
for (int i = 0; i < sector_count; i++) {
sectors[i].data = sectdata + sect_offs;
@@ -248,7 +248,7 @@ void victor9k_format::build_sector_description(const format &f, UINT8 *sectdata,
}
}
-bool victor9k_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool victor9k_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int type = find_size(io, form_factor);
if(type == -1)
@@ -256,8 +256,8 @@ bool victor9k_format::load(io_generic *io, UINT32 form_factor, floppy_image *ima
const format &f = formats[type];
- UINT64 size = io_generic_size(io);
- std::vector<UINT8> img;
+ uint64_t size = io_generic_size(io);
+ std::vector<uint8_t> img;
img.resize(size);
io_generic_read(io, &img[0], 0, size);
@@ -332,7 +332,7 @@ const victor9k_format::format victor9k_format::formats[] = {
{}
};
-const UINT32 victor9k_format::cell_size[9] =
+const uint32_t victor9k_format::cell_size[9] =
{
1789, 1896, 2009, 2130, 2272, 2428, 2613, 2847, 2961
};
@@ -398,7 +398,7 @@ bool victor9k_format::save(io_generic *io, floppy_image *image)
for(int track=0; track < f.track_count; track++) {
int sector_count = sectors_per_track[head][track];
int track_size = compute_track_size(f, head, track);
- UINT8 sectdata[40*512];
+ uint8_t sectdata[40*512];
desc_s sectors[40];
int offset = get_image_offset(f, head, track);
@@ -413,8 +413,8 @@ bool victor9k_format::save(io_generic *io, floppy_image *image)
void victor9k_format::extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head, int sector_count)
{
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -429,7 +429,7 @@ void victor9k_format::extract_sectors(floppy_image *image, const format &f, desc
memset((void *)ds.data, 0, ds.size);
else if(xs.size < ds.size) {
memcpy((void *)ds.data, xs.data, xs.size);
- memset((UINT8 *)ds.data + xs.size, 0, xs.size - ds.size);
+ memset((uint8_t *)ds.data + xs.size, 0, xs.size - ds.size);
} else
memcpy((void *)ds.data, xs.data, ds.size);
}
diff --git a/src/lib/formats/victor9k_dsk.h b/src/lib/formats/victor9k_dsk.h
index c463803b781..0c3f89c9f59 100644
--- a/src/lib/formats/victor9k_dsk.h
+++ b/src/lib/formats/victor9k_dsk.h
@@ -18,13 +18,13 @@
class victor9k_format : public floppy_image_format_t {
public:
struct format {
- UINT32 form_factor; // See floppy_image for possible values
- UINT32 variant; // See floppy_image for possible values
+ uint32_t form_factor; // See floppy_image for possible values
+ uint32_t variant; // See floppy_image for possible values
- UINT16 sector_count;
- UINT8 track_count;
- UINT8 head_count;
- UINT16 sector_base_size;
+ uint16_t sector_count;
+ uint8_t track_count;
+ uint8_t head_count;
+ uint16_t sector_base_size;
};
victor9k_format();
@@ -33,8 +33,8 @@ public:
virtual const char *description() const override;
virtual const char *extensions() const override;
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 bool supports_save() const override { return true; }
@@ -43,15 +43,15 @@ public:
protected:
static const format formats[];
- static const UINT32 cell_size[9];
+ static const uint32_t cell_size[9];
static const int sectors_per_track[2][80];
static const int speed_zone[2][80];
static const int rpm[9];
- int find_size(io_generic *io, UINT32 form_factor);
- void log_boot_sector(UINT8 *data);
+ int find_size(io_generic *io, uint32_t form_factor);
+ void log_boot_sector(uint8_t *data);
floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count);
- void build_sector_description(const format &f, UINT8 *sectdata, UINT32 sect_offs, desc_s *sectors, int sector_count) const;
+ void build_sector_description(const format &f, uint8_t *sectdata, uint32_t sect_offs, desc_s *sectors, int sector_count) const;
int get_image_offset(const format &f, int head, int track);
int compute_track_size(const format &f, int head, int track);
void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head, int sector_count);
diff --git a/src/lib/formats/vt_cas.cpp b/src/lib/formats/vt_cas.cpp
index d3284d4d301..9dbc68f8074 100644
--- a/src/lib/formats/vt_cas.cpp
+++ b/src/lib/formats/vt_cas.cpp
@@ -10,7 +10,7 @@
#define SILENCE 8000
-static int generic_fill_wave(INT16 *buffer, int length, UINT8 *code, int bitsamples, int bytesamples, int lo, INT16 *(*fill_wave_byte)(INT16 *buffer, int byte))
+static int generic_fill_wave(int16_t *buffer, int length, uint8_t *code, int bitsamples, int bytesamples, int lo, int16_t *(*fill_wave_byte)(int16_t *buffer, int byte))
{
static int nullbyte;
@@ -66,7 +66,7 @@ static int generic_fill_wave(INT16 *buffer, int length, UINT8 *code, int bitsamp
#define V1_BITSAMPLES 6
#define V1_BYTESAMPLES 8*V1_BITSAMPLES
-static INT16 *vtech1_fill_wave_byte(INT16 *buffer, int byte)
+static int16_t *vtech1_fill_wave_byte(int16_t *buffer, int byte)
{
int i;
@@ -92,7 +92,7 @@ static INT16 *vtech1_fill_wave_byte(INT16 *buffer, int byte)
return buffer;
}
-static int vtech1_cassette_fill_wave(INT16 *buffer, int length, UINT8 *code)
+static int vtech1_cassette_fill_wave(int16_t *buffer, int length, uint8_t *code)
{
return generic_fill_wave(buffer, length, code, V1_BITSAMPLES, V1_BYTESAMPLES, V1_LO, vtech1_fill_wave_byte);
}
@@ -140,7 +140,7 @@ CASSETTE_FORMATLIST_END
#define VT2_BITSAMPLES 18
#define VT2_BYTESAMPLES 8*VT2_BITSAMPLES
-static const INT16 vtech2_bit0[VT2_BITSAMPLES] =
+static const int16_t vtech2_bit0[VT2_BITSAMPLES] =
{
/* short cycle, long cycles */
VT2_HI,VT2_HI,VT2_HI,VT2_LO,VT2_LO,VT2_LO,
@@ -148,7 +148,7 @@ static const INT16 vtech2_bit0[VT2_BITSAMPLES] =
VT2_LO,VT2_LO,VT2_LO,VT2_LO,VT2_LO,VT2_LO
};
-static const INT16 vtech2_bit1[VT2_BITSAMPLES] =
+static const int16_t vtech2_bit1[VT2_BITSAMPLES] =
{
/* three short cycle */
VT2_HI,VT2_HI,VT2_HI,VT2_LO,VT2_LO,VT2_LO,
@@ -157,7 +157,7 @@ static const INT16 vtech2_bit1[VT2_BITSAMPLES] =
};
-static INT16 *vtech2_fill_wave_bit(INT16 *buffer, int bit)
+static int16_t *vtech2_fill_wave_bit(int16_t *buffer, int bit)
{
int i;
if( bit )
@@ -174,7 +174,7 @@ static INT16 *vtech2_fill_wave_bit(INT16 *buffer, int bit)
}
-static INT16 *vtech2_fill_wave_byte(INT16 *buffer, int byte)
+static int16_t *vtech2_fill_wave_byte(int16_t *buffer, int byte)
{
buffer = vtech2_fill_wave_bit(buffer, (byte >> 7) & 1);
buffer = vtech2_fill_wave_bit(buffer, (byte >> 6) & 1);
@@ -187,7 +187,7 @@ static INT16 *vtech2_fill_wave_byte(INT16 *buffer, int byte)
return buffer;
}
-static int vtech2_cassette_fill_wave(INT16 *buffer, int length, UINT8 *code)
+static int vtech2_cassette_fill_wave(int16_t *buffer, int length, uint8_t *code)
{
return generic_fill_wave(buffer, length, code, VT2_BITSAMPLES, VT2_BYTESAMPLES, VT2_LO, vtech2_fill_wave_byte);
}
diff --git a/src/lib/formats/wavfile.cpp b/src/lib/formats/wavfile.cpp
index 70fb992c97a..29f33c4102b 100644
--- a/src/lib/formats/wavfile.cpp
+++ b/src/lib/formats/wavfile.cpp
@@ -23,25 +23,25 @@ static const char data_tag_id[4] = { 'd', 'a', 't', 'a' };
-static UINT32 get_leuint32(const void *ptr)
+static uint32_t get_leuint32(const void *ptr)
{
- UINT32 value;
+ uint32_t value;
memcpy(&value, ptr, sizeof(value));
return little_endianize_int32(value);
}
-static UINT16 get_leuint16(const void *ptr)
+static uint16_t get_leuint16(const void *ptr)
{
- UINT16 value;
+ uint16_t value;
memcpy(&value, ptr, sizeof(value));
return little_endianize_int16(value);
}
-static void put_leuint32(void *ptr, UINT32 value)
+static void put_leuint32(void *ptr, uint32_t value)
{
value = little_endianize_int32(value);
memcpy(ptr, &value, sizeof(value));
@@ -49,7 +49,7 @@ static void put_leuint32(void *ptr, UINT32 value)
-static void put_leuint16(void *ptr, UINT16 value)
+static void put_leuint16(void *ptr, uint16_t value)
{
value = little_endianize_int16(value);
memcpy(ptr, &value, sizeof(value));
@@ -60,19 +60,19 @@ static void put_leuint16(void *ptr, UINT16 value)
static cassette_image::error wavfile_process(cassette_image *cassette, struct CassetteOptions *opts,
int read_waveform)
{
- UINT8 file_header[12];
- UINT8 tag_header[8];
- UINT8 format_tag[16];
- UINT32 stated_size;
- UINT64 file_size;
- UINT32 tag_size;
- UINT32 tag_samples;
- UINT64 offset;
+ uint8_t file_header[12];
+ uint8_t tag_header[8];
+ uint8_t format_tag[16];
+ uint32_t stated_size;
+ uint64_t file_size;
+ uint32_t tag_size;
+ uint32_t tag_samples;
+ uint64_t offset;
int format_specified = FALSE;
- UINT16 format_type = 0;
- UINT32 bytes_per_second = 0;
-// UINT16 block_align = 0;
+ uint16_t format_type = 0;
+ uint32_t bytes_per_second = 0;
+// uint16_t block_align = 0;
int waveform_flags = 0;
/* read header */
@@ -89,7 +89,7 @@ static cassette_image::error wavfile_process(cassette_image *cassette, struct Ca
stated_size = get_leuint32(&file_header[4]) + 8;
file_size = cassette_image_size(cassette);
if (stated_size > file_size)
- stated_size = (UINT32) file_size;
+ stated_size = (uint32_t) file_size;
while(offset < stated_size)
{
@@ -177,24 +177,24 @@ static cassette_image::error wavfile_load(cassette_image *cassette)
static cassette_image::error wavfile_save(cassette_image *cassette, const struct CassetteInfo *info)
{
cassette_image::error err;
- UINT8 consolidated_header[12 + 8 + 16 + 8];
- UINT8 *header = &consolidated_header[0];
- UINT8 *format_tag_header = &consolidated_header[12];
- UINT8 *format_tag_data = &consolidated_header[12 + 8];
- UINT8 *data_tag_header = &consolidated_header[12 + 8 + 16];
- UINT32 file_size;
- UINT32 bytes_per_second;
- UINT16 bits_per_sample;
- UINT32 data_size;
+ uint8_t consolidated_header[12 + 8 + 16 + 8];
+ uint8_t *header = &consolidated_header[0];
+ uint8_t *format_tag_header = &consolidated_header[12];
+ uint8_t *format_tag_data = &consolidated_header[12 + 8];
+ uint8_t *data_tag_header = &consolidated_header[12 + 8 + 16];
+ uint32_t file_size;
+ uint32_t bytes_per_second;
+ uint16_t bits_per_sample;
+ uint32_t data_size;
size_t bytes_per_sample = 2;
int waveform_flags = CASSETTE_WAVEFORM_16BITLE;
- UINT16 block_align;
+ uint16_t block_align;
- bits_per_sample = (UINT16) (bytes_per_sample * 8);
+ bits_per_sample = (uint16_t) (bytes_per_sample * 8);
bytes_per_second = info->sample_frequency * bytes_per_sample * info->channels;
- data_size = (UINT32) (info->sample_count * bytes_per_sample * info->channels);
+ data_size = (uint32_t) (info->sample_count * bytes_per_sample * info->channels);
file_size = data_size + sizeof(consolidated_header) - 8;
- block_align = (UINT16) (bytes_per_sample * info->channels);
+ block_align = (uint16_t) (bytes_per_sample * info->channels);
/* set up header */
memcpy(&header[0], magic1, 4);
@@ -257,8 +257,8 @@ void wavfile_testload(const char *fname)
FILE *f;
long offset;
int freq, samples, i;
- INT32 cassamp;
- INT16 wavsamp;
+ int32_t cassamp;
+ int16_t wavsamp;
f = fopen(fname, "rb");
if (!f)
@@ -280,7 +280,7 @@ void wavfile_testload(const char *fname)
fseek(f, offset + i * 2, SEEK_SET);
fread(&wavsamp, 1, 2, f);
- assert(cassamp == (((UINT32) wavsamp) << 16));
+ assert(cassamp == (((uint32_t) wavsamp) << 16));
}
cassette_close(cassette);
diff --git a/src/lib/formats/wd177x_dsk.cpp b/src/lib/formats/wd177x_dsk.cpp
index 527fb69a234..52e8db2f1f2 100644
--- a/src/lib/formats/wd177x_dsk.cpp
+++ b/src/lib/formats/wd177x_dsk.cpp
@@ -19,21 +19,21 @@ wd177x_format::wd177x_format(const format *_formats)
/*
Default implementation for find_size. May be overwritten by subclasses.
*/
-int wd177x_format::find_size(io_generic *io, UINT32 form_factor)
+int wd177x_format::find_size(io_generic *io, uint32_t form_factor)
{
- UINT64 size = io_generic_size(io);
+ uint64_t size = io_generic_size(io);
for(int i=0; formats[i].form_factor; i++) {
const format &f = formats[i];
if(form_factor != floppy_image::FF_UNKNOWN && form_factor != f.form_factor)
continue;
- if(size == (UINT64)compute_track_size(f) * f.track_count * f.head_count)
+ if(size == (uint64_t)compute_track_size(f) * f.track_count * f.head_count)
return i;
}
return -1;
}
-int wd177x_format::identify(io_generic *io, UINT32 form_factor)
+int wd177x_format::identify(io_generic *io, uint32_t form_factor)
{
int type = find_size(io, form_factor);
@@ -55,7 +55,7 @@ int wd177x_format::compute_track_size(const format &f) const
return track_size;
}
-void wd177x_format::build_sector_description(const format &f, UINT8 *sectdata, desc_s *sectors) const
+void wd177x_format::build_sector_description(const format &f, uint8_t *sectdata, desc_s *sectors) const
{
if(f.sector_base_id == -1) {
for(int i=0; i<f.sector_count; i++) {
@@ -164,7 +164,7 @@ floppy_image_format_t::desc_e* wd177x_format::get_desc_mfm(const format &f, int
return desc;
}
-bool wd177x_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
+bool wd177x_format::load(io_generic *io, uint32_t form_factor, floppy_image *image)
{
int type = find_size(io, form_factor);
if(type == -1)
@@ -198,7 +198,7 @@ bool wd177x_format::load(io_generic *io, UINT32 form_factor, floppy_image *image
int track_size = compute_track_size(f);
- UINT8 sectdata[40*512];
+ uint8_t sectdata[40*512];
desc_s sectors[40];
build_sector_description(f, sectdata, sectors);
@@ -328,7 +328,7 @@ bool wd177x_format::save(io_generic *io, floppy_image *image)
const format &f = formats[chosen_candidate];
int track_size = compute_track_size(f);
- UINT8 sectdata[40*512];
+ uint8_t sectdata[40*512];
desc_s sectors[40];
build_sector_description(f, sectdata, sectors);
@@ -364,8 +364,8 @@ int wd177x_format::get_track_dam_mfm(const format &f, int head, int track)
void wd177x_format::check_compatibility(floppy_image *image, std::vector<int> &candidates)
{
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -417,8 +417,8 @@ void wd177x_format::check_compatibility(floppy_image *image, std::vector<int> &c
void wd177x_format::extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head)
{
- UINT8 bitstream[500000/8];
- UINT8 sectdata[50000];
+ uint8_t bitstream[500000/8];
+ uint8_t sectdata[50000];
desc_xs sectors[256];
int track_size;
@@ -442,7 +442,7 @@ void wd177x_format::extract_sectors(floppy_image *image, const format &f, desc_s
memset((void *)ds.data, 0, ds.size);
else if(xs.size < ds.size) {
memcpy((void *)ds.data, xs.data, xs.size);
- memset((UINT8 *)ds.data + xs.size, 0, xs.size - ds.size);
+ memset((uint8_t *)ds.data + xs.size, 0, xs.size - ds.size);
} else
memcpy((void *)ds.data, xs.data, ds.size);
}
diff --git a/src/lib/formats/wd177x_dsk.h b/src/lib/formats/wd177x_dsk.h
index 6c93000b02c..0061212d14b 100644
--- a/src/lib/formats/wd177x_dsk.h
+++ b/src/lib/formats/wd177x_dsk.h
@@ -17,9 +17,9 @@ class wd177x_format : public floppy_image_format_t
{
public:
struct format {
- UINT32 form_factor; // See floppy_image for possible values
- UINT32 variant; // See floppy_image for possible values
- UINT32 encoding; // See floppy_image for possible values
+ uint32_t form_factor; // See floppy_image for possible values
+ uint32_t variant; // See floppy_image for possible values
+ uint32_t encoding; // See floppy_image for possible values
int cell_size; // See floppy_image_format_t for details
int sector_count;
@@ -37,8 +37,8 @@ public:
// End the array with {}
wd177x_format(const format *formats);
- virtual int identify(io_generic *io, UINT32 form_factor) override;
- virtual bool load(io_generic *io, UINT32 form_factor, floppy_image *image) override;
+ 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 bool supports_save() const override;
@@ -49,13 +49,13 @@ protected:
virtual floppy_image_format_t::desc_e* get_desc_fm(const format &f, int &current_size, int &end_gap_index);
virtual floppy_image_format_t::desc_e* get_desc_mfm(const format &f, int &current_size, int &end_gap_index);
- virtual int find_size(io_generic *io, UINT32 form_factor);
+ virtual int find_size(io_generic *io, uint32_t form_factor);
virtual int get_image_offset(const format &f, int head, int track);
virtual int get_track_dam_fm(const format &f, int head, int track);
virtual int get_track_dam_mfm(const format &f, int head, int track);
int compute_track_size(const format &f) const;
- void build_sector_description(const format &d, UINT8 *sectdata, desc_s *sectors) const;
+ void build_sector_description(const format &d, uint8_t *sectdata, desc_s *sectors) const;
void check_compatibility(floppy_image *image, std::vector<int> &candidates);
void extract_sectors(floppy_image *image, const format &f, desc_s *sdesc, int track, int head);
};
diff --git a/src/lib/formats/x07_cas.cpp b/src/lib/formats/x07_cas.cpp
index 93c34705105..b49d7c8d643 100644
--- a/src/lib/formats/x07_cas.cpp
+++ b/src/lib/formats/x07_cas.cpp
@@ -21,7 +21,7 @@
// image size
static int x07_image_size;
-static int x07_put_samples(INT16 *buffer, int sample_pos, int count, int level)
+static int x07_put_samples(int16_t *buffer, int sample_pos, int count, int level)
{
if (buffer)
{
@@ -32,7 +32,7 @@ static int x07_put_samples(INT16 *buffer, int sample_pos, int count, int level)
return count;
}
-static int x07_output_bit(INT16 *buffer, int sample_pos, UINT8 bit)
+static int x07_output_bit(int16_t *buffer, int sample_pos, uint8_t bit)
{
int samples = 0;
@@ -52,7 +52,7 @@ static int x07_output_bit(INT16 *buffer, int sample_pos, UINT8 bit)
return samples;
}
-static int x07_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
+static int x07_output_byte(int16_t *buffer, int sample_pos, uint8_t byte)
{
int samples = 0;
@@ -71,7 +71,7 @@ static int x07_output_byte(INT16 *buffer, int sample_pos, UINT8 byte)
return samples;
}
-static int x07_handle_cassette(INT16 *buffer, const UINT8 *bytes)
+static int x07_handle_cassette(int16_t *buffer, const uint8_t *bytes)
{
int sample_count = 0;
int img_start = 0;
@@ -124,7 +124,7 @@ static int x07_handle_cassette(INT16 *buffer, const UINT8 *bytes)
Generate samples for the tape image
********************************************************************/
-static int x07_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int x07_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
return x07_handle_cassette(buffer, bytes);
}
@@ -133,7 +133,7 @@ static int x07_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
Calculate the number of samples needed for this tape image
********************************************************************/
-static int x07_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int x07_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
x07_image_size = length;
diff --git a/src/lib/formats/x1_tap.cpp b/src/lib/formats/x1_tap.cpp
index 33ecefd683f..b4fe65b8e8c 100644
--- a/src/lib/formats/x1_tap.cpp
+++ b/src/lib/formats/x1_tap.cpp
@@ -32,7 +32,7 @@ static int cas_size;
static int samplerate;
static int new_format;
-static int x1_fill_wave(INT16* buffer, UINT8 data, int sample_pos)
+static int x1_fill_wave(int16_t* buffer, uint8_t data, int sample_pos)
{
int x;
int sample_count = 0;
@@ -48,7 +48,7 @@ static int x1_fill_wave(INT16* buffer, UINT8 data, int sample_pos)
return sample_count;
}
-static int x1_handle_tap(INT16* buffer, const UINT8* casdata)
+static int x1_handle_tap(int16_t* buffer, const uint8_t* casdata)
{
int sample_count = 0;
int data_pos = new_format ? 0x28 : 0x04;
@@ -71,9 +71,9 @@ static int x1_handle_tap(INT16* buffer, const UINT8* casdata)
/*******************************************************************
Calculate the number of samples needed for this tape image
********************************************************************/
-static int x1_cas_to_wav_size (const UINT8 *casdata, int caslen)
+static int x1_cas_to_wav_size (const uint8_t *casdata, int caslen)
{
- UINT32 ret;
+ uint32_t ret;
if (!memcmp(casdata, "TAPE", 4)) // new TAP format
{
@@ -98,7 +98,7 @@ static int x1_cas_to_wav_size (const UINT8 *casdata, int caslen)
/*******************************************************************
Generate samples for the tape image
********************************************************************/
-static int x1_cas_fill_wave(INT16 *buffer, int sample_count, UINT8 *bytes)
+static int x1_cas_fill_wave(int16_t *buffer, int sample_count, uint8_t *bytes)
{
return x1_handle_tap(buffer,bytes);
}
diff --git a/src/lib/formats/zx81_p.cpp b/src/lib/formats/zx81_p.cpp
index 7a5f82fd8f1..7f359ccaca3 100644
--- a/src/lib/formats/zx81_p.cpp
+++ b/src/lib/formats/zx81_p.cpp
@@ -55,13 +55,13 @@ medium transfer rate is approx. 307 bps (38 bytes/sec) for files that contain
#define ZX81_DATA_LENGTH_OFFSET 0x0b
#define ZX80_DATA_LENGTH_OFFSET 0x04
-static UINT8 zx_file_name[128];
-static UINT16 real_data_length = 0;
-static UINT8 zx_file_name_length = 0;
+static uint8_t zx_file_name[128];
+static uint16_t real_data_length = 0;
+static uint8_t zx_file_name_length = 0;
/* common functions */
-static INT16 *zx81_emit_level(INT16 *p, int count, int level)
+static int16_t *zx81_emit_level(int16_t *p, int count, int level)
{
int i;
@@ -70,7 +70,7 @@ static INT16 *zx81_emit_level(INT16 *p, int count, int level)
return p;
}
-static INT16* zx81_emit_pulse(INT16 *p)
+static int16_t* zx81_emit_pulse(int16_t *p)
{
p = zx81_emit_level (p, ZX81_PULSE_LENGTH/8, WAVEENTRY_LOW);
p = zx81_emit_level (p, ZX81_PULSE_LENGTH/8, WAVEENTRY_LOW);
@@ -84,14 +84,14 @@ static INT16* zx81_emit_pulse(INT16 *p)
return p;
}
-static INT16* zx81_emit_pause(INT16 *p)
+static int16_t* zx81_emit_pause(int16_t *p)
{
p = zx81_emit_level (p, ZX81_PAUSE_LENGTH, WAVEENTRY_ZERO);
return p;
}
-static INT16* zx81_output_bit(INT16 *p, UINT8 bit)
+static int16_t* zx81_output_bit(int16_t *p, uint8_t bit)
{
int i;
@@ -107,7 +107,7 @@ static INT16* zx81_output_bit(INT16 *p, UINT8 bit)
return p;
}
-static INT16* zx81_output_byte(INT16 *p, UINT8 byte)
+static int16_t* zx81_output_byte(int16_t *p, uint8_t byte)
{
int i;
@@ -117,9 +117,9 @@ static INT16* zx81_output_byte(INT16 *p, UINT8 byte)
return p;
}
-static UINT16 zx81_cassette_calculate_number_of_1(const UINT8 *bytes, UINT16 length)
+static uint16_t zx81_cassette_calculate_number_of_1(const uint8_t *bytes, uint16_t length)
{
- UINT16 number_of_1 = 0;
+ uint16_t number_of_1 = 0;
int i,j;
for (i=0; i<length; i++)
@@ -132,7 +132,7 @@ static UINT16 zx81_cassette_calculate_number_of_1(const UINT8 *bytes, UINT16 len
/* ZX-81 functions */
-static const UINT8 zx81_chars[]={
+static const uint8_t zx81_chars[]={
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*00h-07h*/
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*08h-0fh*/
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*10h-17h*/
@@ -154,11 +154,11 @@ static const UINT8 zx81_chars[]={
static void zx81_fill_file_name(const char* name)
{
for (zx_file_name_length=0; (zx_file_name_length<128) && name[zx_file_name_length]; zx_file_name_length++)
- zx_file_name[zx_file_name_length] = ((UINT8) name[zx_file_name_length]<0x80) ? zx81_chars[(UINT8) name[zx_file_name_length]] : 0x00;
+ zx_file_name[zx_file_name_length] = ((uint8_t) name[zx_file_name_length]<0x80) ? zx81_chars[(uint8_t) name[zx_file_name_length]] : 0x00;
zx_file_name[zx_file_name_length-1] |= 0x80;
}
-static int zx81_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int zx81_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
unsigned int number_of_0_data = 0;
unsigned int number_of_1_data = 0;
@@ -176,9 +176,9 @@ static int zx81_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
return (number_of_0_data+number_of_0_name)*ZX81_LOW_BIT_LENGTH + (number_of_1_data+number_of_1_name)*ZX81_HIGH_BIT_LENGTH + ZX81_PILOT_LENGTH;
}
-static int zx81_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int zx81_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
- INT16 * p = buffer;
+ int16_t * p = buffer;
int i;
/* pilot */
@@ -235,7 +235,7 @@ CASSETTE_FORMATLIST_END
/* ZX-80 functions */
-static int zx80_cassette_calculate_size_in_samples(const UINT8 *bytes, int length)
+static int zx80_cassette_calculate_size_in_samples(const uint8_t *bytes, int length)
{
unsigned int number_of_0_data = 0;
unsigned int number_of_1_data = 0;
@@ -248,9 +248,9 @@ static int zx80_cassette_calculate_size_in_samples(const UINT8 *bytes, int lengt
return number_of_0_data*ZX81_LOW_BIT_LENGTH + number_of_1_data*ZX81_HIGH_BIT_LENGTH + ZX81_PILOT_LENGTH;
}
-static int zx80_cassette_fill_wave(INT16 *buffer, int length, UINT8 *bytes)
+static int zx80_cassette_fill_wave(int16_t *buffer, int length, uint8_t *bytes)
{
- INT16 * p = buffer;
+ int16_t * p = buffer;
int i;
/* pilot */