summaryrefslogtreecommitdiffstats
path: root/src/lib/formats/d88_dsk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/formats/d88_dsk.cpp')
-rw-r--r--src/lib/formats/d88_dsk.cpp90
1 files changed, 45 insertions, 45 deletions
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;