Add interleave option for sectors in disk image
This commit is contained in:
parent
46b52a57f7
commit
4954a285e7
|
@ -353,3 +353,4 @@ make/oscar64
|
||||||
*.mapd
|
*.mapd
|
||||||
*.idb
|
*.idb
|
||||||
oscar64/Releasex64/oscar64.vcxproj.FileListAbsolute.txt
|
oscar64/Releasex64/oscar64.vcxproj.FileListAbsolute.txt
|
||||||
|
/oscar64/Debugx64
|
||||||
|
|
|
@ -31,6 +31,8 @@ static char A2P(char ch)
|
||||||
|
|
||||||
DiskImage::DiskImage(const char* fname)
|
DiskImage::DiskImage(const char* fname)
|
||||||
{
|
{
|
||||||
|
mInterleave = 10;
|
||||||
|
|
||||||
for (int i = 0; i < 41; i++)
|
for (int i = 0; i < 41; i++)
|
||||||
for (int j = 0; j < 21; j++)
|
for (int j = 0; j < 21; j++)
|
||||||
memset(mSectors[i][j], 0, 256);
|
memset(mSectors[i][j], 0, 256);
|
||||||
|
@ -104,7 +106,7 @@ int DiskImage::AllocBAMSector(int track, int sector)
|
||||||
|
|
||||||
if (dp[0] > 0)
|
if (dp[0] > 0)
|
||||||
{
|
{
|
||||||
sector += 4;
|
sector += mInterleave;
|
||||||
if (sector >= SectorsPerTrack[track])
|
if (sector >= SectorsPerTrack[track])
|
||||||
sector -= SectorsPerTrack[track];
|
sector -= SectorsPerTrack[track];
|
||||||
|
|
||||||
|
@ -228,8 +230,10 @@ void DiskImage::CloseFile(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DiskImage::WriteFile(const char* fname, bool compressed)
|
bool DiskImage::WriteFile(const char* fname, bool compressed, int interleave)
|
||||||
{
|
{
|
||||||
|
mInterleave = interleave;
|
||||||
|
|
||||||
FILE* file;
|
FILE* file;
|
||||||
fopen_s(&file, fname, "rb");
|
fopen_s(&file, fname, "rb");
|
||||||
if (file)
|
if (file)
|
||||||
|
|
|
@ -14,7 +14,7 @@ public:
|
||||||
void CloseFile(void);
|
void CloseFile(void);
|
||||||
|
|
||||||
int WriteBytes(const uint8* data, ptrdiff_t size);
|
int WriteBytes(const uint8* data, ptrdiff_t size);
|
||||||
bool WriteFile(const char* fname, bool compressed);
|
bool WriteFile(const char* fname, bool compressed, int interleave);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8 mSectors[41][21][256];
|
uint8 mSectors[41][21][256];
|
||||||
|
@ -24,6 +24,6 @@ protected:
|
||||||
int AllocBAMTrack(int track);
|
int AllocBAMTrack(int track);
|
||||||
|
|
||||||
uint8 * mDirEntry;
|
uint8 * mDirEntry;
|
||||||
int mTrack, mSector, mBytes;
|
int mTrack, mSector, mBytes, mInterleave;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -21752,6 +21752,8 @@ bool NativeCodeBasicBlock::PropagateSinglePath(void)
|
||||||
live |= LIVE_CPU_REG_X;
|
live |= LIVE_CPU_REG_X;
|
||||||
if (mExitRequiredRegs[CPU_REG_Y])
|
if (mExitRequiredRegs[CPU_REG_Y])
|
||||||
live |= LIVE_CPU_REG_Y;
|
live |= LIVE_CPU_REG_Y;
|
||||||
|
if (mExitRequiredRegs[CPU_REG_C])
|
||||||
|
live |= LIVE_CPU_REG_C;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < mIns.Size())
|
while (i < mIns.Size())
|
||||||
|
@ -31250,7 +31252,7 @@ bool NativeCodeBasicBlock::MoveStoreXUp(int at)
|
||||||
|
|
||||||
if (mIns[at - 1].mMode == ASMIM_ABSOLUTE_X && inc)
|
if (mIns[at - 1].mMode == ASMIM_ABSOLUTE_X && inc)
|
||||||
{
|
{
|
||||||
if (mIns[at - 1].mLinkerObject && mIns[at - 1].mLinkerObject->mSize > 255)
|
if (!mIns[at - 1].mLinkerObject || mIns[at - 1].mLinkerObject->mSize > 255)
|
||||||
return done;
|
return done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34888,6 +34890,8 @@ bool NativeCodeBasicBlock::OptimizeSimpleLoopInvariant(NativeCodeProcedure* proc
|
||||||
else
|
else
|
||||||
t = ASMIT_INX;
|
t = ASMIT_INX;
|
||||||
|
|
||||||
|
if (i < ei)
|
||||||
|
{
|
||||||
mIns[i].mType = ASMIT_NOP;
|
mIns[i].mType = ASMIT_NOP;
|
||||||
mIns[i].mMode = ASMIM_IMPLIED;
|
mIns[i].mMode = ASMIM_IMPLIED;
|
||||||
|
|
||||||
|
@ -34898,6 +34902,12 @@ bool NativeCodeBasicBlock::OptimizeSimpleLoopInvariant(NativeCodeProcedure* proc
|
||||||
}
|
}
|
||||||
|
|
||||||
mIns.Insert(ei + 1, NativeCodeInstruction(mIns[i].mIns, t));
|
mIns.Insert(ei + 1, NativeCodeInstruction(mIns[i].mIns, t));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mIns[i].mType = t;
|
||||||
|
mIns[i].mMode = ASMIM_IMPLIED;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < mIns.Size(); i++)
|
for (int i = 0; i < mIns.Size(); i++)
|
||||||
mIns[i].mLive |= LIVE_CPU_REG_X;
|
mIns[i].mLive |= LIVE_CPU_REG_X;
|
||||||
|
@ -43236,7 +43246,26 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(NativeCodeProcedure* proc, int pass
|
||||||
mIns[i + 2].mType = ASMIT_NOP; mIns[i + 2].mMode = ASMIM_IMPLIED;
|
mIns[i + 2].mType = ASMIT_NOP; mIns[i + 2].mMode = ASMIM_IMPLIED;
|
||||||
progress = true;
|
progress = true;
|
||||||
}
|
}
|
||||||
|
else if (
|
||||||
|
mIns[i + 2].mType == ASMIT_TXA && !(mIns[i + 2].mLive & LIVE_CPU_REG_A) &&
|
||||||
|
(mIns[i + 0].mType == ASMIT_INX || mIns[i + 0].mType == ASMIT_DEX) &&
|
||||||
|
!mIns[i + 1].ChangesXReg() && !mIns[i + 1].ChangesZFlag())
|
||||||
|
{
|
||||||
|
mIns[i + 0].mLive |= LIVE_CPU_REG_Z;
|
||||||
|
mIns[i + 1].mLive |= LIVE_CPU_REG_Z;
|
||||||
|
mIns[i + 2].mType = ASMIT_NOP; mIns[i + 2].mMode = ASMIM_IMPLIED;
|
||||||
|
progress = true;
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
mIns[i + 2].mType == ASMIT_TYA && !(mIns[i + 2].mLive & LIVE_CPU_REG_A) &&
|
||||||
|
(mIns[i + 0].mType == ASMIT_INY || mIns[i + 0].mType == ASMIT_DEY) &&
|
||||||
|
!mIns[i + 1].ChangesYReg() && !mIns[i + 1].ChangesZFlag())
|
||||||
|
{
|
||||||
|
mIns[i + 0].mLive |= LIVE_CPU_REG_Z;
|
||||||
|
mIns[i + 1].mLive |= LIVE_CPU_REG_Z;
|
||||||
|
mIns[i + 2].mType = ASMIT_NOP; mIns[i + 2].mMode = ASMIM_IMPLIED;
|
||||||
|
progress = true;
|
||||||
|
}
|
||||||
else if (
|
else if (
|
||||||
mIns[i + 0].mType == ASMIT_STA && mIns[i + 0].mMode == ASMIM_ZERO_PAGE &&
|
mIns[i + 0].mType == ASMIT_STA && mIns[i + 0].mMode == ASMIM_ZERO_PAGE &&
|
||||||
mIns[i + 1].mType == ASMIT_LDA && mIns[i + 1].mMode == ASMIM_ZERO_PAGE &&
|
mIns[i + 1].mType == ASMIT_LDA && mIns[i + 1].mMode == ASMIM_ZERO_PAGE &&
|
||||||
|
@ -44717,6 +44746,21 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(NativeCodeProcedure* proc, int pass
|
||||||
progress = true;
|
progress = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if 1
|
||||||
|
else if (
|
||||||
|
mIns[i + 0].mType == ASMIT_LDX &&
|
||||||
|
mIns[i + 1].mType == ASMIT_DEX &&
|
||||||
|
mIns[i + 2].mType == ASMIT_STX && mIns[i + 2].SameEffectiveAddress(mIns[i + 0]) && HasAsmInstructionMode(ASMIT_DEC, mIns[i + 0].mMode) &&
|
||||||
|
mIns[i + 3].mType == ASMIT_TXA && !(mIns[i + 3].mLive & LIVE_CPU_REG_X))
|
||||||
|
{
|
||||||
|
mIns[i + 0].mType = ASMIT_DEC;
|
||||||
|
mIns[i + 1].mType = ASMIT_NOP; mIns[i + 1].mMode = ASMIM_IMPLIED;
|
||||||
|
mIns[i + 2].mType = ASMIT_LDA; mIns[i + 2].mLive = mIns[i + 3].mLive;
|
||||||
|
mIns[i + 3].mType = ASMIT_NOP; mIns[i + 3].mMode = ASMIM_IMPLIED;
|
||||||
|
|
||||||
|
progress = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
else if (
|
else if (
|
||||||
mIns[i + 0].mType == ASMIT_LDA && mIns[i + 0].mMode == ASMIM_IMMEDIATE &&
|
mIns[i + 0].mType == ASMIT_LDA && mIns[i + 0].mMode == ASMIM_IMMEDIATE &&
|
||||||
|
@ -48249,7 +48293,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
|
||||||
mInterProc = proc;
|
mInterProc = proc;
|
||||||
mInterProc->mLinkerObject->mNativeProc = this;
|
mInterProc->mLinkerObject->mNativeProc = this;
|
||||||
|
|
||||||
CheckFunc = !strcmp(mInterProc->mIdent->mString, "longor");
|
CheckFunc = !strcmp(mInterProc->mIdent->mString, "read_decompress");
|
||||||
|
|
||||||
int nblocks = proc->mBlocks.Size();
|
int nblocks = proc->mBlocks.Size();
|
||||||
tblocks = new NativeCodeBasicBlock * [nblocks];
|
tblocks = new NativeCodeBasicBlock * [nblocks];
|
||||||
|
|
|
@ -67,6 +67,7 @@ int main2(int argc, const char** argv)
|
||||||
{
|
{
|
||||||
char basePath[200], crtPath[200], includePath[200], targetPath[200], diskPath[200];
|
char basePath[200], crtPath[200], includePath[200], targetPath[200], diskPath[200];
|
||||||
char strProductName[100], strProductVersion[200];
|
char strProductName[100], strProductVersion[200];
|
||||||
|
int dataFileInterleave = 10;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
GetProductAndVersion(strProductName, strProductVersion);
|
GetProductAndVersion(strProductName, strProductVersion);
|
||||||
|
@ -152,6 +153,10 @@ int main2(int argc, const char** argv)
|
||||||
dataFiles.Push(arg + 4);
|
dataFiles.Push(arg + 4);
|
||||||
dataFileCompressed.Push(true);
|
dataFileCompressed.Push(true);
|
||||||
}
|
}
|
||||||
|
else if (arg[1] == 'f' && arg[2] == 'i' && arg[3] == '=')
|
||||||
|
{
|
||||||
|
dataFileInterleave = atoi(arg + 4);
|
||||||
|
}
|
||||||
else if (arg[1] == 'o' && arg[2] == '=')
|
else if (arg[1] == 'o' && arg[2] == '=')
|
||||||
{
|
{
|
||||||
strcpy_s(targetPath, arg + 3);
|
strcpy_s(targetPath, arg + 3);
|
||||||
|
@ -512,7 +517,7 @@ int main2(int argc, const char** argv)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < dataFiles.Size(); i++)
|
for (int i = 0; i < dataFiles.Size(); i++)
|
||||||
{
|
{
|
||||||
if (!d64->WriteFile(dataFiles[i], dataFileCompressed[i]))
|
if (!d64->WriteFile(dataFiles[i], dataFileCompressed[i], dataFileInterleave))
|
||||||
{
|
{
|
||||||
printf("Could not embed disk file %s\n", dataFiles[i]);
|
printf("Could not embed disk file %s\n", dataFiles[i]);
|
||||||
return 20;
|
return 20;
|
||||||
|
|
Loading…
Reference in New Issue