Fix adc to inx with wrong address mode
This commit is contained in:
parent
34c0df228b
commit
fa218d8dd7
|
@ -97,6 +97,9 @@ __asm irq2
|
||||||
tya
|
tya
|
||||||
pha
|
pha
|
||||||
|
|
||||||
|
lda $01
|
||||||
|
pha
|
||||||
|
|
||||||
lda #$35
|
lda #$35
|
||||||
sta $01
|
sta $01
|
||||||
|
|
||||||
|
@ -136,7 +139,7 @@ ji:
|
||||||
|
|
||||||
ex:
|
ex:
|
||||||
|
|
||||||
lda PLAShadow
|
pla
|
||||||
sta $01
|
sta $01
|
||||||
|
|
||||||
pla
|
pla
|
||||||
|
|
|
@ -16462,7 +16462,7 @@ bool NativeCodeBasicBlock::ExpandADCToBranch(NativeCodeProcedure* proc)
|
||||||
|
|
||||||
mIns[i + 0].mType = ASMIT_NOP; mIns[i + 1].mMode = ASMIM_IMPLIED;
|
mIns[i + 0].mType = ASMIT_NOP; mIns[i + 1].mMode = ASMIM_IMPLIED;
|
||||||
mIns[i + 1].mType = ASMIT_NOP;
|
mIns[i + 1].mType = ASMIT_NOP;
|
||||||
mIns[i + 2].mType = ASMIT_INX; mIns[i + 2].mLive |= LIVE_CPU_REG_Z | LIVE_CPU_REG_X;
|
mIns[i + 2].mType = ASMIT_INX; mIns[i + 2].mMode = ASMIM_IMPLIED; mIns[i + 2].mLive |= LIVE_CPU_REG_Z | LIVE_CPU_REG_X;
|
||||||
mIns[i + 3].mType = ASMIT_STX; mIns[i + 3].mLive |= LIVE_CPU_REG_Z;
|
mIns[i + 3].mType = ASMIT_STX; mIns[i + 3].mLive |= LIVE_CPU_REG_Z;
|
||||||
|
|
||||||
fblock->mIns.Push(mIns[i + 4]);
|
fblock->mIns.Push(mIns[i + 4]);
|
||||||
|
@ -27126,7 +27126,7 @@ bool NativeCodeBasicBlock::MoveLDSTXOutOfRange(int at)
|
||||||
if (mIns[j].mType == ASMIT_JSR)
|
if (mIns[j].mType == ASMIT_JSR)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(mIns[j].mLive & LIVE_CPU_REG_A))
|
if (!(mIns[j].mLive & (LIVE_CPU_REG_A | LIVE_CPU_REG_Z)))
|
||||||
{
|
{
|
||||||
mIns.Insert(j + 1, NativeCodeInstruction(mIns[at + 1].mIns, ASMIT_STA, mIns[at + 1]));
|
mIns.Insert(j + 1, NativeCodeInstruction(mIns[at + 1].mIns, ASMIT_STA, mIns[at + 1]));
|
||||||
mIns.Insert(j + 1, NativeCodeInstruction(mIns[at].mIns, ASMIT_LDA, mIns[at]));
|
mIns.Insert(j + 1, NativeCodeInstruction(mIns[at].mIns, ASMIT_LDA, mIns[at]));
|
||||||
|
@ -35333,7 +35333,7 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(NativeCodeProcedure* proc, int pass
|
||||||
mIns[i + 1].mType == ASMIT_AND && mIns[i + 1].mMode == ASMIM_IMMEDIATE && (mIns[i + 1].mAddress & 0x01) && !(mIns[i + 1].mLive & LIVE_CPU_REG_C))
|
mIns[i + 1].mType == ASMIT_AND && mIns[i + 1].mMode == ASMIM_IMMEDIATE && (mIns[i + 1].mAddress & 0x01) && !(mIns[i + 1].mLive & LIVE_CPU_REG_C))
|
||||||
{
|
{
|
||||||
mIns[i + 0] = mIns[i + 1];
|
mIns[i + 0] = mIns[i + 1];
|
||||||
mIns[i + 0].mLive |= LIVE_CPU_REG_C;
|
mIns[i + 0].mLive |= LIVE_CPU_REG_C | LIVE_CPU_REG_A;
|
||||||
mIns[i + 0].mAddress = (mIns[i + 0].mAddress >> 1) & 0x7f;
|
mIns[i + 0].mAddress = (mIns[i + 0].mAddress >> 1) & 0x7f;
|
||||||
mIns[i + 1].mType = ASMIT_ROL; mIns[i + 1].mMode = ASMIM_IMPLIED;
|
mIns[i + 1].mType = ASMIT_ROL; mIns[i + 1].mMode = ASMIM_IMPLIED;
|
||||||
progress = true;
|
progress = true;
|
||||||
|
@ -35343,7 +35343,7 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(NativeCodeProcedure* proc, int pass
|
||||||
mIns[i + 1].mType == ASMIT_AND && mIns[i + 1].mMode == ASMIM_IMMEDIATE && (mIns[i + 1].mAddress & 0x80) && !(mIns[i + 1].mLive & LIVE_CPU_REG_C))
|
mIns[i + 1].mType == ASMIT_AND && mIns[i + 1].mMode == ASMIM_IMMEDIATE && (mIns[i + 1].mAddress & 0x80) && !(mIns[i + 1].mLive & LIVE_CPU_REG_C))
|
||||||
{
|
{
|
||||||
mIns[i + 0] = mIns[i + 1];
|
mIns[i + 0] = mIns[i + 1];
|
||||||
mIns[i + 0].mLive |= LIVE_CPU_REG_C;
|
mIns[i + 0].mLive |= LIVE_CPU_REG_C | LIVE_CPU_REG_A;
|
||||||
mIns[i + 0].mAddress = (mIns[i + 0].mAddress << 1) & 0xfe;
|
mIns[i + 0].mAddress = (mIns[i + 0].mAddress << 1) & 0xfe;
|
||||||
mIns[i + 1].mType = ASMIT_ROR; mIns[i + 1].mMode = ASMIM_IMPLIED;
|
mIns[i + 1].mType = ASMIT_ROR; mIns[i + 1].mMode = ASMIM_IMPLIED;
|
||||||
progress = true;
|
progress = true;
|
||||||
|
@ -39976,6 +39976,23 @@ void NativeCodeBasicBlock::CheckVisited(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NativeCodeBasicBlock::CheckAsmCode(void)
|
||||||
|
{
|
||||||
|
#if _DEBUG
|
||||||
|
if (!mVisited)
|
||||||
|
{
|
||||||
|
mVisited = true;
|
||||||
|
|
||||||
|
for (int j = 0; j < mIns.Size(); j++)
|
||||||
|
{
|
||||||
|
assert(HasAsmInstructionMode(mIns[j].mType, mIns[j].mMode));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mTrueJump) mTrueJump->CheckAsmCode();
|
||||||
|
if (mFalseJump) mFalseJump->CheckAsmCode();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void NativeCodeBasicBlock::CheckBlocks(bool sequence)
|
void NativeCodeBasicBlock::CheckBlocks(bool sequence)
|
||||||
|
@ -40672,7 +40689,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
|
||||||
{
|
{
|
||||||
mInterProc = proc;
|
mInterProc = proc;
|
||||||
|
|
||||||
CheckFunc = !strcmp(mInterProc->mIdent->mString, "robot_move");
|
CheckFunc = !strcmp(mInterProc->mIdent->mString, "time_draw");
|
||||||
|
|
||||||
int nblocks = proc->mBlocks.Size();
|
int nblocks = proc->mBlocks.Size();
|
||||||
tblocks = new NativeCodeBasicBlock * [nblocks];
|
tblocks = new NativeCodeBasicBlock * [nblocks];
|
||||||
|
@ -41405,6 +41422,11 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
|
#if _DEBUG
|
||||||
|
ResetVisited();
|
||||||
|
mEntryBlock->CheckBlocks();
|
||||||
|
#endif
|
||||||
|
|
||||||
BuildDataFlowSets();
|
BuildDataFlowSets();
|
||||||
ResetVisited();
|
ResetVisited();
|
||||||
mEntryBlock->RemoveUnusedResultInstructions();
|
mEntryBlock->RemoveUnusedResultInstructions();
|
||||||
|
@ -41418,6 +41440,10 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
if (mEntryBlock->AbsoluteValueForwarding(pairs))
|
if (mEntryBlock->AbsoluteValueForwarding(pairs))
|
||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
|
#if _DEBUG
|
||||||
|
ResetVisited();
|
||||||
|
mEntryBlock->CheckBlocks();
|
||||||
|
#endif
|
||||||
|
|
||||||
BuildDataFlowSets();
|
BuildDataFlowSets();
|
||||||
ResetVisited();
|
ResetVisited();
|
||||||
|
@ -41869,6 +41895,11 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if _DEBUG
|
||||||
|
ResetVisited();
|
||||||
|
mEntryBlock->CheckAsmCode();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
if (step == 8)
|
if (step == 8)
|
||||||
{
|
{
|
||||||
|
@ -41896,6 +41927,10 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if _DEBUG
|
||||||
|
ResetVisited();
|
||||||
|
mEntryBlock->CheckAsmCode();
|
||||||
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
if (step == 9)
|
if (step == 9)
|
||||||
{
|
{
|
||||||
|
@ -41907,6 +41942,10 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
#endif
|
#endif
|
||||||
RebuildEntry();
|
RebuildEntry();
|
||||||
|
|
||||||
|
#if _DEBUG
|
||||||
|
ResetVisited();
|
||||||
|
mEntryBlock->CheckAsmCode();
|
||||||
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
if (step == 2 && !changed)
|
if (step == 2 && !changed)
|
||||||
{
|
{
|
||||||
|
@ -41954,6 +41993,11 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if _DEBUG
|
||||||
|
ResetVisited();
|
||||||
|
mEntryBlock->CheckAsmCode();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
if (cnt > 190)
|
if (cnt > 190)
|
||||||
{
|
{
|
||||||
|
|
|
@ -668,6 +668,7 @@ public:
|
||||||
|
|
||||||
void CheckLive(void);
|
void CheckLive(void);
|
||||||
void CheckBlocks(bool sequence = false);
|
void CheckBlocks(bool sequence = false);
|
||||||
|
void CheckAsmCode(void);
|
||||||
void CheckVisited(void);
|
void CheckVisited(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue