diff --git a/codeAst/src/prog8/code/ast/AstStatements.kt b/codeAst/src/prog8/code/ast/AstStatements.kt index 56a628bcd..bf851bc19 100644 --- a/codeAst/src/prog8/code/ast/AstStatements.kt +++ b/codeAst/src/prog8/code/ast/AstStatements.kt @@ -60,7 +60,7 @@ class PtAssignTarget(position: Position) : PtNode(position) { get() { return when(val tgt = children.single()) { is PtIdentifier -> tgt.type - is PtArrayIndexer -> tgt.type // TODO array to elt type? + is PtArrayIndexer -> tgt.type is PtMemoryByte -> tgt.type else -> throw AssemblyError("weird target $tgt") } diff --git a/compiler/src/prog8/compiler/Compiler.kt b/compiler/src/prog8/compiler/Compiler.kt index a883daf92..25bd80bfd 100644 --- a/compiler/src/prog8/compiler/Compiler.kt +++ b/compiler/src/prog8/compiler/Compiler.kt @@ -388,8 +388,8 @@ private fun createAssemblyAndAssemble(program: Program, // to help clean up the code that still depends on them. // removeAllVardeclsFromAst(program) - println("*********** AST RIGHT BEFORE ASM GENERATION *************") - printProgram(program) +// println("*********** AST RIGHT BEFORE ASM GENERATION *************") +// printProgram(program) val assembly = asmGeneratorFor(program, errors, symbolTable, compilerOptions).compileToAssembly() errors.report() diff --git a/docs/source/programming.rst b/docs/source/programming.rst index a577f9a6c..ba5e28d04 100644 --- a/docs/source/programming.rst +++ b/docs/source/programming.rst @@ -841,11 +841,13 @@ rol(x) while the highest bit will become the new Carry flag value. (essentially, it is a 9-bit or 17-bit rotation) Modifies in-place, doesn't return a value (so can't be used in an expression). + You can rol a memory location directly by using the direct memory access syntax, so like ``rol(@($5000))`` rol2(x) Like ``rol`` but now as 8-bit or 16-bit rotation. It uses some extra logic to not consider the carry flag as extra rotation bit. Modifies in-place, doesn't return a value (so can't be used in an expression). + You can rol a memory location directly by using the direct memory access syntax, so like ``rol2(@($5000))`` ror(x) Rotate the bits in x (byte or word) one position to the right. @@ -853,11 +855,13 @@ ror(x) while bit 0 will become the new Carry flag value. (essentially, it is a 9-bit or 17-bit rotation) Modifies in-place, doesn't return a value (so can't be used in an expression). + You can ror a memory location directly by using the direct memory access syntax, so like ``ror(@($5000))`` ror2(x) Like ``ror`` but now as 8-bit or 16-bit rotation. It uses some extra logic to not consider the carry flag as extra rotation bit. Modifies in-place, doesn't return a value (so can't be used in an expression). + You can ror a memory location directly by using the direct memory access syntax, so like ``ror2(@($5000))`` sizeof(name) Number of bytes that the object 'name' occupies in memory. This is a constant determined by the data type of @@ -867,6 +871,7 @@ sizeof(name) swap(x, y) Swap the values of numerical variables (or memory locations) x and y in a fast way. + You can swap two memory locations directly by using the direct memory access syntax, so like ``swap(@($5000), @($5001))`` memory(name, size, alignment) Returns the address of the first location of a statically "reserved" block of memory of the given size in bytes, diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 899061144..8e48af706 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,10 +3,8 @@ TODO For next release ^^^^^^^^^^^^^^^^ -- vm: check array type in PtAssignTarget - vm: animals example game breaks after adding first new animal... - vm: add more instructions operating directly on memory instead of only registers? (translate assignment self-assigns) -- in-place modifiying functions (rol, ror, ..) don't accept a memory address but require a memory-read expression. that is weird. - complete the Inliner - add McCarthy evaluation to shortcircuit and/or expressions. First do ifs by splitting them up? Then do expressions that compute a value?