From e5805716e2ac5b89aa8dacf94a662437b102696a Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Sat, 15 Apr 2023 21:53:33 +0200 Subject: [PATCH] Fix propagation of volatile flags --- include/conio.c | 7 +++++++ include/stdio.c | 10 +++++++--- oscar64/NativeCodeGenerator.cpp | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/conio.c b/include/conio.c index 74226d0..afc8e1a 100644 --- a/include/conio.c +++ b/include/conio.c @@ -163,8 +163,15 @@ __asm getpch cpx #IOCHM_PETSCII_1 bcc w3 + cmp #219 + bcs w3 cmp #65 bcc w3 + + cmp #193 + bcc w4 + eor #$a0 + w4: cmp #123 bcs w3 cmp #97 diff --git a/include/stdio.c b/include/stdio.c index b26a753..7b41fb3 100644 --- a/include/stdio.c +++ b/include/stdio.c @@ -158,8 +158,15 @@ __asm getpch cpx #IOCHM_PETSCII_1 bcc w3 + cmp #219 + bcs w3 cmp #65 bcc w3 + + cmp #193 + bcc w4 + eor #$a0 + w4: cmp #123 bcs w3 cmp #97 @@ -800,9 +807,6 @@ static const char * scanpat(const char * fmt, char * mask) } while (fc && fc != ']'); - if (fc == ']') - fmt++; - if (negated) { for(char i=4; i<32; i++) diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index c6456f1..a85d6f2 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -33623,7 +33623,7 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(NativeCodeProcedure* proc, int pass } else if ( mIns[i + 0].ChangesAccuAndFlag() && - mIns[i + 1].mType == ASMIT_STA && mIns[i + 2].mType == ASMIT_LDA && + mIns[i + 1].mType == ASMIT_STA && mIns[i + 2].mType == ASMIT_LDA && !(mIns[i + 2].mFlags & NCIF_VOLATILE) && mIns[i + 1].SameEffectiveAddress(mIns[i + 2])) { mIns[i + 0].mLive |= mIns[i + 2].mLive & (LIVE_CPU_REG_A | LIVE_CPU_REG_Z);