mirror of
https://github.com/irmen/prog8.git
synced 2025-01-30 00:31:00 +00:00
branch
This commit is contained in:
parent
267c678292
commit
a3004555a8
@ -285,9 +285,6 @@ class AstVm(val program: Program) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is BuiltinFunctionStatementPlaceholder -> {
|
|
||||||
TODO("builtinfun $stmt")
|
|
||||||
}
|
|
||||||
is Return -> throw LoopControlReturn(stmt.values.map { evaluate(it, evalCtx) })
|
is Return -> throw LoopControlReturn(stmt.values.map { evaluate(it, evalCtx) })
|
||||||
is Continue -> throw LoopControlContinue()
|
is Continue -> throw LoopControlContinue()
|
||||||
is Break -> throw LoopControlBreak()
|
is Break -> throw LoopControlBreak()
|
||||||
@ -339,7 +336,15 @@ class AstVm(val program: Program) {
|
|||||||
executeAnonymousScope(stmt.elsepart)
|
executeAnonymousScope(stmt.elsepart)
|
||||||
}
|
}
|
||||||
is BranchStatement -> {
|
is BranchStatement -> {
|
||||||
TODO("branch $stmt")
|
when(stmt.condition) {
|
||||||
|
BranchCondition.CS -> if(statusflags.carry) executeAnonymousScope(stmt.truepart) else executeAnonymousScope(stmt.elsepart)
|
||||||
|
BranchCondition.CC -> if(!statusflags.carry) executeAnonymousScope(stmt.truepart) else executeAnonymousScope(stmt.elsepart)
|
||||||
|
BranchCondition.EQ, BranchCondition.Z -> if(statusflags.zero) executeAnonymousScope(stmt.truepart) else executeAnonymousScope(stmt.elsepart)
|
||||||
|
BranchCondition.NE, BranchCondition.NZ -> if(statusflags.zero) executeAnonymousScope(stmt.truepart) else executeAnonymousScope(stmt.elsepart)
|
||||||
|
BranchCondition.MI, BranchCondition.NEG -> if(statusflags.negative) executeAnonymousScope(stmt.truepart) else executeAnonymousScope(stmt.elsepart)
|
||||||
|
BranchCondition.PL, BranchCondition.POS -> if(statusflags.negative) executeAnonymousScope(stmt.truepart) else executeAnonymousScope(stmt.elsepart)
|
||||||
|
BranchCondition.VS, BranchCondition.VC -> TODO("overflow status")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
is ForLoop -> {
|
is ForLoop -> {
|
||||||
val iterable = evaluate(stmt.iterable, evalCtx)
|
val iterable = evaluate(stmt.iterable, evalCtx)
|
||||||
|
@ -18,6 +18,21 @@
|
|||||||
|
|
||||||
word w1 = 1111
|
word w1 = 1111
|
||||||
word w2 = 2222
|
word w2 = 2222
|
||||||
|
sum(arr2)
|
||||||
|
|
||||||
|
if_cc goto start
|
||||||
|
if_cs goto start
|
||||||
|
if_eq goto start
|
||||||
|
if_mi goto start
|
||||||
|
if_ne goto start
|
||||||
|
if_neg goto start
|
||||||
|
if_nz goto start
|
||||||
|
if_pl goto start
|
||||||
|
if_pos goto start
|
||||||
|
if_vc goto start
|
||||||
|
if_vs goto start
|
||||||
|
if_z goto start
|
||||||
|
|
||||||
|
|
||||||
m1 = 0
|
m1 = 0
|
||||||
mw1 = 65535
|
mw1 = 65535
|
||||||
|
Loading…
x
Reference in New Issue
Block a user