prog8/examples/test.p8

53 lines
944 B
Plaintext
Raw Normal View History

%import textio
%import floats
2021-10-27 21:48:02 +00:00
2021-10-30 13:15:11 +00:00
main {
2021-11-06 18:09:33 +00:00
sub start() {
2021-11-13 11:56:59 +00:00
ubyte xx = 1
ubyte yy = 2
uword aw
byte bb
float fl
; TODO add these constant folders:
2021-11-16 23:57:00 +00:00
; (X + C1) + (Y + C2) => (X + Y) + (C1 + C2)
; (X + C1) - (Y + C2) => (X - Y) + (C1 - C2)
; ---> together: (X + C1) <plusmin> (Y + C2) => (X <plusmin> Y) + (C1 <plusmin> C2)
2021-11-16 23:57:00 +00:00
; (X - C1) + (Y - C2) => (X + Y) - (C1 + C2)
; (X - C1) - (Y - C2) => (X - Y) - (C1 - C2)
xx=6
yy=8
yy = (xx+5)+(yy+10)
txt.print_ub(yy) ; 29
txt.nl()
xx=100
yy=8
yy = (xx+5)-(yy+10)
2021-11-16 23:57:00 +00:00
txt.print_ub(yy) ; 87
txt.nl()
xx=50
yy=40
yy = (xx-5)+(yy-10)
txt.print_ub(yy) ; 75
txt.nl()
xx=50
yy=20
yy = (xx-5)-(yy-10)
txt.print_ub(yy) ; 35
txt.nl()
repeat {
}
}
}