From e6bc6371c97922e3c517e621fcd67b0856e454f3 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Wed, 19 Mar 2025 17:16:20 +0100 Subject: [PATCH] Fix PET target zero page variable range --- oscar64/Compiler.cpp | 2 ++ oscar64/NativeCodeGenerator.cpp | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/oscar64/Compiler.cpp b/oscar64/Compiler.cpp index 1e76451..9820b48 100644 --- a/oscar64/Compiler.cpp +++ b/oscar64/Compiler.cpp @@ -508,6 +508,8 @@ bool Compiler::GenerateCode(void) regionZeroPage = mLinker->AddRegion(identZeroPage, 0x00e0, 0x00ff); else if (mCompilerOptions & (COPT_EXTENDED_ZERO_PAGE | COPT_TARGET_NES)) regionZeroPage = mLinker->AddRegion(identZeroPage, 0x0080, 0x00ff); + else if (mTargetMachine == TMACH_PET_8K || mTargetMachine == TMACH_PET_16K || mTargetMachine == TMACH_PET_32K) + regionZeroPage = mLinker->AddRegion(identZeroPage, 0x00ed, 0x00f7); else regionZeroPage = mLinker->AddRegion(identZeroPage, 0x00f7, 0x00ff); } diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index f914941..4e40473 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -14347,12 +14347,13 @@ void NativeCodeBasicBlock::CallAssembler(InterCodeProcedure* proc, NativeCodePro if (dins.mFlags & NCIF_VOLATILE) simple = false; - if (dins.mMode == ASMIM_ZERO_PAGE && dins.mAddress >= BC_REG_WORK && dins.mAddress < BC_REG_WORK + 8) - uflags |= NICF_USE_WORKREGS; - - // Make sure we are not aliasing zeropage globals - if (dins.mMode == ASMIM_ZERO_PAGE && dins.mLinkerObject) - dins.mMode = ASMIM_ABSOLUTE; + if (dins.mMode == ASMIM_ZERO_PAGE) + { + if (dins.mAddress >= BC_REG_WORK && dins.mAddress < BC_REG_WORK + 8) + uflags |= NICF_USE_WORKREGS; + else if (dins.mLinkerObject) + dins.mMode = ASMIM_ABSOLUTE; // Make sure we are not aliasing zeropage globals + } if (dins.ChangesAccu()) uflags |= NCIF_USE_CPU_REG_A;