prog8/examples/test.p8

53 lines
1.0 KiB
Plaintext
Raw Normal View History

2019-08-17 23:39:48 +00:00
%zeropage basicsafe
2019-08-09 00:15:31 +00:00
2019-08-07 00:02:34 +00:00
main {
sub start() {
2019-08-24 22:24:00 +00:00
ubyte[] ubarr = [22,33,44,55,66]
byte[] barr = [22,-33,-44,55,66]
ubyte endub1
byte endb1
ubyte aa
ubyte ub
byte bb
uword uw
2019-08-24 22:24:00 +00:00
word total
uword count
2019-08-19 20:28:41 +00:00
2019-08-20 22:09:44 +00:00
2019-08-24 22:24:00 +00:00
; ---------- BYTE var ---------
count = 0
total = 0
2019-08-24 22:46:46 +00:00
c64scr.print("byte var in arrayliteral: ")
for bb in [1,3,5,99] {
2019-08-24 22:24:00 +00:00
count++
total += bb
}
2019-08-24 22:46:46 +00:00
if count==4 and total==108
2019-08-24 22:24:00 +00:00
c64scr.print("ok\n")
else
c64scr.print("fail!!!\n")
2019-08-24 22:46:46 +00:00
; ---------- WORD var ---------
2019-08-24 22:24:00 +00:00
2019-08-24 22:46:46 +00:00
word[] warr = [-111,222,-333,444]
word endw1
word ww
2019-08-24 22:24:00 +00:00
count = 0
total = 0
2019-08-24 22:46:46 +00:00
c64scr.print("word var in arrayliteral: ")
for ww in [1111,3333,555,999] {
2019-08-24 22:24:00 +00:00
count++
2019-08-24 22:46:46 +00:00
total += ww
2019-08-24 22:24:00 +00:00
}
2019-08-24 22:46:46 +00:00
if count==4 and total==5998
2019-08-24 22:24:00 +00:00
c64scr.print("ok\n")
else
c64scr.print("fail!!!\n")
2019-08-24 14:21:05 +00:00
}
}