2019-08-11 14:01:37 +00:00
|
|
|
%import c64flt
|
2020-08-27 16:10:22 +00:00
|
|
|
%import c64textio
|
|
|
|
%zeropage basicsafe
|
2019-08-11 14:01:37 +00:00
|
|
|
|
|
|
|
main {
|
|
|
|
|
|
|
|
sub start() {
|
|
|
|
ubyte[] ubarr = [100, 0, 99, 199, 22]
|
|
|
|
byte[] barr = [-100, 0, 99, -122, 22]
|
|
|
|
uword[] uwarr = [1000, 0, 222, 4444, 999]
|
|
|
|
word[] warr = [-1000, 0, 999, -4444, 222]
|
|
|
|
float[] farr = [-1000.1, 0, 999.9, -4444.4, 222.2]
|
|
|
|
str name = "irmen"
|
|
|
|
ubyte ub
|
|
|
|
byte bb
|
|
|
|
word ww
|
|
|
|
uword uw
|
|
|
|
float ff
|
|
|
|
|
|
|
|
; LEN/STRLEN
|
|
|
|
ubyte length = len(name)
|
2020-08-27 16:10:22 +00:00
|
|
|
if length!=5 txt.print("error len1\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
length = len(uwarr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if length!=5 txt.print("error len2\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
length=strlen(name)
|
2020-08-27 16:10:22 +00:00
|
|
|
if length!=5 txt.print("error strlen1\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
name[3] = 0
|
|
|
|
length=strlen(name)
|
2020-08-27 16:10:22 +00:00
|
|
|
if length!=3 txt.print("error strlen2\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
|
|
|
|
; MAX
|
|
|
|
ub = max(ubarr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub!=199 txt.print("error max1\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
bb = max(barr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if bb!=99 txt.print("error max2\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
uw = max(uwarr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if uw!=4444 txt.print("error max3\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ww = max(warr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ww!=999 txt.print("error max4\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ff = max(farr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ff!=999.9 txt.print("error max5\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
|
|
|
|
; MIN
|
|
|
|
ub = min(ubarr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub!=0 txt.print("error min1\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
bb = min(barr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if bb!=-122 txt.print("error min2\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
uw = min(uwarr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if uw!=0 txt.print("error min3\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ww = min(warr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ww!=-4444 txt.print("error min4\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ff = min(farr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ff!=-4444.4 txt.print("error min5\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
|
|
|
|
; SUM
|
|
|
|
uw = sum(ubarr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if uw!=420 txt.print("error sum1\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ww = sum(barr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ww!=-101 txt.print("error sum2\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
uw = sum(uwarr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if uw!=6665 txt.print("error sum3\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ww = sum(warr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ww!=-4223 txt.print("error sum4\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ff = sum(farr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ff!=-4222.4 txt.print("error sum5\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
|
|
|
|
; ANY
|
|
|
|
ub = any(ubarr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==0 txt.print("error any1\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ub = any(barr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==0 txt.print("error any2\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ub = any(uwarr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==0 txt.print("error any3\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ub = any(warr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==0 txt.print("error any4\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ub = any(farr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==0 txt.print("error any5\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
|
|
|
|
; ALL
|
|
|
|
ub = all(ubarr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==1 txt.print("error all1\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ub = all(barr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==1 txt.print("error all2\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ub = all(uwarr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==1 txt.print("error all3\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ub = all(warr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==1 txt.print("error all4\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ub = all(farr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==1 txt.print("error all5\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ubarr[1]=$40
|
|
|
|
barr[1]=$40
|
|
|
|
uwarr[1]=$4000
|
|
|
|
warr[1]=$4000
|
|
|
|
farr[1]=1.1
|
|
|
|
ub = all(ubarr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==0 txt.print("error all6\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ub = all(barr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==0 txt.print("error all7\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ub = all(uwarr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==0 txt.print("error all8\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ub = all(warr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==0 txt.print("error all9\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
ub = all(farr)
|
2020-08-27 16:10:22 +00:00
|
|
|
if ub==0 txt.print("error all10\n")
|
2019-08-11 14:01:37 +00:00
|
|
|
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("\nyou should see no errors printed above (only at first run).")
|
2019-08-11 14:01:37 +00:00
|
|
|
}
|
|
|
|
}
|