mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-02-11 01:30:53 +00:00
Renamed long branch fix label.
This commit is contained in:
parent
aec15a3125
commit
1feed93b43
@ -43,14 +43,13 @@ public class Pass5FixLongBranches extends Pass5AsmOptimization {
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform
|
||||
* @return
|
||||
* Detect if any branch distance is to long, and fix it by rewriting the branch if it is.
|
||||
* @return true if any branch was rewritten
|
||||
*/
|
||||
private boolean step() {
|
||||
// Reindex ASM lines
|
||||
new Pass5ReindexAsmLines(getProgram()).optimize();
|
||||
|
||||
|
||||
// Create a temporary directory for the ASM file
|
||||
try {
|
||||
tmpDir = Files.createTempDirectory("kickc");
|
||||
@ -68,7 +67,6 @@ public class Pass5FixLongBranches extends Pass5AsmOptimization {
|
||||
throw new CompileError("Error writing ASM temp file.", e);
|
||||
}
|
||||
|
||||
|
||||
// Compile using KickAssembler - catch the output in a String
|
||||
File asmFile = getTmpFile(fileName, ".asm");
|
||||
File asmPrgFile = getTmpFile(fileName, ".prg");
|
||||
@ -78,7 +76,7 @@ public class Pass5FixLongBranches extends Pass5AsmOptimization {
|
||||
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
|
||||
String output = kickAssOut.toString();
|
||||
|
||||
// Look for a long branch error
|
||||
// Look for a long branch distance error
|
||||
if(asmRes != 0) {
|
||||
String outputLines[] = output.split("\\r?\\n");
|
||||
for(int i = 0; i < outputLines.length; i++) {
|
||||
@ -126,11 +124,11 @@ public class Pass5FixLongBranches extends Pass5AsmOptimization {
|
||||
getLog().append("Fixing long branch ["+idx+"] "+asmLine.toString() + " to "+inverseType.getMnemnonic());
|
||||
String branchDest = asmInstruction.getParameter();
|
||||
asmInstruction.setType(inverseType);
|
||||
asmInstruction.setParameter("!b+");
|
||||
asmInstruction.setParameter("!"+branchDest+"+");
|
||||
AsmInstructionType jmpType = AsmInstructionSet.getInstructionType("jmp", AsmAddressingMode.ABS, false);
|
||||
AsmInstruction jmpInstruction = new AsmInstruction(jmpType, branchDest);
|
||||
asmSegment.addLineAfter(asmInstruction, jmpInstruction);
|
||||
asmSegment.addLineAfter(jmpInstruction, new AsmLabel("!b"));
|
||||
asmSegment.addLineAfter(jmpInstruction, new AsmLabel("!"+branchDest));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -126,15 +126,15 @@ main: {
|
||||
!:
|
||||
lda chargen+1
|
||||
cmp #>CHARGEN+$800
|
||||
bcs !b+
|
||||
bcs !b1+
|
||||
jmp b1
|
||||
!b:
|
||||
!b1:
|
||||
bne !+
|
||||
lda chargen
|
||||
cmp #<CHARGEN+$800
|
||||
bcs !b+
|
||||
bcs !b1+
|
||||
jmp b1
|
||||
!b:
|
||||
!b1:
|
||||
!:
|
||||
lda #$37
|
||||
sta PROCPORT
|
||||
|
@ -2495,15 +2495,15 @@ main: {
|
||||
//SEG76 [51] if((byte*) main::chargen#1<(const byte*) CHARGEN#0+(word/signed word/dword/signed dword) 2048) goto main::@1 [ main::chargen#1 main::charset4#1 ] ( main:2 [ main::chargen#1 main::charset4#1 ] ) -- pbuz1_lt_pbuc1_then_la1
|
||||
lda chargen+1
|
||||
cmp #>CHARGEN+$800
|
||||
bcs !b+
|
||||
bcs !b1+
|
||||
jmp b1
|
||||
!b:
|
||||
!b1:
|
||||
bne !+
|
||||
lda chargen
|
||||
cmp #<CHARGEN+$800
|
||||
bcs !b+
|
||||
bcs !b1+
|
||||
jmp b1
|
||||
!b:
|
||||
!b1:
|
||||
!:
|
||||
//SEG77 main::@11
|
||||
//SEG78 [52] *((const byte*) PROCPORT#0) ← (byte/signed byte/word/signed word/dword/signed dword) 55 [ ] ( main:2 [ ] ) -- _deref_pbuc1=vbuc2
|
||||
|
@ -266,8 +266,8 @@ main: {
|
||||
sta SCREEN,x
|
||||
inx
|
||||
cpx #$b
|
||||
beq !b+
|
||||
beq !b1+
|
||||
jmp b1
|
||||
!b:
|
||||
!b1:
|
||||
rts
|
||||
}
|
||||
|
@ -1423,9 +1423,9 @@ main: {
|
||||
inx
|
||||
//SEG18 [9] if((byte) main::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 [ main::i#1 ] ( main:2 [ main::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1
|
||||
cpx #$b
|
||||
beq !b+
|
||||
beq !b1+
|
||||
jmp b1
|
||||
!b:
|
||||
!b1:
|
||||
//SEG19 main::@return
|
||||
//SEG20 [10] return [ ] ( main:2 [ ] )
|
||||
rts
|
||||
|
@ -271,9 +271,9 @@ long2: {
|
||||
sta SCREEN,x
|
||||
inx
|
||||
cpx #$b
|
||||
beq !b+
|
||||
beq !b1+
|
||||
jmp b1
|
||||
!b:
|
||||
!b1:
|
||||
rts
|
||||
}
|
||||
long1: {
|
||||
@ -540,8 +540,8 @@ long1: {
|
||||
sta SCREEN,x
|
||||
inx
|
||||
cpx #$b
|
||||
beq !b+
|
||||
beq !b1+
|
||||
jmp b1
|
||||
!b:
|
||||
!b1:
|
||||
rts
|
||||
}
|
||||
|
@ -2526,9 +2526,9 @@ long2: {
|
||||
inx
|
||||
//SEG27 [14] if((byte) long2::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto long2::@1 [ long2::i#1 ] ( main:2::long2:7 [ long2::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1
|
||||
cpx #$b
|
||||
beq !b+
|
||||
beq !b1+
|
||||
jmp b1
|
||||
!b:
|
||||
!b1:
|
||||
//SEG28 long2::@return
|
||||
//SEG29 [15] return [ ] ( main:2::long2:7 [ ] )
|
||||
rts
|
||||
@ -2807,9 +2807,9 @@ long1: {
|
||||
inx
|
||||
//SEG39 [21] if((byte) long1::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto long1::@1 [ long1::i#1 ] ( main:2::long1:5 [ long1::i#1 ] ) -- vbuxx_neq_vbuc1_then_la1
|
||||
cpx #$b
|
||||
beq !b+
|
||||
beq !b1+
|
||||
jmp b1
|
||||
!b:
|
||||
!b1:
|
||||
//SEG40 long1::@return
|
||||
//SEG41 [22] return [ ] ( main:2::long1:5 [ ] )
|
||||
rts
|
||||
|
@ -76,9 +76,9 @@ test_16u: {
|
||||
adc i
|
||||
sta i
|
||||
cmp #$c
|
||||
beq !b+
|
||||
beq !b1+
|
||||
jmp b1
|
||||
!b:
|
||||
!b1:
|
||||
rts
|
||||
str: .text " / @"
|
||||
str1: .text " = @"
|
||||
|
@ -5815,9 +5815,9 @@ test_16u: {
|
||||
sta i
|
||||
//SEG84 [38] if((byte) test_16u::i#1!=(byte/signed byte/word/signed word/dword/signed dword) 12) goto test_16u::@1 [ test_16u::i#1 div16u::rem#8 line_cursor#1 ] ( main:2::test_16u:9 [ test_16u::i#1 div16u::rem#8 line_cursor#1 ] ) -- vbuz1_neq_vbuc1_then_la1
|
||||
cmp #$c
|
||||
beq !b+
|
||||
beq !b1+
|
||||
jmp b1
|
||||
!b:
|
||||
!b1:
|
||||
//SEG85 test_16u::@return
|
||||
//SEG86 [39] return [ ] ( main:2::test_16u:9 [ ] )
|
||||
rts
|
||||
|
Loading…
x
Reference in New Issue
Block a user