2018-12-09 15:16:46 +00:00
|
|
|
%import c64utils
|
|
|
|
%import mathlib
|
|
|
|
|
|
|
|
~ main {
|
|
|
|
|
|
|
|
sub start() {
|
|
|
|
|
|
|
|
ubyte v1
|
|
|
|
ubyte v2
|
|
|
|
ubyte cr
|
|
|
|
|
|
|
|
; check stack usage:
|
|
|
|
c64.STROUT("unsigned byte ")
|
2018-12-18 00:43:04 +00:00
|
|
|
c64scr.print_byte(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-18 00:43:04 +00:00
|
|
|
c64scr.print_byte(X)
|
2018-12-09 15:16:46 +00:00
|
|
|
c64.CHROUT('\n')
|
|
|
|
|
|
|
|
; comparisons:
|
|
|
|
v1=20
|
|
|
|
v2=199
|
|
|
|
c64.STROUT("v1=20, v2=199\n")
|
|
|
|
compare()
|
|
|
|
|
|
|
|
v1=80
|
|
|
|
v2=80
|
|
|
|
c64.STROUT("v1 = v2 = 80\n")
|
|
|
|
compare()
|
|
|
|
|
|
|
|
v1=220
|
|
|
|
v2=10
|
|
|
|
c64.STROUT("v1=220, v2=10\n")
|
|
|
|
compare()
|
|
|
|
|
2018-12-18 00:43:04 +00:00
|
|
|
c64scr.print_byte(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')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|