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) {
|
||||
BranchCondition.CS -> "bcc"
|
||||
BranchCondition.CC -> "bcs"
|
||||
BranchCondition.EQ, BranchCondition.Z -> "beq"
|
||||
BranchCondition.NE, BranchCondition.NZ -> "bne"
|
||||
BranchCondition.EQ, BranchCondition.Z -> "bne"
|
||||
BranchCondition.NE, BranchCondition.NZ -> "beq"
|
||||
BranchCondition.VS -> "bvc"
|
||||
BranchCondition.VC -> "bvs"
|
||||
BranchCondition.MI, BranchCondition.NEG -> "bmi"
|
||||
BranchCondition.PL, BranchCondition.POS -> "bpl"
|
||||
BranchCondition.MI, BranchCondition.NEG -> "bpl"
|
||||
BranchCondition.PL, BranchCondition.POS -> "bmi"
|
||||
}
|
||||
} else {
|
||||
when (condition) {
|
||||
@ -1071,7 +1071,7 @@ $counterVar .byte 0""")
|
||||
|
||||
val jump = stmt.truepart.statements.first() as? Jump
|
||||
if(jump!=null) {
|
||||
// branch with only a jump
|
||||
// branch with only a jump (goto)
|
||||
val instruction = branchInstruction(stmt.condition, false)
|
||||
out(" $instruction ${getJumpTarget(jump)}")
|
||||
translate(stmt.elsepart)
|
||||
|
@ -8,6 +8,16 @@
|
||||
errors {
|
||||
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() {
|
||||
; TODO: the loop condition isn't properly tested because a ldx is in the way before the beq
|
||||
}
|
||||
@ -18,12 +28,6 @@ errors {
|
||||
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:
|
||||
repeat {
|
||||
ubyte char = c64.CHRIN()
|
||||
@ -40,12 +44,7 @@ errors {
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
function(&start)
|
||||
errors.tofix()
|
||||
test_stack.test()
|
||||
}
|
||||
|
||||
sub function(uword param) {
|
||||
txt.print_uwhex(param, 1)
|
||||
param++
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user