sbyte less than

This commit is contained in:
Irmen de Jong 2018-12-09 03:46:02 +01:00
parent db3d3727c2
commit 21b9c2f011
2 changed files with 79 additions and 124 deletions

View File

@ -23,164 +23,111 @@
c64.CHROUT('\n')
rrestore()
ub2=ub1<ub2
ub2=ub1<ub2
ub2=ub1<ub2
ub2=ub1<ub2
ub2=ub1>ub2
ub2=ub1>ub2
ub2=ub1>ub2
ub2=ub1>ub2
ub2=ub1>ub2
ub2=ub1<=ub2
ub2=ub1<=ub2
ub2=ub1<=ub2
ub2=ub1<=ub2
ub2=ub1>=ub2
ub2=ub1>=ub2
ub2=ub1>=ub2
ub2=ub1>=ub2
ub2=ub1>=ub2
rsave()
ub2=b1<b2
ub2=b1<b2
ub2=b1<b2
ub2=b1<b2
ub2=b1>b2
ub2=b1>b2
ub2=b1>b2
ub2=b1>b2
ub2=b1>b2
ub2=b1<=b2
ub2=b1<=b2
ub2=b1<=b2
ub2=b1<=b2
ub2=b1>=b2
ub2=b1>=b2
ub2=b1>=b2
ub2=b1>=b2
ub2=b1>=b2
ub1=66
ub2=199
c64.STROUT("ub1=66,ub2=199\n")
rsave()
b1=-20
b2=99
c64.STROUT("b1=-20,b2=99\n")
rrestore()
compare()
if ub1<ub2 {
sub compare() {
if b1<b2 {
rsave()
c64.STROUT(" true: ub1<ub2\n")
c64.STROUT(" true: b1<b2 ")
rrestore()
} else {
rsave()
c64.STROUT(" false: ub1<ub2\n")
c64.STROUT(" false: b1<b2 ")
rrestore()
}
if ub1<=ub2 {
if b1>b2 {
rsave()
c64.STROUT(" true: ub1<=ub2\n")
c64.STROUT(" true: b1>b2\n")
rrestore()
} else {
rsave()
c64.STROUT(" false: ub1<=ub2\n")
c64.STROUT(" false: b1>b2\n")
rrestore()
}
if ub1>ub2 {
if b1<=b2 {
rsave()
c64.STROUT(" true: ub1>ub2\n")
c64.STROUT(" true: b1<=b2 ")
rrestore()
} else {
rsave()
c64.STROUT(" false: ub1>b2\n")
rrestore()
}
if ub1>=ub2 {
rsave()
c64.STROUT(" true: ub1>=ub2\n")
rrestore()
} else {
rsave()
c64.STROUT(" false: ub1>=b2\n")
c64.STROUT(" false: b1<=b2 ")
rrestore()
}
if b1>=b2 {
rsave()
ub1=199
ub2=199
c64.STROUT("ub1=ub2=199\n")
rrestore()
if ub1<ub2 {
rsave()
c64.STROUT(" true: ub1<ub2\n")
c64.STROUT(" true: b1>=b2\n")
rrestore()
} else {
rsave()
c64.STROUT(" false: ub1<ub2\n")
c64.STROUT(" false: b1>=b2\n")
rrestore()
}
if ub1<=ub2 {
if b1==b2 {
rsave()
c64.STROUT(" true: ub1<=ub2\n")
c64.STROUT(" true: b1==b2 ")
rrestore()
} else {
rsave()
c64.STROUT(" false: ub1<=ub2\n")
c64.STROUT(" false: b1==b2 ")
rrestore()
}
if ub1>ub2 {
if b1!=b2 {
rsave()
c64.STROUT(" true: ub1>ub2\n")
c64.STROUT(" true: b1!=b2\n")
rrestore()
} else {
rsave()
c64.STROUT(" false: ub1>ub2\n")
c64.STROUT(" false: b1!=b2\n")
rrestore()
}
if ub1>=ub2 {
rsave()
c64.STROUT(" true: ub1>=ub2\n")
rrestore()
} else {
rsave()
c64.STROUT(" false: ub1>=ub2\n")
rrestore()
}
rsave()
ub1=222
ub2=88
c64.STROUT("ub1=222,ub2=88\n")
b1=-80
b2=-80
c64.STROUT("b1=b2=-80\n")
rrestore()
if ub1<ub2 {
rsave()
c64.STROUT(" true: ub1<ub2\n")
rrestore()
} else {
rsave()
c64.STROUT(" false: ub1<ub2\n")
rrestore()
}
compare()
if ub1<=ub2 {
rsave()
c64.STROUT(" true: ub1<=ub2\n")
b1=120
b2=-10
c64.STROUT("b1=120,b2=-10\n")
rrestore()
} else {
rsave()
c64.STROUT(" false: ub1<=ub2\n")
rrestore()
}
if ub1>ub2 {
rsave()
c64.STROUT(" true: ub1>ub2\n")
rrestore()
} else {
rsave()
c64.STROUT(" false: ub1>ub2\n")
rrestore()
}
if ub1>=ub2 {
rsave()
c64.STROUT(" true: ub1>=ub2\n")
rrestore()
} else {
rsave()
c64.STROUT(" false: ub1>=ub2\n")
rrestore()
}
compare()
rsave()
c64scr.print_byte_decimal(X)

View File

@ -272,8 +272,8 @@ remainder_f .proc
equal_b .proc
; -- are the two bytes on the stack identical?
lda ESTACK_LO+1,x
cmp ESTACK_LO+2,x
lda ESTACK_LO+2,x
cmp ESTACK_LO+1,x
bne _equal_b_false
_equal_b_true lda #1
_equal_b_store inx
@ -286,6 +286,7 @@ _equal_b_false lda #0
equal_w .proc
; -- are the two words on the stack identical?
; @todo optimize according to http://www.6502.org/tutorials/compare_beyond.html
lda ESTACK_LO+1,x
cmp ESTACK_LO+2,x
bne equal_b._equal_b_false
@ -326,8 +327,14 @@ less_ub .proc
.pend
less_b .proc
rts
.warn "not implemented"
; see http://www.6502.org/tutorials/compare_beyond.html
lda ESTACK_LO+2,x
sec
sbc ESTACK_LO+1,x
bvc +
eor #$80
+ bmi equal_b._equal_b_true
bpl equal_b._equal_b_false
.pend
less_uw .proc
@ -410,6 +417,7 @@ greatereq_w .proc
equal_f .proc
; -- are the two mflpt5 numbers on the stack identical?
; @todo optimize according to http://www.6502.org/tutorials/compare_beyond.html
inx
inx
inx