fixed division of signed byte number by 2. (!)

This commit is contained in:
Irmen de Jong 2021-11-10 00:17:56 +01:00
parent 8df3da11e3
commit 686483f51a
3 changed files with 8 additions and 36 deletions

View File

@ -528,7 +528,7 @@ internal class ExpressionsAsmGen(private val program: Program, private val asmge
translateExpressionInternal(expr.left)
when(leftDt) {
DataType.UBYTE -> asmgen.out(" lsr P8ESTACK_LO+1,x")
DataType.BYTE -> asmgen.out(" asl P8ESTACK_LO+1,x | ror P8ESTACK_LO+1,x")
DataType.BYTE -> asmgen.out(" lda P8ESTACK_LO+1,x | asl a | ror P8ESTACK_LO+1,x")
DataType.UWORD -> asmgen.out(" lsr P8ESTACK_HI+1,x | ror P8ESTACK_LO+1,x")
DataType.WORD -> asmgen.out(" lda P8ESTACK_HI+1,x | asl a | ror P8ESTACK_HI+1,x | ror P8ESTACK_LO+1,x")
else -> throw AssemblyError("wrong dt")

View File

@ -77,8 +77,6 @@ main {
ubyte r
; circles with "degrees" from 0 to 255
; TODO FIX WHEN USING NO-OPT! (CORRECT WHEN USING OPTIMIZATION..)
for r in 0 to 255 {
pixelxw = (sin8(r)/2 + 80) as uword
pixelyb = (cos8(r)/2 + height/2) as ubyte
@ -92,7 +90,6 @@ main {
}
; circles with half-degrees from 0 to 179 (=full degrees 0..358 with steps of 2 degrees)
; TODO FIX WHEN USING NO-OPT! (CORRECT WHEN USING OPTIMIZATION..)
for r in 0 to 179 {
pixelxw = (sinr8(r) as word /2 + 220) as uword
pixelyb = (cosr8(r)/2 + height/2) as ubyte

View File

@ -4,39 +4,15 @@
main {
sub start() {
sub start() {
ubyte unused ; TODO FIX : why is this not removed as an unused variable?
ubyte @shared unused2
ubyte ub=99
byte bb=-99
uword uw=9999
word ww=-9999
float ff
ff = 1.234
ff += (ub as float) ; operator doesn't matter
floats.print_f(ff)
txt.nl()
ubyte bb
uword ww
ww = not bb or not ww ; TODO WHY DOES THIS USE STACK EVAL
}
ff = 1.234
ff += (bb as float) ; operator doesn't matter
floats.print_f(ff)
txt.nl()
ff = 1.234
ff += (uw as float) ; operator doesn't matter
floats.print_f(ff)
txt.nl()
ff = 1.234
ff += (ww as float) ; operator doesn't matter
floats.print_f(ff)
txt.nl()
; ubyte unused ; TODO FIX : why is this not removed as an unused variable?
; ubyte @shared unused2
;
; ubyte bb
; uword ww
; ww = not bb or not ww ; TODO WHY DOES THIS USE STACK EVAL
; if not iteration_in_progress or not num_bytes
; return
@ -83,5 +59,4 @@ main {
; txt.nl()
; floats.print_f(fa[1])
}
}