mirror of
https://github.com/irmen/prog8.git
synced 2024-11-20 03:32:05 +00:00
vm: fix comparison datatype error; primes.p8 works again
This commit is contained in:
parent
3f5877dbcc
commit
b459b09b2f
@ -585,7 +585,7 @@ class CodeGen(internal val program: PtProgram,
|
||||
throw AssemblyError("if condition should only be a binary comparison expression")
|
||||
|
||||
val signed = ifElse.condition.left.type in arrayOf(DataType.BYTE, DataType.WORD, DataType.FLOAT)
|
||||
val vmDt = vmType(ifElse.condition.type)
|
||||
val vmDt = vmType(ifElse.condition.left.type)
|
||||
val code = VmCodeChunk()
|
||||
|
||||
fun translateNonZeroComparison(): VmCodeChunk {
|
||||
|
@ -3,7 +3,6 @@ TODO
|
||||
|
||||
For next release
|
||||
^^^^^^^^^^^^^^^^
|
||||
- vm: fix primes.p8 calculating wrong primes
|
||||
...
|
||||
|
||||
|
||||
|
@ -40,27 +40,15 @@ main {
|
||||
return 0 ; we wrapped; no more primes available in the sieve
|
||||
}
|
||||
|
||||
txt.print("candidate: ")
|
||||
txt.print_ub(candidate_prime)
|
||||
txt.nl()
|
||||
|
||||
; found next one, mark the multiples and return it.
|
||||
sieve[candidate_prime] = true
|
||||
uword multiple = candidate_prime
|
||||
|
||||
|
||||
while multiple < len(sieve) {
|
||||
sieve[lsb(multiple)] = true
|
||||
multiple += candidate_prime
|
||||
}
|
||||
|
||||
ubyte xx
|
||||
for xx in sieve {
|
||||
txt.print_ub(xx)
|
||||
txt.spc()
|
||||
}
|
||||
txt.nl()
|
||||
|
||||
return candidate_prime
|
||||
}
|
||||
}
|
||||
|
@ -33,16 +33,24 @@ main {
|
||||
|
||||
ubyte[20] sieve
|
||||
uword count=0
|
||||
ubyte xx
|
||||
for xx in sieve {
|
||||
txt.print_ub(xx)
|
||||
if count < 256
|
||||
txt.print("<256 ok! 1\n")
|
||||
if count > 256
|
||||
txt.print(">256 nok! 2\n")
|
||||
count=257
|
||||
if count < 256
|
||||
txt.print("<256 nok! 3\n")
|
||||
if count > 256
|
||||
txt.print(">256 ok! 4\n")
|
||||
count=256
|
||||
|
||||
count=0
|
||||
while count < 256 { ; TODO fix this while loop
|
||||
txt.print_uw(count)
|
||||
txt.spc()
|
||||
count++
|
||||
count += 10
|
||||
}
|
||||
txt.nl()
|
||||
txt.print_uw(count)
|
||||
txt.nl()
|
||||
|
||||
|
||||
; ; a "pixelshader":
|
||||
; sys.gfx_enable(0) ; enable lo res screen
|
||||
|
Loading…
Reference in New Issue
Block a user