1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-01-02 20:29:38 +00:00

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!
This commit is contained in:
Flight_Control 2022-11-16 22:17:48 +01:00
parent d7405d8669
commit 8801a3e5e2

View File

@ -867,8 +867,8 @@ public class Pass4CodeGeneration {
} }
if(procedure.isDeclaredFar()) { if(procedure.isDeclaredFar()) {
// Generate ASM for a call (in a bank or other) // 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.farCallEntry(procedure.getBankFar(), call.getProcedure().getFullName(), program), program);
AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.farCallExit(call.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); // asm.addInstruction("jsr far", CpuAddressingMode.ABS, call.getProcedure().getFullName(), false);
} else { } else {
asm.addInstruction("jsr", CpuAddressingMode.ABS, call.getProcedure().getFullName(), false); 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())) { } else if (Procedure.CallingConvention.STACK_CALL.equals(procedure.getCallingConvention())) {
if(procedure.isDeclaredFar()) { if(procedure.isDeclaredFar()) {
// Generate ASM for a far call (in a bank or other) // 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.farCallEntry(procedure.getBankFar(), call.getProcedure().getFullName(), program), program);
AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.farCallExit(call.getBankFar(), call.getProcedure().getFullName(), program), program); AsmFragmentCodeGenerator.generateAsm(asm, AsmFragmentInstanceSpecBuilder.farCallExit(procedure.getBankFar(), call.getProcedure().getFullName(), program), program);
} else { } else {
asm.addInstruction("jsr", CpuAddressingMode.ABS, call.getProcedure().getFullName(), false); asm.addInstruction("jsr", CpuAddressingMode.ABS, call.getProcedure().getFullName(), false);
} }