prog8/examples/test.p8

60 lines
1022 B
Plaintext
Raw Normal View History

%import textio
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
2021-11-20 21:33:13 +00:00
byte b1
byte b2
;; TODO add these constant folders:
2021-11-20 21:33:13 +00:00
;; (X - C1) <plusmin> (Y - C2) => (X <plusmin> Y) - (C1 <plusmin> C2)
;; (X - C1) - (Y - C2) => (X - Y) - (C1 - C2)
;
; result should be: 29 42 40 87 75 35
xx=6
yy=8
yy = (xx+5)+(yy+10)
txt.print_ub(yy) ; 29
txt.nl()
xx=6
yy=8
yy = (xx*3)+(yy*3)
txt.print_ub(yy) ; 42
txt.nl()
xx=13
yy=5
yy = (xx*5)-(yy*5)
txt.print_ub(yy) ; 40
txt.nl()
2021-11-20 21:33:13 +00:00
b1=100
b2=8
b2 = (b1+5)-(b2+10)
txt.print_b(b2) ; 87
txt.nl()
2021-11-20 21:33:13 +00:00
b1=50
b2=40
b2 = (b1-5)+(b2-10)
txt.print_b(b2) ; 75
txt.nl()
2021-11-20 21:33:13 +00:00
b1=50
b2=20
b2 = (b1-5)-(b2-10)
txt.print_b(b2) ; 35
txt.nl()
repeat {
}
}
}