Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
pi1541 committed Dec 28, 2020
1 parent a7a1402 commit 1c6093d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/DiskImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static const unsigned short SECTOR_LENGTH_WITH_CHECKSUM = 260;
static const unsigned char GCR_SYNC_BYTE = 0xff;
static const unsigned char GCR_GAP_BYTE = 0x55;
static const int SECTOR_HEADER_LENGTH = 8;
static const unsigned MAX_D64_SIZE = 0x30000;
static const unsigned MAX_D64_SIZE = 0x32200 + 768;
static const unsigned MAX_D71_SIZE = 0x55600 + 1366;
static const unsigned MAX_D81_SIZE = 822400;

Expand Down Expand Up @@ -141,6 +141,7 @@ DiskImage::DiskImage()
, fileInfo(0)
{
memset(tracks, 0x55, sizeof(tracks));
memset(trackUsed, 0, sizeof(trackUsed));
}

void DiskImage::Close()
Expand Down Expand Up @@ -180,6 +181,7 @@ void DiskImage::Close()
break;
}
memset(trackLengths, 0, sizeof(trackLengths));
memset(trackUsed, 0, sizeof(trackUsed));
diskType = NONE;
fileInfo = 0;
hash = 0;
Expand All @@ -204,7 +206,7 @@ void DiskImage::DumpTrack(unsigned track)
bool DiskImage::OpenD64(const FILINFO* fileInfo, unsigned char* diskImage, unsigned size)
{
unsigned char errorinfo[MAXBLOCKSONDISK];
unsigned last_track = MAXBLOCKSONDISK;
unsigned last_track;
unsigned sector_ref;
unsigned char error;

Expand Down Expand Up @@ -314,11 +316,11 @@ bool DiskImage::WriteD64(char* name)
return false;
}
d64ptr = d64data;
for (track = 0; track <= 40 * 2; track += 2)
for (track = 0; track < HALF_TRACK_COUNT; track += 2)
{
if (trackUsed[track])
{
//printf("Track %d\n", track);
//printf("Track %d\r\n", track);

for (sector = 0; sector < SectorsPerTrack[track / 2]; sector++)
{
Expand Down
4 changes: 2 additions & 2 deletions src/gcr.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#define MAX_HALFTRACKS_1571 (MAX_TRACKS_1571 * 2)

/* D64 constants */
#define BLOCKSONDISK 683
#define BLOCKSEXTRA 85
#define BLOCKSONDISK (17*21 + 7*19 + 6*18 + 5*17)
#define BLOCKSEXTRA (5*17)
#define MAXBLOCKSONDISK (BLOCKSONDISK+BLOCKSEXTRA)
#define MAX_TRACK_D64 40

Expand Down

0 comments on commit 1c6093d

Please sign in to comment.