From 723f407757c8f3eb19b2f799fc51fadf2a2654c8 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Sun, 15 Sep 2024 19:54:00 +0200 Subject: [PATCH] FIx unary not for unsigned const long --- oscar64/Declaration.cpp | 3 +++ oscar64/NativeCodeGenerator.cpp | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/oscar64/Declaration.cpp b/oscar64/Declaration.cpp index 0100470..603c67c 100644 --- a/oscar64/Declaration.cpp +++ b/oscar64/Declaration.cpp @@ -575,7 +575,10 @@ Expression* Expression::ConstantFold(Errors * errors, LinkerSection * dataSectio dec->mBase = TheUnsignedIntTypeDeclaration; } else + { + dec->mInteger &= 0xffffffff; dec->mBase = TheUnsignedLongTypeDeclaration; + } ex->mDecValue = dec; ex->mDecType = dec->mBase; diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index 2a6f05c..bd23b25 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -24475,7 +24475,7 @@ bool NativeCodeBasicBlock::JoinTailCodeSequences(NativeCodeProcedure* proc, bool changed = true; } } - else if (mIns[0].mType == ASMIT_LDA && mIns[0].mMode == ASMIM_ZERO_PAGE) + else if (mIns[0].mType == ASMIT_LDA && mIns[0].mMode == ASMIM_ZERO_PAGE && !(mIns[0].mLive & LIVE_CPU_REG_Z)) { if (lblock->mIns[ls - 2].mType == ASMIT_LDA && lblock->mIns[ls - 2].mMode == ASMIM_ZERO_PAGE && lblock->mIns[ls - 2].mAddress == mIns[0].mAddress && lblock->mIns[ls - 1].mType == ASMIT_CMP) @@ -47412,6 +47412,7 @@ bool NativeCodeBasicBlock::PeepHoleOptimizerIterate6(int i, int pass) mIns[i + 0].mType = ASMIT_NOP; mIns[i + 0].mMode = ASMIM_IMPLIED; mIns[i + 1].mType = ASMIT_NOP; mIns[i + 1].mMode = ASMIM_IMPLIED; mIns[i + 2].mType = ASMIT_NOP; mIns[i + 2].mMode = ASMIM_IMPLIED; + mIns[i + 3].mLive |= LIVE_CPU_REG_C; mIns[i + 4].mType = ASMIT_ROL; mIns[i + 5].mType = ASMIT_NOP; mIns[i + 5].mMode = ASMIM_IMPLIED; return true; @@ -50685,7 +50686,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc) mInterProc = proc; mInterProc->mLinkerObject->mNativeProc = this; - CheckFunc = !strcmp(mInterProc->mIdent->mString, "test"); + CheckFunc = !strcmp(mInterProc->mIdent->mString, "intro_display"); int nblocks = proc->mBlocks.Size(); tblocks = new NativeCodeBasicBlock * [nblocks]; @@ -52496,7 +52497,6 @@ void NativeCodeProcedure::Optimize(void) else cnt++; - } while (changed); #if 1