2020-09-20 21:49:36 +00:00
|
|
|
%import textio
|
2020-11-22 17:17:43 +00:00
|
|
|
%import test_stack
|
2019-08-24 22:46:46 +00:00
|
|
|
%zeropage basicsafe
|
|
|
|
|
2020-09-20 21:49:36 +00:00
|
|
|
; Note: this program is compatible with C64 and CX16.
|
|
|
|
|
2019-08-24 22:46:46 +00:00
|
|
|
main {
|
|
|
|
|
|
|
|
sub start() {
|
|
|
|
ubyte[] ubarr = [22,33,44,55,66]
|
|
|
|
byte[] barr = [22,-33,-44,55,66]
|
|
|
|
ubyte endub1
|
|
|
|
byte endb1
|
|
|
|
uword count
|
|
|
|
ubyte aa
|
|
|
|
ubyte ub
|
|
|
|
byte bb
|
|
|
|
word total
|
2020-12-21 22:45:26 +00:00
|
|
|
ubyte a
|
2019-08-24 22:46:46 +00:00
|
|
|
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.plot(0,24)
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
; ---------- REGISTER A ---------
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in string: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in "hello" {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==5 and total==372
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in arrayliteral: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in [1,3,5,99] {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==4 and total==108
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in arrayvar: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in ubarr {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==5 and total==220
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in range step 1: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in 10 to 20 {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==11 and total==165
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in range step -1: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in 20 downto 10 {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==11 and total==165
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in range step 3: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in 10 to 21 step 3 {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==4 and total==58
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in rangeincl step 3: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in 10 to 22 step 3 {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==5 and total==80
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in range step -3: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in 24 to 10 step -3 {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==5 and total==90
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in rangeincl step -3: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in 24 to 9 step -3 {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==6 and total==99
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endub1=101
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in ncrange step 1: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in 95 to endub1 step 1 {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==7 and total==686
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endub1=101
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in ncrange step -1: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in endub1 downto 95 {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==7 and total==686
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endub1=105
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in ncrange step 3: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in 95 to endub1 step 3 {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==4 and total==398
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endub1=105
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in ncrange step -3: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in endub1 to 95 step -3 {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==4 and total==402
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endub1=107
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in ncrangeinc step 3: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in 95 to endub1 step 3 {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==5 and total==505
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endub1=107
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("a in ncrangeinc step -3: ")
|
2020-12-21 22:45:26 +00:00
|
|
|
for a in endub1 to 95 step -3 {
|
|
|
|
aa=a
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += aa
|
|
|
|
}
|
|
|
|
if count==5 and total==505
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
wait_input()
|
|
|
|
|
|
|
|
; ---------- UBYTE var ---------
|
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in string: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ub in "hello" {
|
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==5 and total==372
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in arrayliteral: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ub in [1,3,5,99] {
|
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==4 and total==108
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in arrayvar: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ub in ubarr {
|
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==5 and total==220
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in range step 1: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ub in 10 to 20 {
|
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==11 and total==165
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in range step -1: ")
|
2020-03-11 19:47:42 +00:00
|
|
|
for ub in 20 downto 10 step -1 {
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==11 and total==165
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in range step 3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ub in 10 to 21 step 3 {
|
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==4 and total==58
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in rangeincl step 3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ub in 10 to 22 step 3 {
|
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==5 and total==80
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in range step -3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ub in 24 to 10 step -3 {
|
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==5 and total==90
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in rangeincl step -3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ub in 24 to 9 step -3 {
|
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==6 and total==99
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endub1=101
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in ncrange step 1: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ub in 95 to endub1 step 1 {
|
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==7 and total==686
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endub1=101
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in ncrange step -1: ")
|
2020-03-11 19:47:42 +00:00
|
|
|
for ub in endub1 downto 95 {
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==7 and total==686
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endub1=105
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in ncrange step 3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ub in 95 to endub1 step 3 {
|
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==4 and total==398
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endub1=105
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in ncrange step -3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ub in endub1 to 95 step -3 {
|
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==4 and total==402
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endub1=107
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in ncrangeinc step 3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ub in 95 to endub1 step 3 {
|
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==5 and total==505
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endub1=107
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ubyte var in ncrangeinc step -3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ub in endub1 to 95 step -3 {
|
|
|
|
count++
|
|
|
|
total += ub
|
|
|
|
}
|
|
|
|
if count==5 and total==505
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
wait_input()
|
|
|
|
|
|
|
|
; ---------- BYTE var ---------
|
|
|
|
|
2019-08-26 21:38:59 +00:00
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in arrayliteral: ")
|
2020-03-12 00:10:19 +00:00
|
|
|
for bb in [1,3,5,99] {
|
2019-08-26 21:38:59 +00:00
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==4 and total==108
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-26 21:38:59 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in arrayvar: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for bb in barr {
|
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==5 and total==66
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in range step 1: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for bb in 10 to 20 {
|
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==11 and total==165
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in range step -1: ")
|
2020-03-11 19:47:42 +00:00
|
|
|
for bb in 20 downto 10 {
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==11 and total==165
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in range step 3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for bb in 10 to 21 step 3 {
|
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==4 and total==58
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in rangeincl step 3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for bb in 10 to 22 step 3 {
|
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==5 and total==80
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in range step -3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for bb in 24 to 10 step -3 {
|
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==5 and total==90
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in rangeincl step -3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for bb in 24 to 9 step -3 {
|
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==6 and total==99
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endb1=101
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in ncrange step 1: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for bb in 95 to endb1 step 1 {
|
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==7 and total==686
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endb1=101
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in ncrange step -1: ")
|
2020-03-11 19:47:42 +00:00
|
|
|
for bb in endb1 downto 95 {
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==7 and total==686
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endb1=105
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in ncrange step 3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for bb in 95 to endb1 step 3 {
|
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==4 and total==398
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endb1=105
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in ncrange step -3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for bb in endb1 to 95 step -3 {
|
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==4 and total==402
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endb1=107
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in ncrangeinc step 3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for bb in 95 to endb1 step 3 {
|
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==5 and total==505
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endb1=107
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("byte var in ncrangeinc step -3: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for bb in endb1 to 95 step -3 {
|
|
|
|
count++
|
|
|
|
total += bb
|
|
|
|
}
|
|
|
|
if count==5 and total==505
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
wait_input()
|
|
|
|
|
|
|
|
; ---------- UWORD var ---------
|
|
|
|
|
|
|
|
uword[] uwarr = [1111,2222,3330,4000]
|
|
|
|
uword enduw1
|
|
|
|
uword totaluw
|
|
|
|
uword uw
|
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in string: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for uw in "hello" {
|
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==5 and totaluw==372
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in arrayliteral: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for uw in [1111,3333,555,999] {
|
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==4 and totaluw==5998
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in arrayvar: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for uw in uwarr {
|
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==4 and totaluw==10663
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in range step 1: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for uw in 1000 to 1100 {
|
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==101 and totaluw==40514
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in range step -1: ")
|
2020-03-11 19:47:42 +00:00
|
|
|
for uw in 2000 downto 1500 {
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==501 and totaluw==24782
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in range step 333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for uw in 1000 to 2200 step 333 {
|
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==4 and totaluw==5998
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in rangeincl step 333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for uw in 1000 to 2332 step 333 {
|
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==5 and totaluw==8330
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in range step -333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for uw in 17000 to 14500 step -333 {
|
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==8 and totaluw==61140
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in rangeincl step -333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for uw in 17000 to 14336 step -333 {
|
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==9 and totaluw==9940
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
|
|
|
enduw1=17000
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in ncrange step 1: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for uw in 16500 to enduw1 step 1 {
|
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==501 and totaluw==3142
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in ncrange step -1: ")
|
2020-03-11 19:47:42 +00:00
|
|
|
for uw in enduw1 downto 16500 {
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==501 and totaluw==3142
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
|
|
|
enduw1=17000
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in ncrange step 333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for uw in 14500 to enduw1 step 333 {
|
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==8 and totaluw==59788
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
|
|
|
enduw1=17000
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in ncrange step -333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for uw in enduw1 to 14500 step -333 {
|
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==8 and totaluw==61140
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
|
|
|
enduw1=17164
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in ncrangeinc step 333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for uw in 14500 to enduw1 step 333 {
|
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==9 and totaluw==11416
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
totaluw = 0
|
|
|
|
enduw1=17000
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("uword var in ncrangeinc step -333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for uw in enduw1 to 14336 step -333 {
|
|
|
|
count++
|
|
|
|
totaluw += uw
|
|
|
|
}
|
|
|
|
if count==9 and totaluw==9940
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
wait_input()
|
|
|
|
|
|
|
|
; ---------- WORD var ---------
|
|
|
|
|
|
|
|
word[] warr = [-111,222,-333,444]
|
|
|
|
word endw1
|
|
|
|
word ww
|
|
|
|
|
2019-08-26 21:38:59 +00:00
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in arrayliteral: ")
|
2020-03-12 00:10:19 +00:00
|
|
|
for ww in [1111,3333,555,999] {
|
2019-08-26 21:38:59 +00:00
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==4 and total==5998
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-26 21:38:59 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in arrayvar: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ww in warr {
|
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==4 and total==222
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in range step 1: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ww in -100 to 1000 {
|
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==1101 and total==-28838
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in range step -1: ")
|
2020-03-11 19:47:42 +00:00
|
|
|
for ww in 1000 downto -500 {
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==1501 and total==-17966
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in range step 333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ww in -1000 to 2200 step 333 {
|
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==10 and total==4985
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in rangeincl step 333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ww in -1000 to 2330 step 333 {
|
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==11 and total==7315
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in range step -333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ww in 2000 to -2500 step -333 {
|
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==14 and total==-2303
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in rangeincl step -333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ww in 2000 to -2662 step -333 {
|
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==15 and total==-4965
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endw1=17000
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in ncrange step 1: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ww in 16500 to endw1 step 1 {
|
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==501 and total==3142
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in ncrange step -1: ")
|
2020-03-11 19:47:42 +00:00
|
|
|
for ww in endw1 downto 16500 {
|
2019-08-24 22:46:46 +00:00
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==501 and total==3142
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endw1=17000
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in ncrange step 333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ww in 14500 to endw1 step 333 {
|
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==8 and total==-5748
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endw1=17000
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in ncrange step -333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ww in endw1 to 14500 step -333 {
|
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==8 and total==-4396
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endw1=17164
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in ncrangeinc step 333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ww in 14500 to endw1 step 333 {
|
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==9 and total==11416
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
|
|
|
|
count = 0
|
|
|
|
total = 0
|
|
|
|
endw1=17000
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("word var in ncrangeinc step -333: ")
|
2019-08-24 22:46:46 +00:00
|
|
|
for ww in endw1 to 14336 step -333 {
|
|
|
|
count++
|
|
|
|
total += ww
|
|
|
|
}
|
|
|
|
if count==9 and total==9940
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("ok\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
else
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("fail!!!\n")
|
2020-11-22 17:17:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
test_stack.test()
|
2019-08-24 22:46:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub wait_input() {
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("enter to continue:")
|
2019-08-24 22:46:46 +00:00
|
|
|
str input = " "
|
2020-08-27 16:10:22 +00:00
|
|
|
void txt.input_chars(input)
|
|
|
|
txt.print("\n\n")
|
2019-08-24 22:46:46 +00:00
|
|
|
}
|
|
|
|
}
|