From c66734bab0804f5e1767252b61217926b8207d75 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Mon, 20 Mar 2023 23:25:28 +0100 Subject: [PATCH] fix cx16 ubyte to float cast (wrong rom routine) --- compiler/res/prog8lib/c128/floats.p8 | 8 ++++---- compiler/res/prog8lib/cx16/floats.p8 | 6 +++--- docs/source/todo.rst | 1 - 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/compiler/res/prog8lib/c128/floats.p8 b/compiler/res/prog8lib/c128/floats.p8 index a93fd57d1..993534ef1 100644 --- a/compiler/res/prog8lib/c128/floats.p8 +++ b/compiler/res/prog8lib/c128/floats.p8 @@ -66,7 +66,7 @@ romsub $af66 = MOVMF(uword mflpt @ XY) clobbers(A,X,Y) ; store fac1 to memo romsub $af69 = MOVFA() clobbers(A,X) ; copy fac2 to fac1 romsub $af6c = MOVAF() clobbers(A,X) ; copy fac1 to fac2 (rounded) -; X16 additions +; X16 additions TODO so.... not on c128 !? romsub $af6f = FADDH() clobbers(A,X,Y) ; fac1 += 0.5, for rounding- call this before INT romsub $af72 = FADDT2() clobbers(A,X,Y) ; fac1 += fac2 romsub $af75 = ZEROFC() clobbers(A,X,Y) ; fac1 = 0 @@ -78,7 +78,7 @@ romsub $af84 = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTI romsub $af87 = FDIVT2() clobbers(A,X,Y) ; fac1 = fac2/fac1 (remainder in fac2) mind the order of the operands romsub $af8a = MOVEF() clobbers(A,X) ; copy fac1 to fac2 romsub $af8d = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) -romsub $af90 = FLOAT() clobbers(A,X,Y) ; FAC = (u8).A +romsub $af90 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A romsub $af93 = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho romsub $af9C = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) romsub $af9f = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A @@ -134,8 +134,8 @@ asmsub GETADRAY () clobbers(X) -> uword @ AY { asmsub FREADUY (ubyte value @Y) { ; -- 8 bit unsigned Y -> float in fac1 %asm {{ - tya - jmp FLOAT + lda #0 + jmp GIVAYF }} } diff --git a/compiler/res/prog8lib/cx16/floats.p8 b/compiler/res/prog8lib/cx16/floats.p8 index b727eff27..a97b23347 100644 --- a/compiler/res/prog8lib/cx16/floats.p8 +++ b/compiler/res/prog8lib/cx16/floats.p8 @@ -76,7 +76,7 @@ romsub $fe7b = MUL10() clobbers(A,X,Y) ; fac1 *= 10 romsub $fe7e = DIV10() clobbers(A,X,Y) ; fac1 /= 10 , CAUTION: result is always positive! romsub $fe81 = MOVEF() clobbers(A,X) ; copy fac1 to fac2 romsub $fe84 = SGN() clobbers(A,X,Y) ; fac1 = SGN(fac1), result of SIGN (-1, 0 or 1) -romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (u8).A +romsub $fe87 = FLOAT() clobbers(A,X,Y) ; FAC = (s8).A romsub $fe8a = FLOATS() clobbers(A,X,Y) ; FAC = (s16)facho+1:facho romsub $fe8d = QINT() clobbers(A,X,Y) ; facho:facho+1:facho+2:facho+3 = u32(FAC) romsub $fe90 = FINLOG(byte value @A) clobbers (A, X, Y) ; fac1 += signed byte in A @@ -133,8 +133,8 @@ asmsub GETADRAY () clobbers(X) -> uword @ AY { asmsub FREADUY (ubyte value @Y) { ; -- 8 bit unsigned Y -> float in fac1 %asm {{ - tya - jmp FLOAT + lda #0 + jmp GIVAYF }} } diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 6d562fcfb..c77f3d7ff 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -1,6 +1,5 @@ TODO ==== -RPN: cx16/mandelbrot-gfx-colors half display is wrong RPN: Fix the TODO RPN routines to be optimized assembly in RpnExpressionAsmGen.kt then: RPN: examples/bsieve,charset compilation crash (bit shift expression)