home *** CD-ROM | disk | FTP | other *** search
- Bitop is a handy little tool for programmers. It's uses are:
-
- 1. As a bit-mask tool. Create and edit bitmasks in decimal,
- hexadecimal, or binary.
-
- 2. As a hex-dec-bin converter.
-
- 3. As a simple calculator.
-
- To use Bitop, run it from cli or WorkBench - I have it assigned to
- the numeric ')' key in my text editor so it's always handy.
- Bitop opens its own window.
-
- The Title Bar: This will show the current operation that will be
- performed on the numbers in the argument gadgets (if no number is
- present in either of the argument gadgets, a '0' is assumed). The
- possible operations are:
-
- AND - a bitwise AND
- OR - a bitwise OR
- EOR - a bitwise exlusive OR
- ADD - addition
- SUB - subtraction
- MUL - multiplication
- DIV - division (division by 0 is undefined)
-
- To cycle through the ops use the right-mouse-button (RMB).
-
- The Argument Gadgets: These are the two string gadgets where you
- enter the two arguments. The format can be:
-
- Decimal - No prefix
- 10 - ok
- 1a - wrong
-
- Hexadecimal - Prefixed with either the C-style '0x' or the asm '$'
- $F8 - ok
- 0xf8 - ok
- xf8 - wrong
-
- Binary - Prefixed with '%'
- %10001 - ok
- %1a11 - wrong
- %1234 - wrong
-
- - All values are automatically converted to type 'signed long' (32-bit).
-
- - A 1's complement NOT will be done on numbers prefixed with '~'.
-
- ~100 --> -101
- ~0x64 --> 0xFFFFFF9B
- ~%1100100 --> %11111111111111111111111110011011
-
- - Any number prefixed with '-' will be negated (2's complement)
-
- -100 --> -100
- -0x64 --> 0xFFFFFF9C
- -%1100100 --> %11111111111111111111111110011100
-
- - Any number suffixed with '>>n' or '<<n' will be right/left shifted
- n times
-
- 100<<1 --> 200
- 100>>1 --> 50
-
- * NOTE: there should be no spaces between the pre/suffixes.
-
- Precedence: shift then not or neg then op.
-
- ~-$64<<1 --> $C7
- a) $64<<1 = $C8
- b) -$64<<1 = -$C8 = $FFFFFF38
- c) ~-$64<<1 = ~$FFFFFF38 = $C7
-
- Results: They are printed in hex, dec, and bin.
-
- Have fun,
- John Corigliano
- jcorig@strauss.udel.edu
-