diff --git a/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AugmentableAssignmentAsmGen.kt b/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AugmentableAssignmentAsmGen.kt index b593feade..c342ae58b 100644 --- a/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AugmentableAssignmentAsmGen.kt +++ b/codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AugmentableAssignmentAsmGen.kt @@ -2744,16 +2744,23 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram, val constValueName = allocator.getFloatAsmConst(value) when (operator) { "+" -> { - if (value == 0.0) - return - asmgen.out(""" - lda #<$name - ldy #>$name - jsr floats.MOVFM - lda #<$constValueName - ldy #>$constValueName - jsr floats.FADD - """) + when (value) { + 0.0 -> return + 0.5 -> asmgen.out(""" + lda #<$name + ldy #>$name + jsr floats.MOVFM + jsr floats.FADDH + """) + else -> asmgen.out(""" + lda #<$name + ldy #>$name + jsr floats.MOVFM + lda #<$constValueName + ldy #>$constValueName + jsr floats.FADD + """) + } } "-" -> { if (value == 0.0) @@ -2769,14 +2776,23 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram, } "*" -> { // assume that code optimization is already done on the AST level for special cases such as 0, 1, 2... - asmgen.out(""" - lda #<$name - ldy #>$name - jsr floats.MOVFM - lda #<$constValueName - ldy #>$constValueName - jsr floats.FMULT - """) + if(value==10.0) { + asmgen.out(""" + lda #<$name + ldy #>$name + jsr floats.MOVFM + jsr floats.MUL10 + """) + } else { + asmgen.out(""" + lda #<$name + ldy #>$name + jsr floats.MOVFM + lda #<$constValueName + ldy #>$constValueName + jsr floats.FMULT + """) + } } "/" -> { if (value == 0.0) diff --git a/compiler/res/prog8lib/c64/floats.p8 b/compiler/res/prog8lib/c64/floats.p8 index 33fa574e8..4dc6d7550 100644 --- a/compiler/res/prog8lib/c64/floats.p8 +++ b/compiler/res/prog8lib/c64/floats.p8 @@ -53,7 +53,7 @@ romsub $bddd = FOUT() clobbers(X) -> uword @ AY ; fac1 -> string, ad romsub $b849 = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT romsub $bae2 = MUL10() clobbers(A,X,Y) ; fac1 *= 10 -romsub $bafe = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! +romsub $bafe = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! You have to fix sign manually! romsub $bc5b = FCOMP(uword mflpt @ AY) clobbers(X,Y) -> ubyte @ A ; A = compare fac1 to mflpt in A/Y, 0=equal 1=fac1 is greater, 255=fac1 is less than romsub $b86a = FADDT() clobbers(A,X,Y) ; fac1 += fac2 diff --git a/docs/source/software.rst b/docs/source/software.rst index a2b4a554b..1b5504d71 100644 --- a/docs/source/software.rst +++ b/docs/source/software.rst @@ -15,7 +15,10 @@ there are also larger pieces of software written using Prog8. Here's a list. `Image viewer `_ Multi-format image viewer for the Commander X16. - Can display C64 Koala, BMP, PCX and Amiga IFF images, including color cycling. + Can display cx16 BMX, C64 Koala, C64 Doodle, BMP, PCX and Amiga IFF images, including color cycling. + +`Paint program `_ + Bitmap image paint program for the Commander X16, work in progress. `Petaxian `_ Galaga type shoot em up game using only petscii graphics. Runs on C64 and Commander X16. diff --git a/docs/source/todo.rst b/docs/source/todo.rst index adb93736d..f17f81e26 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -2,8 +2,6 @@ TODO ==== -- add more projects such as Paint to the Software written in Prog8 list - - [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 .... ... @@ -80,6 +78,7 @@ What if we were to re-introduce Structs in prog8? Some thoughts: Other language/syntax features to think about --------------------------------------------- +- module directive to set the text encoding for that whole file (iso, petscii, etc.) - chained assignments `x=y=z=99` - declare multiple variables `ubyte x,y,z` (if init value present, all get that init value) - chained comparisons `10