From 8801a3e5e281e2db99957f5aadd3ed9da0706e11 Mon Sep 17 00:00:00 2001 From: Flight_Control Date: Wed, 16 Nov 2022 22:17:48 +0100 Subject: [PATCH] Fixing bugs: - far calls are now ALL iterated and flagged with a bank! - procedure objects are taken as the base for far call asm generation, not the call objects anymore (too tricky). But i have kept the call objects to be also updated with the bank for any reference later! --- .../dk/camelot64/kickc/passes/Pass4CodeGeneration.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java b/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java index ae20b378b..27ec2b462 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass4CodeGeneration.java @@ -867,8 +867,8 @@ public class Pass4CodeGeneration { } if(procedure.isDeclaredFar()) { // Generate ASM for a call (in a bank or other) - AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.farCallEntry(call.getBankFar(), call.getProcedure().getFullName(), program), program); - AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.farCallExit(call.getBankFar(), call.getProcedure().getFullName(), program), program); + AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.farCallEntry(procedure.getBankFar(), call.getProcedure().getFullName(), program), program); + AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.farCallExit(procedure.getBankFar(), call.getProcedure().getFullName(), program), program); // asm.addInstruction("jsr far", CpuAddressingMode.ABS, call.getProcedure().getFullName(), false); } else { asm.addInstruction("jsr", CpuAddressingMode.ABS, call.getProcedure().getFullName(), false); @@ -876,8 +876,8 @@ public class Pass4CodeGeneration { } else if (Procedure.CallingConvention.STACK_CALL.equals(procedure.getCallingConvention())) { if(procedure.isDeclaredFar()) { // Generate ASM for a far call (in a bank or other) - AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.farCallEntry(call.getBankFar(), call.getProcedure().getFullName(), program), program); - AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.farCallExit(call.getBankFar(), call.getProcedure().getFullName(), program), program); + AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.farCallEntry(procedure.getBankFar(), call.getProcedure().getFullName(), program), program); + AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.farCallExit(procedure.getBankFar(), call.getProcedure().getFullName(), program), program); } else { asm.addInstruction("jsr", CpuAddressingMode.ABS, call.getProcedure().getFullName(), false); }