2020-09-20 21:49:36 +00:00
|
|
|
%import floats
|
|
|
|
%import textio
|
2020-03-14 20:09:34 +00:00
|
|
|
%zeropage basicsafe
|
|
|
|
|
|
|
|
main {
|
|
|
|
|
|
|
|
sub start() {
|
|
|
|
byte b1
|
|
|
|
byte b2
|
|
|
|
ubyte ub1
|
|
|
|
ubyte ub2
|
|
|
|
word w1
|
|
|
|
word w2
|
|
|
|
uword uw1
|
|
|
|
uword uw2
|
|
|
|
float f1
|
|
|
|
float f2
|
|
|
|
|
|
|
|
b1 = 10
|
|
|
|
b2 = 10
|
|
|
|
if sgn(b2-b1) != 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn1 error1\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
b1 = -100
|
|
|
|
b2 = -100
|
|
|
|
if sgn(b2-b1) != 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn1 error2\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
ub1 = 200
|
|
|
|
ub2 = 200
|
|
|
|
if sgn(ub2-ub1) != 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn1 error3\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
w1 = 100
|
|
|
|
w2 = 100
|
|
|
|
if sgn(w2-w1) != 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn1 error4\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
w1 = -2000
|
|
|
|
w2 = -2000
|
|
|
|
if sgn(w2-w1) != 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn1 error5\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
uw1 = 999
|
|
|
|
uw2 = 999
|
|
|
|
if sgn(uw2-uw1) != 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn1 error6\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
f1 = 3.45
|
|
|
|
f2 = 3.45
|
|
|
|
if sgn(f2-f1) != 0
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn1 error7\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
; -1
|
|
|
|
b1 = 11
|
|
|
|
b2 = 10
|
|
|
|
if sgn(b2-b1) != -1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn2 error1\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
b1 = -10
|
|
|
|
b2 = -100
|
|
|
|
if sgn(b2-b1) != -1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn2 error2\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
ub1 = 202
|
|
|
|
ub2 = 200
|
|
|
|
if sgn(ub2 as byte - ub1 as byte) != -1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn2 error3\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
w1 = 101
|
|
|
|
w2 = 100
|
|
|
|
if sgn(w2-w1) != -1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn2 error4\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
w1 = -200
|
|
|
|
w2 = -2000
|
|
|
|
if sgn(w2-w1) != -1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn2 error5\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
uw1 = 2222
|
|
|
|
uw2 = 999
|
2020-03-22 15:06:34 +00:00
|
|
|
if sgn((uw2 as word) - (uw1 as word)) != -1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn2 error6a\n")
|
2020-03-22 15:06:34 +00:00
|
|
|
if sgn(uw2 - uw1) != 1 ; always 0 or 1 if unsigned
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn2 error6b\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
f1 = 3.45
|
|
|
|
f2 = 1.11
|
|
|
|
if sgn(f2-f1) != -1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn2 error7\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
; +1
|
|
|
|
b1 = 11
|
|
|
|
b2 = 20
|
|
|
|
if sgn(b2-b1) != 1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn3 error1\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
b1 = -10
|
|
|
|
b2 = -1
|
|
|
|
if sgn(b2-b1) != 1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn3 error2\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
ub1 = 202
|
|
|
|
ub2 = 205
|
|
|
|
if sgn(ub2-ub1) != 1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn3 error3\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
w1 = 101
|
|
|
|
w2 = 200
|
|
|
|
if sgn(w2-w1) != 1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn3 error4\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
w1 = -200
|
|
|
|
w2 = -20
|
|
|
|
if sgn(w2-w1) != 1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn3 error5\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
uw1 = 2222
|
|
|
|
uw2 = 9999
|
|
|
|
if sgn(uw2-uw1) != 1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn3 error6\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
|
|
|
f1 = 3.45
|
|
|
|
f2 = 5.11
|
|
|
|
if sgn(f2-f1) != 1
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("sgn3 error7\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
|
2020-08-27 16:10:22 +00:00
|
|
|
txt.print("should see no sgn errors\n")
|
2020-03-14 20:09:34 +00:00
|
|
|
}
|
|
|
|
}
|