mirror of
https://github.com/irmen/prog8.git
synced 2024-12-25 23:29:55 +00:00
swap isn't yet finished
This commit is contained in:
parent
3ee1b2efdd
commit
6c50043a4a
@ -272,9 +272,7 @@ class AstVm(val program: Program) {
|
||||
is BuiltinFunctionStatementPlaceholder -> {
|
||||
if(target.name=="swap") {
|
||||
// swap cannot be implemented as a function, so inline it here
|
||||
val a1 = (stmt.arglist[0] as IdentifierReference).targetVarDecl(program.namespace)!!
|
||||
val a2 = (stmt.arglist[1] as IdentifierReference).targetVarDecl(program.namespace)!!
|
||||
runtimeVariables.swap(a1, a2)
|
||||
executeSwap(sub, stmt)
|
||||
} else {
|
||||
val args = evaluate(stmt.arglist)
|
||||
functions.performBuiltinFunction(target.name, args, statusflags)
|
||||
@ -396,6 +394,15 @@ class AstVm(val program: Program) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun executeSwap(sub: INameScope, swap: FunctionCallStatement) {
|
||||
// TODO: can swap many different parameters.... in all combinations...
|
||||
println("TODO SWAP ${swap.arglist}")
|
||||
// val a1 = (swap.arglist[0] as IdentifierReference).targetVarDecl(program.namespace)!!
|
||||
// val a2 = (swap.arglist[1] as IdentifierReference).targetVarDecl(program.namespace)!!
|
||||
// runtimeVariables.swap(a1, a2)
|
||||
// TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
fun performAssignment(target: AssignTarget, value: RuntimeValue, contextStmt: IStatement, evalCtx: EvalContext) {
|
||||
when {
|
||||
target.identifier != null -> {
|
||||
|
@ -9,19 +9,14 @@
|
||||
ubyte[100] arr1
|
||||
ubyte[100] arr2
|
||||
|
||||
_lp:
|
||||
memcopy(arr1, arr2, len(arr2))
|
||||
c64scr.setcc(20,10,65,2)
|
||||
goto x
|
||||
c64scr.setcc(20,10,65,2)
|
||||
word w1 = 1111
|
||||
word w2 = 2222
|
||||
|
||||
swap(w1, w2)
|
||||
swap(A, Y)
|
||||
swap(arr1[10], arr2[20])
|
||||
swap(arr1[10], Y)
|
||||
swap(Y, arr2[10])
|
||||
swap(@($d020), @($d021))
|
||||
}
|
||||
|
||||
sub x() {
|
||||
|
||||
derp:
|
||||
c64scr.print("ey\n")
|
||||
goto derp
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user