Author Topic: Command documentation  (Read 2468 times)

Offline FutureCow

  • HelpEditor
  • Prof. Inline
  • ******
  • Posts: 680
    • View Profile
Command documentation
« on: 2008-Dec-16 »
Some commands are missing documentation (eg. bNOT, bXOR) and examples. It would be nice if they were documented.

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 915
    • View Profile
Re: Command documentation
« Reply #1 on: 2008-Dec-17 »
there's a link to bAND and there's also an explanation for bNOT and bXOR.

Offline FutureCow

  • HelpEditor
  • Prof. Inline
  • ******
  • Posts: 680
    • View Profile
Re: Command documentation
« Reply #2 on: 2008-Dec-17 »
If I look at the bXOR section of the help file, it just references bAND. The bAND section of the document is copied below, please show me where it documents bXOR and bNOT (WITHOUT having to run the example code to figure out how bNOT and bXOR work).


bAND()

num% = bAND(num1%, num2%)
num% = bAND(num1%, num2%)
num% = bOR(num1%, num2%)
num% = bXOR(num1%, num2%)
num% = bNOT(num1%)

Performs boolean operations on integer values. The size of the numbers is 32bit.

bAND:

Binary code of num1%: 00100010
Binary code of num2%: 00100100
Binary code of num%: 00100000
Only bits that are available in num1 AND num2 will be set in num%.

bOR:

Binary code of num1%: 00100010
Binary code of num2%: 00100100
Binary code of num%: 00100110
All bits that are available in num1% OR num2% will be set in num%.

Sample:


a%=1
b%=5
IF (a>1) OR (b>1) THEN PRINT "a>5 OR b>5", 100, 100
a=125000
lobyte=a AND 0x00FF
hibyte=a AND 0xFF00
SHOWSCREEN
MOUSEWAIT



Sample:


FOR a%=0 TO 1
 FOR b%=0 TO 1
  x = (a+b*2)*160
  PRINT "a="+a+" b="+b, x, 30

  PRINT "bAND="+bAND(a, b), x,  60
  PRINT "bOR ="+bOR (a, b), x,  80
  PRINT "bXOR="+bXOR(a, b), x, 100
  IF b=0 THEN PRINT "bNOT="+bNOT(a),    x, 120
 NEXT
NEXT
SHOWSCREEN
MOUSEWAIT


Refs:
bNOT(), bOR(), bXOR()

Offline S. P. Gardebiter

  • Mr. Polyvector
  • ***
  • Posts: 245
    • View Profile
    • Tile 44 Interactive
Re: Command documentation
« Reply #3 on: 2009-Feb-03 »
What about bNAND and bNOR and bNXOR? :P
I mean you could do it with bNOT too but it would be easier to have these instructions too :o
~ Cave Story rules! ~