mirror of
https://github.com/irmen/prog8.git
synced 2024-11-18 19:12:44 +00:00
fix wrong branch instructions for some if_xxx
This commit is contained in:
parent
8a504f8eee
commit
63332c0530
@ -814,12 +814,12 @@ internal class AsmGen(private val program: Program,
|
|||||||
when (condition) {
|
when (condition) {
|
||||||
BranchCondition.CS -> "bcc"
|
BranchCondition.CS -> "bcc"
|
||||||
BranchCondition.CC -> "bcs"
|
BranchCondition.CC -> "bcs"
|
||||||
BranchCondition.EQ, BranchCondition.Z -> "beq"
|
BranchCondition.EQ, BranchCondition.Z -> "bne"
|
||||||
BranchCondition.NE, BranchCondition.NZ -> "bne"
|
BranchCondition.NE, BranchCondition.NZ -> "beq"
|
||||||
BranchCondition.VS -> "bvc"
|
BranchCondition.VS -> "bvc"
|
||||||
BranchCondition.VC -> "bvs"
|
BranchCondition.VC -> "bvs"
|
||||||
BranchCondition.MI, BranchCondition.NEG -> "bmi"
|
BranchCondition.MI, BranchCondition.NEG -> "bpl"
|
||||||
BranchCondition.PL, BranchCondition.POS -> "bpl"
|
BranchCondition.PL, BranchCondition.POS -> "bmi"
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
when (condition) {
|
when (condition) {
|
||||||
@ -1071,7 +1071,7 @@ $counterVar .byte 0""")
|
|||||||
|
|
||||||
val jump = stmt.truepart.statements.first() as? Jump
|
val jump = stmt.truepart.statements.first() as? Jump
|
||||||
if(jump!=null) {
|
if(jump!=null) {
|
||||||
// branch with only a jump
|
// branch with only a jump (goto)
|
||||||
val instruction = branchInstruction(stmt.condition, false)
|
val instruction = branchInstruction(stmt.condition, false)
|
||||||
out(" $instruction ${getJumpTarget(jump)}")
|
out(" $instruction ${getJumpTarget(jump)}")
|
||||||
translate(stmt.elsepart)
|
translate(stmt.elsepart)
|
||||||
|
@ -8,6 +8,16 @@
|
|||||||
errors {
|
errors {
|
||||||
sub tofix() {
|
sub tofix() {
|
||||||
|
|
||||||
|
repeat {
|
||||||
|
ubyte char3 = c64.CHRIN()
|
||||||
|
if_z
|
||||||
|
goto labeltje
|
||||||
|
if_z
|
||||||
|
break ; TODO wrong jump asm generated, works fine if you use a label instead to jump to
|
||||||
|
}
|
||||||
|
labeltje:
|
||||||
|
|
||||||
|
|
||||||
while c64.CHRIN() {
|
while c64.CHRIN() {
|
||||||
; TODO: the loop condition isn't properly tested because a ldx is in the way before the beq
|
; TODO: the loop condition isn't properly tested because a ldx is in the way before the beq
|
||||||
}
|
}
|
||||||
@ -18,12 +28,6 @@ errors {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
repeat {
|
|
||||||
ubyte char3 = c64.CHRIN()
|
|
||||||
if_z
|
|
||||||
break ; TODO wrong jump asm generated, works fine if you use a label instead to jump to
|
|
||||||
}
|
|
||||||
|
|
||||||
; TODO fix undefined symbol:
|
; TODO fix undefined symbol:
|
||||||
repeat {
|
repeat {
|
||||||
ubyte char = c64.CHRIN()
|
ubyte char = c64.CHRIN()
|
||||||
@ -40,12 +44,7 @@ errors {
|
|||||||
|
|
||||||
main {
|
main {
|
||||||
sub start() {
|
sub start() {
|
||||||
function(&start)
|
errors.tofix()
|
||||||
test_stack.test()
|
test_stack.test()
|
||||||
}
|
}
|
||||||
|
|
||||||
sub function(uword param) {
|
|
||||||
txt.print_uwhex(param, 1)
|
|
||||||
param++
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user