From 277afd156db6d8dacce94af8b7abc4df8d52e829 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Sun, 16 Jun 2024 09:01:36 +0200 Subject: [PATCH] Fix over eager const pointer forwarding --- include/c64/iecbus.c | 1 + oscar64/Declaration.cpp | 4 +++- oscar64/InterCode.cpp | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/c64/iecbus.c b/include/c64/iecbus.c index a5b9e97..f729d0d 100644 --- a/include/c64/iecbus.c +++ b/include/c64/iecbus.c @@ -239,6 +239,7 @@ void iec_talk(char dev, char sec) iec_atn(dev | 0x40, sec | 0x60); clock_true(); + data_false(); delay(10); } diff --git a/oscar64/Declaration.cpp b/oscar64/Declaration.cpp index 011952b..643d493 100644 --- a/oscar64/Declaration.cpp +++ b/oscar64/Declaration.cpp @@ -964,7 +964,9 @@ Expression* Expression::ConstantFold(Errors * errors, LinkerSection * dataSectio ex->mDecType = mLeft->mDecType; return ex; } - else if (mType == EX_BINARY && mToken == TK_ADD && mLeft->mType == EX_VARIABLE && mLeft->mDecValue->mType == DT_VARIABLE && (mLeft->mDecValue->mFlags & DTF_CONST) && mLeft->mDecType->mType == DT_TYPE_POINTER && mRight->mType == EX_CONSTANT && mRight->mDecValue->mType == DT_CONST_INTEGER) + else if (mType == EX_BINARY && mToken == TK_ADD && mLeft->mType == EX_VARIABLE && mLeft->mDecValue->mType == DT_VARIABLE && (mLeft->mDecValue->mFlags & DTF_CONST) && + mLeft->mDecValue->mValue->mType == EX_CONSTANT && + mLeft->mDecType->mType == DT_TYPE_POINTER && mRight->mType == EX_CONSTANT && mRight->mDecValue->mType == DT_CONST_INTEGER) { mLeft = mLeft->mDecValue->mValue; return this->ConstantFold(errors, dataSection); diff --git a/oscar64/InterCode.cpp b/oscar64/InterCode.cpp index 87e8b9c..a18b826 100644 --- a/oscar64/InterCode.cpp +++ b/oscar64/InterCode.cpp @@ -21016,7 +21016,7 @@ void InterCodeProcedure::Close(void) { GrowingTypeArray tstack(IT_NONE); - CheckFunc = !strcmp(mIdent->mString, "main"); + CheckFunc = !strcmp(mIdent->mString, "__drawScreen__"); CheckCase = false; mEntryBlock = mBlocks[0];