home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / utilities / bitopv2.2.lha / bitop.doc < prev    next >
Encoding:
Text File  |  1995-02-02  |  2.2 KB  |  80 lines

  1. Bitop is a handy little tool for programmers. It's uses are:
  2.  
  3.     1. As a bit-mask tool. Create and edit bitmasks in decimal,
  4.        hexadecimal, or binary.
  5.        
  6.     2. As a hex-dec-bin converter.
  7.     
  8.     3. As a simple calculator.
  9.  
  10. To use Bitop, run it from cli or WorkBench - I have it assigned to
  11. the numeric ')' key in my text editor so it's always handy.
  12. Bitop opens its own window.
  13.  
  14. The Title Bar: This will show the current operation that will be
  15. performed on the numbers in the argument gadgets (if no number is
  16. present in either of the argument gadgets, a '0' is assumed). The
  17. possible operations are:
  18.  
  19.     AND - a bitwise AND
  20.     OR  - a bitwise OR
  21.     EOR - a bitwise exlusive OR
  22.     ADD - addition
  23.     SUB - subtraction
  24.     MUL - multiplication
  25.     DIV - division (division by 0 is undefined)
  26.  
  27. To cycle through the ops use the right-mouse-button (RMB).
  28.  
  29. The Argument Gadgets: These are the two string gadgets where you
  30. enter the two arguments. The format can be:
  31.  
  32.     Decimal     - No prefix
  33.            10     - ok
  34.            1a     - wrong
  35.  
  36.     Hexadecimal - Prefixed with either the C-style '0x' or the asm '$'
  37.            $F8    - ok 
  38.            0xf8   - ok
  39.            xf8    - wrong
  40.     
  41.     Binary      - Prefixed with '%'
  42.            %10001 - ok
  43.            %1a11  - wrong
  44.            %1234  - wrong
  45.  
  46.     - All values are automatically converted to type 'signed long' (32-bit).
  47.  
  48.     - A 1's complement NOT will be done on numbers prefixed with '~'.
  49.     
  50.         ~100      --> -101
  51.         ~0x64     --> 0xFFFFFF9B
  52.         ~%1100100 --> %11111111111111111111111110011011
  53.  
  54.     - Any number prefixed with '-' will be negated (2's complement)
  55.     
  56.         -100      --> -100
  57.         -0x64     --> 0xFFFFFF9C
  58.         -%1100100 --> %11111111111111111111111110011100
  59.  
  60.     - Any number suffixed with '>>n' or '<<n' will be right/left shifted
  61.       n times
  62.       
  63.         100<<1   --> 200
  64.         100>>1   --> 50
  65.  
  66.     * NOTE: there should be no spaces between the pre/suffixes.
  67.  
  68.     Precedence: shift then not or neg then op.
  69.     
  70.         ~-$64<<1  --> $C7
  71.                 a) $64<<1   = $C8
  72.                 b) -$64<<1  = -$C8 = $FFFFFF38
  73.                 c) ~-$64<<1 = ~$FFFFFF38 = $C7
  74.  
  75. Results: They are printed in hex, dec, and bin.
  76.  
  77. Have fun,
  78. John Corigliano
  79. jcorig@strauss.udel.edu
  80.