mirror of
https://github.com/irmen/prog8.git
synced 2024-11-27 03:50:27 +00:00
176ec8ac7d
Fixed by reintroducing splitting of comparison expression in if statements by using a temporary variable and/or register to precompute left/right values.
32 lines
671 B
Lua
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)
|
|
}
|
|
}
|