fix an invalid 6502 instruction on c64 in certain float assignment

This commit is contained in:
Irmen de Jong 2023-09-05 21:44:03 +02:00
parent 31458ffd81
commit 8c0843cc87
6 changed files with 23 additions and 15 deletions

View File

@ -422,7 +422,8 @@ internal class AugmentableAssignmentAsmGen(private val program: PtProgram,
ldy #>$tempvar ldy #>$tempvar
sta P8ZP_SCRATCH_W1 sta P8ZP_SCRATCH_W1
sty P8ZP_SCRATCH_W1+1 sty P8ZP_SCRATCH_W1+1
ply pla
tay
txa txa
jsr floats.copy_float""") // copy from array into float temp var, clobbers A,Y jsr floats.copy_float""") // copy from array into float temp var, clobbers A,Y
} }

View File

@ -1,6 +1,13 @@
TODO TODO
==== ====
- examples/bench8/pow.p8: result value 0 is borked, fix array[j] += testpow(2.5/(i+1.0), j) assignment in 6502 codegen
- examples/bench8/crc16 produces wrong answer (expected ffd0 in 4.6 sec)
- examples/bench8/crc32 produces wrong answer (expected e1fa84c6 in 40.1 sec)
- add bench8/sieve and sieve-bit ports
- prefix prog8 subroutines with p8s_ instead of p8_ to not let them clash with variables in the asm?? - prefix prog8 subroutines with p8s_ instead of p8_ to not let them clash with variables in the asm??
- [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 .... - [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....
- IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction - IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction

View File

@ -18,13 +18,13 @@ main {
} }
sub start() { sub start() {
txt.print("calculating...") txt.print("calculating (expecting $ffd0)...")
cbm.SETTIM(0,0,0) cbm.SETTIM(0,0,0)
uword crc = crc16($e000, $2000) uword crc = crc16($e000, $2000)
txt.print_uwhex(crc, true) ; should be $ffd0 txt.print_uwhex(crc, true)
txt.nl() txt.nl()
txt.print_uw(cbm.RDTIM16()) txt.print_uw(cbm.RDTIM16())
txt.print(" jiffies") txt.print(" jiffies")
sys.wait(100) sys.wait(300)
} }
} }

View File

@ -29,7 +29,7 @@ main {
} }
sub start() { sub start() {
txt.print("calculating...") txt.print("calculating (expecting $e1fa84c6)...\n")
cbm.SETTIM(0,0,0) cbm.SETTIM(0,0,0)
crc32($e000, $2000) crc32($e000, $2000)
txt.print_uwhex(cx16.r0, true) txt.print_uwhex(cx16.r0, true)
@ -37,6 +37,6 @@ main {
txt.nl() txt.nl()
txt.print_uw(cbm.RDTIM16()) txt.print_uw(cbm.RDTIM16())
txt.print(" jiffies") txt.print(" jiffies")
sys.wait(100) sys.wait(300)
} }
} }

View File

@ -18,13 +18,13 @@ main {
} }
sub start() { sub start() {
txt.print("calculating...") txt.print("calculating (expecting $a2)...")
cbm.SETTIM(0,0,0) cbm.SETTIM(0,0,0)
ubyte crc = crc8($e000, $2000) ubyte crc = crc8($e000, $2000)
txt.print_ubhex(crc, true) ; should be $a2 txt.print_ubhex(crc, true)
txt.nl() txt.nl()
txt.print_uw(cbm.RDTIM16()) txt.print_uw(cbm.RDTIM16())
txt.print(" jiffies") txt.print(" jiffies")
sys.wait(100) sys.wait(300)
} }
} }

View File

@ -18,10 +18,10 @@ main {
} }
sub start() { sub start() {
txt.print("calculating...") txt.print("calculating (expecting 3.614007e+12)... ")
cbm.SETTIM(0,0,0) ; cbm.SETTIM(0,0,0)
float res float res=0.0
uword i uword i
ubyte j ubyte j
for i in 0 to N_ITER-1 { for i in 0 to N_ITER-1 {
@ -35,8 +35,8 @@ main {
floats.print_f(res) floats.print_f(res)
txt.nl() txt.nl()
txt.print_uw(cbm.RDTIM16()) ; txt.print_uw(cbm.RDTIM16())
txt.print(" jiffies") ; txt.print(" jiffies")
sys.wait(100) sys.wait(300)
} }
} }