fixed % operator bug

This commit is contained in:
Irmen de Jong 2020-12-28 00:08:22 +01:00
parent 9e2c52e1ec
commit 69780ecde9
3 changed files with 11 additions and 13 deletions

View File

@ -850,8 +850,8 @@ internal class AugmentableAssignmentAsmGen(private val program: Program,
ldy #>$value ldy #>$value
jsr math.divmod_uw_asm jsr math.divmod_uw_asm
lda P8ZP_SCRATCH_W2 lda P8ZP_SCRATCH_W2
ldy P8ZP_SCRATCH_W2+1
sta $name sta $name
lda P8ZP_SCRATCH_W2+2
sty $name+1 sty $name+1
""") """)
} }

View File

@ -76,11 +76,8 @@ main {
cx16.wait(2*60) cx16.wait(2*60)
repeat 255 { repeat 255
xx=rndw() % 640 ; TODO doesn't work correctly, truncates gfx2.line(rndw() % 640, rndw() % 480, rndw() % 640, rndw() % 480, 1)
yy=rndw() % 480 ; TODO doesn't work correctly, truncates
gfx2.line(xx, yy, rndw() % 640, rndw() % 480, 1)
}
cx16.wait(1*60) cx16.wait(1*60)
} }

View File

@ -1,5 +1,6 @@
%import test_stack %import test_stack
%import textio %import textio
%import floats
%zeropage basicsafe %zeropage basicsafe
%option no_sysinit %option no_sysinit
@ -8,13 +9,13 @@ main {
sub start () { sub start () {
; TODO uword var = rndw() % 640 doesn't work??? works if its in an expression. word ww
float x_f = -300.0
x_f = -300.0 float y_f
for ww in -300 to 300 { for ww in -300 to 300 { ; TODO fix crash if ww is not defined
;fl = ww as float / 10.0 ; TODO doesn't work??? ;fl = ww as float ; TODO doesn't work???
y_f = cos(x_f/30)*60 - x_f/1.7 y_f = cos(x_f/30.0)*60 - x_f/1.7
gfx2.plot(ww + 320 as uword, (y_f + 240) as uword, 1) ; gfx2.plot(ww + 320 as uword, (y_f + 240) as uword, 1)
x_f += 1.0 x_f += 1.0
} }