Author Topic: Question about comparestr and xor="  (Read 2075 times)

0 Members and 1 Guest are viewing this topic.

Arnold

  • Guest
Question about comparestr and xor="
« on: April 08, 2015, 11:59:55 PM »
Hi Charles,

is comparestr a valid function and can it be used only in assembler? I tried this code:

a="abc"
b="abc"
c="123"
print comparestr(a,b)
print comparestr(a,c)

I get some values, but I do not know what they mean. And everytime I run this snippet I get different values.

In the Oxygen help file there is listed xor=" as an operator. Is the quote necessary in some cases?

Roland

Charles Pegge

  • Guest
Re: Question about comparestr and xor="
« Reply #1 on: April 09, 2015, 01:11:08 AM »
Hi Roland,

Yes, the quote mark looks like a typo. xor= works just like the other assignment operators

comparestr is the string comparator, and rarely used directly. It sets the CPU zero and sign flags.

Code: OxygenBasic
  1. a="abc"
  2. b="abc"
  3. c="123"
  4. sys cm
  5. comparestr(a,b)
  6. (
  7.   jnz exit
  8.   print "equal"
  9.   jmp fwd ncompare
  10. )
  11. (
  12.   jg exit
  13.   print "less"
  14.   jmp fwd ncompare
  15. )
  16. (
  17.   jl exit
  18.   print "greater"
  19.   jmp fwd ncompare
  20. )
  21. .ncompare
  22.  

« Last Edit: April 09, 2015, 01:18:26 AM by Charles Pegge »