summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/sorc_dsk.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/formats/sorc_dsk.cpp')
-rw-r--r--src/lib/formats/sorc_dsk.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/lib/formats/sorc_dsk.cpp b/src/lib/formats/sorc_dsk.cpp
index 7a1b734f780..4788b4f4bc0 100644
--- a/src/lib/formats/sorc_dsk.cpp
+++ b/src/lib/formats/sorc_dsk.cpp
@@ -8,12 +8,11 @@
*********************************************************************/
-#include <string.h>
-#include <assert.h>
-
#include "sorc_dsk.h"
#include "basicdsk.h"
+#include <cstring>
+
static FLOPPY_IDENTIFY(sorc_dsk_identify)
{
*vote = (floppy_image_size(floppy) == 332640) ? 100 : 0;
@@ -32,22 +31,20 @@ static int sorc_get_tracks_per_disk(floppy_image_legacy *floppy)
static uint64_t sorc_translate_offset(floppy_image_legacy *floppy, int track, int head, int sector)
{
- return 270*(16*track+sector);
+ return 270 * ((16 * uint64_t(track)) + sector);
}
static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, bool sector_is_index, uint64_t *offset)
{
- uint64_t offs;
/* translate the sector to a raw sector */
if (!sector_is_index)
- {
sector -= 1;
- }
+
/* check to see if we are out of range */
if ((head != 0) || (track < 0) || (track >= 77) || (sector < 0) || (sector >= 16))
return FLOPPY_ERROR_SEEKERROR;
- offs = sorc_translate_offset(floppy, track, head, sector);
+ uint64_t offs = sorc_translate_offset(floppy, track, head, sector);
if (offset)
*offset = offs;
return FLOPPY_ERROR_SUCCESS;