prog8/examples/test.p8
Irmen de Jong 176ec8ac7d fix 6502 codegen bug: complex comparison expression is evaluated wrong.
Fixed by reintroducing splitting of comparison expression in if statements by using a temporary variable and/or register to precompute left/right values.
2022-08-23 00:05:57 +02:00

32 lines
671 B
Lua

%import textio
%zeropage basicsafe
main {
sub start() {
ubyte c
ubyte radius = 1
ubyte[] circle_radius = [5,10,15,20,25,30]
for c in 0 to len(circle_radius)-1 {
if distance(c) < (radius as uword) + circle_radius[c]
txt.chrout('y')
else
txt.chrout('n')
cx16.r15 = (radius as uword) + circle_radius[c]
if distance(c) < cx16.r15
txt.chrout('y')
else
txt.chrout('n')
txt.nl()
}
}
sub distance(ubyte cix) -> uword {
uword sqx = cix+10
return sqrt16(sqx*sqx)
}
}