mirror of
https://github.com/irmen/prog8.git
synced 2024-12-27 05:29:38 +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 Continue -> throw LoopControlContinue()
|
||||
is Break -> throw LoopControlBreak()
|
||||
@ -339,7 +336,15 @@ class AstVm(val program: Program) {
|
||||
executeAnonymousScope(stmt.elsepart)
|
||||
}
|
||||
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 -> {
|
||||
val iterable = evaluate(stmt.iterable, evalCtx)
|
||||
|
@ -18,6 +18,21 @@
|
||||
|
||||
word w1 = 1111
|
||||
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
|
||||
mw1 = 65535
|
||||
|
Loading…
Reference in New Issue
Block a user