
FreeDOS Resident Calculator
---------------------------


0. Table of contents
--------------------

  0. Table of contents
  1. License
  2. Short description
  3. Command line parameters
  4. Using FDRC
  5. Controls
  6. Known bugs and features
  7. Credits


1. License
----------

  FreeDOS Resident Calculator, Copyright (c) 2006 Oleg O. Chukaev

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  02111-1307, USA.
 
  FreeDOS is a trademark of Jim Hall


2. Short description
--------------------

      FreeDOS Resident Calculator (FDRC) is a resident calculator for
  programmers.  I wrote FDRC because I need some features missing in other
  TSR calculators.  This calculator will be quite useless for those who use
  Windows or Linux -- FDRC written for old good DOS (and FreeDOS).

  FDRC lacks following features:
    * Built-in help.
    * Fraction numbers support.  (Perhaps fixed point 32:32 or (better) 48:16
      will be implemented in future versions.)
    * Functions like sin, cos, ln, etc.
    * Support for graphics and monochrome video modes.
    * Mouse support.

  FDRC has following features:
    * FDRC works with 32-bit integer numbers.
    * Expressions in reverse polish notation, eg:
      2 + 3 == 2 3 +
      2 - 9 + 8 * 5 == 2 9 - 8 5 * +
      (9 / (1 + 8)) * 5 == 9 1 8 + / 5 *
    * FDRC supports following operations:
      + -- addition              & -- bitwise AND
      - -- subtraction           | -- bitwise OR
      * -- multiplication        ^ -- bitwise XOR
      / -- division              < -- logical shift left
      % -- remainder             > -- logical shift right
      \ -- square root           { -- arithmetical shift left
      ~ -- bitwise NOT           } -- arithmetical shift right
      Operations \ and ~ -- unary: not(sqrt(123)+12) == 123 \ 12 + ~.
    * FDRC show result simultaneously in decimal, hexadecimal, binary and
      string format.
    * FDRC support numerous color video modes, including 40x12, 80x25,
      90x60, 132x25, 132x43.
    * FDRC work in resident and non-resident modes.
    * Color highlighting for different parts of result.
    * History.


3. Command line parameters
--------------------------

      FDRC supports the following command line parameters (you can use `/'
  instead of `-'):

  -h       -- short help.

  -?       -- same as -h.

  -a       -- calculate result after pressing any key, not only after pressing
              <Enter>.  Note: current string will be stored in history
              only after pressing <Enter>, even in this mode.

  -c       -- clear input line when pressing any alpha-numeric key
              _immediately_ after popup.  Pressing <Delete>, <Backspace>
              or any such keys don't clears input line.

  -e       -- allow loading 2nd, 3rd,... copy of FDRC into memory.

  -n       -- non-resident mode.
              
  -w       -- prevent loading FDRC into UMB.  By default FDRC loads itself
              into UMB if they available.

  -u       -- unload.  If INT 09h and/or INT 10h intercepted by other
              program, FDRC will print warning message and exit.

  -q       -- quiet mode.  If you try to call FDRC within graphics-mode
              program, FDRC will beep twice.  If you reached 1st or last
              entry in history, FDRC will beep once.  -q switch disables
              all such sounds.

  -l:number -- column of left side of FDRC's window.
  -t:number -- row of top side of FDRC's window.
              number -- decimal number >= 0.

  -k:number -- scancode of activation key (hexadecimal).  See `rbil_i09.txt'
              for details.  Default value -- 35h (`/').

  -s:number -- code of shift keys (hexadecimal).

              ͻ
               Key          Code  Key          Code 
              Ķ
               Right Shift    01  Scroll Lock    10 
               Left Shift     02  Num Lock       20 
               Ctrl (any)     04  Caps Lock      40 
               Alt (any)      08  Insert         80 
              ͼ

              Default value -- 04 (Ctrl).  For example: RightShift+Alt ==
              == 1 + 8 == 9.

  -y:number -- number (decimal) of items in history buffer.  Default
              value -- 0.


4. Using FDRC
-------------

      Type `fdrc' to run calculator.  It will terminate and stay resident.
  Use Ctrl-/ to popup.  You can change hot-key: see chapter 3 for details.
  Type `fdrc -n' to run calculator in non-resident mode.
      When FDRC is active, you can use some keys: see chapter 5 for details.
  Use input line to enter expressions.  In expressions you can use hexadecimal
  numbers (string of hex digits, w/o any prefixes or suffixes, decimal numbers
  (w/ suffix `.'), binary numbers (w/ suffix `@'), and strings (in double
  quotes, as in C).
      In the last line of FDRC's window you can see messages about errors:

  * Parse error -- displayed when parser encountered illegal character,
    such as `.' in the string `123ab87.' or `j' in `12j6'.  Illegal character
    highlighted.

  * Stack not empty -- some numbers still on the stack after calculating
    result.  I.e. there are too few operators.

  * Stack underflow -- there are too many operators in expression.  Operator,
    which attempted to pop numbers from the stack, highlighted.

      Last line also contains history indicator: number of current string
  and arrow.  Arrow looks like diamond if there are no strings in the history.
  Up-arrow indicates that you can press Up key to get previous string,
  down-arrow -- you can press Down key to get next string, double-edged
  arrow -- you can press both Up and Down keys.
      After selecting required string by Up/Down keys you can edit it.
  Note that string in history buffer remains unchanged.  You edit the
  copy of this string.


5. Controls
-----------

      You can use the following keys:

  Numerals and letters -- enter numbers.

  " -- if you enter one double quote symbol, the second such symbol
    will be entered automatically.

  <-- and --> -- move cursor.

  ^ and v (Up and Down arrows, not the caret and `v' letter) -- previous/
    next string from history.

  Home and End -- move cursor.

  Enter -- calculate result and store it into history buffer.

  Backspace -- delete char before cursor.

  Delete -- delete char under cursor.

  Ctrl-Y -- clear string.

  Ctrl-K -- clear text to the end of string.

  You can move FDRC's window using WordStar-like keys (by default):

    Ctrl-S -- left

    Ctrl-D -- right

    Ctrl-E -- up

    Ctrl-X -- down

  or Vi-like keys (if you defined VI_KEYS constant in config.inc):

    Alt-H -- left

    Alt-L -- right

    Alt-K -- up

    Alt-J -- down

  Alt-S -- switch between signed and unsigned decimal representation of
    result.

  Esc -- exit.


6. Known bugs and features
--------------------------

  * FDRC do not check overflow.
  * Multiplication and division are unsigned.


7. Credits
----------

      Thanks to the following people:

  * Vsevolod V. Volkov for the Volkov Commander.
  * Victor Gamayunov and Sergey Pimenov for Insight.
  * Eugene Suslikov (SEN) for Hacker's View.
  * Sergey Chehuta for the Turbo Assembler Shell.
  * All people who makes FreeDOS, Linux and programs for these OSes.
  * All who helped me with code and/or ideas.


-- EOF --


