2018-12-09 15:16:46 +00:00
|
|
|
%import c64utils
|
2019-01-05 15:09:05 +00:00
|
|
|
%import c64flt
|
2018-12-09 15:16:46 +00:00
|
|
|
|
|
|
|
~ main {
|
|
|
|
|
|
|
|
sub start() {
|
|
|
|
|
|
|
|
float v1
|
|
|
|
float v2
|
|
|
|
ubyte cr
|
|
|
|
|
|
|
|
; check stack usage:
|
|
|
|
c64.STROUT("floating point ")
|
2018-12-21 00:06:01 +00:00
|
|
|
c64scr.print_ub(X)
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.CHROUT(' ')
|
|
|
|
|
|
|
|
cr=v1==v2
|
|
|
|
cr=v1==v2
|
|
|
|
cr=v1==v2
|
|
|
|
cr=v1!=v2
|
|
|
|
cr=v1!=v2
|
|
|
|
cr=v1!=v2
|
|
|
|
cr=v1<v2
|
|
|
|
cr=v1<v2
|
|
|
|
cr=v1<v2
|
|
|
|
cr=v1<v2
|
|
|
|
cr=v1>v2
|
|
|
|
cr=v1>v2
|
|
|
|
cr=v1>v2
|
|
|
|
cr=v1>v2
|
|
|
|
cr=v1>v2
|
|
|
|
cr=v1<=v2
|
|
|
|
cr=v1<=v2
|
|
|
|
cr=v1<=v2
|
|
|
|
cr=v1<=v2
|
|
|
|
cr=v1>=v2
|
|
|
|
cr=v1>=v2
|
|
|
|
cr=v1>=v2
|
|
|
|
cr=v1>=v2
|
|
|
|
cr=v1>=v2
|
|
|
|
|
2018-12-21 00:06:01 +00:00
|
|
|
c64scr.print_ub(X)
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.CHROUT('\n')
|
|
|
|
|
|
|
|
; comparisons:
|
|
|
|
v1=20
|
|
|
|
v2=666.66
|
|
|
|
c64.STROUT("v1=20, v2=666.66\n")
|
|
|
|
compare()
|
|
|
|
|
|
|
|
v1=-20
|
|
|
|
v2=666.66
|
|
|
|
c64.STROUT("v1=-20, v2=666.66\n")
|
|
|
|
compare()
|
|
|
|
|
|
|
|
v1=666.66
|
|
|
|
v2=555.55
|
|
|
|
c64.STROUT("v1=666.66, v2=555.55\n")
|
|
|
|
compare()
|
|
|
|
|
|
|
|
v1=3.1415
|
|
|
|
v2=-3.1415
|
|
|
|
c64.STROUT("v1 = 3.1415, v2 = -3.1415\n")
|
|
|
|
compare()
|
|
|
|
|
|
|
|
v1=3.1415
|
|
|
|
v2=3.1415
|
|
|
|
c64.STROUT("v1 = v2 = 3.1415\n")
|
|
|
|
compare()
|
|
|
|
|
|
|
|
v1=0
|
|
|
|
v2=0
|
|
|
|
c64.STROUT("v1 = v2 = 0\n")
|
|
|
|
compare()
|
|
|
|
|
2018-12-21 00:06:01 +00:00
|
|
|
c64scr.print_ub(X)
|
2018-12-09 18:48:59 +00:00
|
|
|
c64.CHROUT('\n')
|
|
|
|
|
|
|
|
return
|
|
|
|
|
2018-12-09 15:16:46 +00:00
|
|
|
sub compare() {
|
|
|
|
c64.STROUT(" == != < > <= >=\n")
|
|
|
|
|
2018-12-09 18:48:59 +00:00
|
|
|
if v1==v2
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.STROUT(" Q ")
|
2018-12-09 18:48:59 +00:00
|
|
|
else
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.STROUT(" . ")
|
2018-12-09 18:48:59 +00:00
|
|
|
if v1!=v2
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.STROUT(" Q ")
|
2018-12-09 18:48:59 +00:00
|
|
|
else
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.STROUT(" . ")
|
|
|
|
|
2018-12-09 18:48:59 +00:00
|
|
|
if v1<v2
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.STROUT(" Q ")
|
2018-12-09 18:48:59 +00:00
|
|
|
else
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.STROUT(" . ")
|
|
|
|
|
2018-12-09 18:48:59 +00:00
|
|
|
if v1>v2
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.STROUT(" Q ")
|
2018-12-09 18:48:59 +00:00
|
|
|
else
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.STROUT(" . ")
|
|
|
|
|
2018-12-09 18:48:59 +00:00
|
|
|
if v1<=v2
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.STROUT(" Q ")
|
2018-12-09 18:48:59 +00:00
|
|
|
else
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.STROUT(" . ")
|
|
|
|
|
2018-12-09 18:48:59 +00:00
|
|
|
if v1>=v2
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.STROUT(" Q ")
|
2018-12-09 18:48:59 +00:00
|
|
|
else
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.STROUT(" . ")
|
|
|
|
c64.CHROUT('\n')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-12-09 18:48:59 +00:00
|
|
|
|
2018-12-09 15:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|