summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/thom_dsk.cpp
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-10-22 13:13:17 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2016-10-22 13:13:17 +0200
commitddb290d5f615019c33c42b8d94e5a5254cabcf33 (patch)
treea70f688b0df3acd19da7b1151e5902e3c6af3fa5 /src/lib/formats/thom_dsk.cpp
parent333bff8de64dfaeb98134000412796b4fdef970b (diff)
NOTICE (TYPE NAME CONSOLIDATION)
Use standard uint64_t, uint32_t, uint16_t or uint8_t instead of UINT64, UINT32, UINT16 or UINT8 also use standard int64_t, int32_t, int16_t or int8_t instead of INT64, INT32, INT16 or INT8
Diffstat (limited to 'src/lib/formats/thom_dsk.cpp')
-rw-r--r--src/lib/formats/thom_dsk.cpp40
1 files changed, 20 insertions, 20 deletions
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;