From cc81d6fe82c0e0531a7c2b696774e37923f2817f Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Wed, 22 Mar 2023 00:51:58 +0100 Subject: [PATCH] remove traces of ** operator --- .../cpu6502/assignment/AugmentableAssignmentAsmGen.kt | 11 ----------- docs/source/libraries.rst | 2 +- docs/source/syntaxreference.rst | 2 +- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AugmentableAssignmentAsmGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AugmentableAssignmentAsmGen.kt index d930fb117..fd24a3198 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AugmentableAssignmentAsmGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AugmentableAssignmentAsmGen.kt @@ -307,7 +307,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram, asmgen.assignExpressionToVariable(value, "P8ZP_SCRATCH_B1", DataType.UBYTE) val sourceName = asmgen.loadByteFromPointerIntoA(pointervar) when (operator) { - // note: ** (power) operator requires floats. "+" -> asmgen.out(" clc | adc P8ZP_SCRATCH_B1") "-" -> asmgen.out(" sec | sbc P8ZP_SCRATCH_B1") "*" -> asmgen.out(" ldy P8ZP_SCRATCH_B1 | jsr math.multiply_bytes") @@ -344,7 +343,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram, val sourceName = asmgen.loadByteFromPointerIntoA(pointervar) when (operator) { - // note: ** (power) operator requires floats. "+" -> asmgen.out(" clc | adc $otherName") "-" -> asmgen.out(" sec | sbc $otherName") "*" -> asmgen.out(" ldy $otherName | jsr math.multiply_bytes") @@ -378,7 +376,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram, private fun inplaceModification_byte_litval_to_pointer(pointervar: PtIdentifier, operator: String, value: Int) { when (operator) { - // note: ** (power) operator requires floats. "+" -> { val sourceName = asmgen.loadByteFromPointerIntoA(pointervar) asmgen.out(" clc | adc #$value") @@ -448,7 +445,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram, // this should be the last resort for code generation for this, // because the value is evaluated onto the eval stack (=slow). when (operator) { - // note: ** (power) operator requires floats. "+" -> { asmgen.assignExpressionToRegister(value, RegisterOrPair.A) asmgen.out(" clc | adc $name | sta $name") @@ -542,7 +538,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram, private fun inplaceModification_byte_variable_to_variable(name: String, dt: DataType, operator: String, ident: PtIdentifier) { val otherName = asmgen.asmVariableName(ident) when (operator) { - // note: ** (power) operator requires floats. "+" -> asmgen.out(" lda $name | clc | adc $otherName | sta $name") "-" -> asmgen.out(" lda $name | sec | sbc $otherName | sta $name") "*" -> asmgen.out(" lda $name | ldy $otherName | jsr math.multiply_bytes | sta $name") @@ -618,7 +613,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram, private fun inplaceModification_byte_litval_to_variable(name: String, dt: DataType, operator: String, value: Int) { when (operator) { - // note: ** (power) operator requires floats. "+" -> asmgen.out(" lda $name | clc | adc #$value | sta $name") "-" -> asmgen.out(" lda $name | sec | sbc #$value | sta $name") "*" -> { @@ -795,7 +789,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram, private fun inplaceModification_word_litval_to_variable(name: String, dt: DataType, operator: String, value: Int) { when (operator) { - // note: ** (power) operator requires floats. "+" -> { when { value==0 -> {} @@ -1062,7 +1055,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram, in ByteDatatypes -> { // the other variable is a BYTE type so optimize for that when (operator) { - // note: ** (power) operator requires floats. "+" -> { if(valueDt==DataType.UBYTE) asmgen.out(""" @@ -1225,7 +1217,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram, in WordDatatypes -> { // the value is a proper 16-bit word, so use both bytes of it. when (operator) { - // note: ** (power) operator requires floats. "+" -> asmgen.out(" lda $name | clc | adc $otherName | sta $name | lda $name+1 | adc $otherName+1 | sta $name+1") "-" -> asmgen.out(" lda $name | sec | sbc $otherName | sta $name | lda $name+1 | sbc $otherName+1 | sta $name+1") "*" -> { @@ -1359,7 +1350,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram, in ByteDatatypes -> { // the other variable is a BYTE type so optimize for that when (operator) { - // note: ** (power) operator requires floats. "+" -> { asmgen.assignExpressionToVariable(value, "P8ZP_SCRATCH_B1", valueDt) if(valueDt==DataType.UBYTE) @@ -1485,7 +1475,6 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram, in WordDatatypes -> { // the value is a proper 16-bit word, so use both bytes of it. when (operator) { - // note: ** (power) operator requires floats. "+" -> { asmgen.assignExpressionToRegister(value, RegisterOrPair.AY) asmgen.out(" clc | adc $name | sta $name | tya | adc $name+1 | sta $name+1") diff --git a/docs/source/libraries.rst b/docs/source/libraries.rst index 83a76005a..e53a4521d 100644 --- a/docs/source/libraries.rst +++ b/docs/source/libraries.rst @@ -255,7 +255,7 @@ sin(x) sqrt(x) Floating point Square root. - To do the reverse, squaring a floating point number, just write ``x*x`` or ``x**2``. + To do the reverse, squaring a floating point number, just write ``x*x``. tan(x) Tangent. diff --git a/docs/source/syntaxreference.rst b/docs/source/syntaxreference.rst index 174ae061c..49d803012 100644 --- a/docs/source/syntaxreference.rst +++ b/docs/source/syntaxreference.rst @@ -487,7 +487,7 @@ assignment: ``=`` Sets the target on the LHS (left hand side) of the operator to the value of the expression on the RHS (right hand side). Note that an assignment sometimes is not possible or supported. -augmented assignment: ``+=`` ``-=`` ``*=`` ``/=`` ``**=`` ``&=`` ``|=`` ``^=`` ``<<=`` ``>>=`` +augmented assignment: ``+=`` ``-=`` ``*=`` ``/=`` ``&=`` ``|=`` ``^=`` ``<<=`` ``>>=`` This is syntactic sugar; ``aa += xx`` is equivalent to ``aa = aa + xx`` postfix increment and decrement: ``++`` ``--``