home *** CD-ROM | disk | FTP | other *** search
/ ST-Computer Leser 1998 October / STC_CD_10_1998.iso / UTILITY / COLACALC / COLACALC.TXT < prev   
Text File  |  1998-09-26  |  14KB  |  337 lines

  1.                             ColaCalc (Version 1.3)
  2.                                  by Dan Wilga
  3.  
  4.           Copyright ╜ 1995, Gribnif Software.  All Rights Reserved.
  5.  
  6. This program may be distributed without charge, provided that this text
  7. file is present and that it and the program files are unmodified.
  8.  
  9.  
  10. ChocolateWare
  11. -------------
  12.  
  13. This program was originally ColaWare (duh!), but it's now ChocolateWare.
  14. If you find it useful, you are encouraged to show your appreciation by
  15. sending a quantity of chocolate candy to the address below. What kind and
  16. how much are up to you. Please just limit yourself to chocolate, either
  17. with or without nuts (no fruits or liquers, please).
  18.  
  19.   Dan Wilga
  20.   Gribnif Software
  21.   PO Box 779
  22.   Northampton, MA  01061
  23.  
  24.      GEnie: GRIBNIF
  25.   Internet: gribnif@genie.geis.com
  26.  
  27.  
  28. Overview
  29. --------
  30.  
  31.   What? ANOTHER calculator? Yup, another calculator. But this one's
  32.   different, I promise!
  33.  
  34.   There are a number of really good calculator programs out there for the
  35.   ST.  Most of them just don't fit my needs for several reasons. The simple
  36.   ones don't have what I need, and the ones that do have all of the
  37.   programming functions I want are too huge, difficult to use, and take too
  38.   much memory.  And even though most of them are desk accessories, you
  39.   still can't access a desk accessory within a non-GEM program. So I've
  40.   always had to keep my old Casio calculator sitting on top of the
  41.   computer.
  42.  
  43.   Enter ColaCalc. This tiny little program (about 8k) is a full-featured
  44.   programmer's calculator. No pretty dialog box, no floating point, no
  45.   linear regression, but a calculator that's always there when you need it.
  46.   And, best of all, you can change the keys to whatever you want, you
  47.   aren't stuck with what I think are good keyboard equivalents!
  48.  
  49.   ColaCalc can be activated at a single keypress. The display occupies the
  50.   very bottom of your screen, and as such hides very little data. The
  51.   calculator functions include the standard operators, bit manipulation,
  52.   word size and base (binary, octal, decimal, or hex.) There is also a
  53.   special mode that lets you see the scan code generated by any key on the
  54.   keyboard.
  55.  
  56.   ColaCalc can even insert the value in the display into your text editor
  57.   or word processor, automagically!
  58.  
  59.   It is also designed to work in any standard video mode, as well as with
  60.   the TT, Falcon, MegaSTe, and Crazy Dots video board.
  61.  
  62.  
  63. Installation:
  64. ------------
  65.  
  66.   Run COLACALC.PRG from the desktop, or place it in your AUTO folder. If you
  67.   use a COLACALC.DAT file, then it should be in the same folder as the program.
  68.   If you are holding down the Alternate key while ColaCalc is loading, then it
  69.   will not install itself. This is a good way to keep it from installing when
  70.   it is in your AUTO folder, without having to re-boot.
  71.  
  72.   IMPORTANT: If you use the Templemon debugger, ColaCalc may not be able to
  73.   be activated. Templemon uses the same vector for monitoring the keyboard
  74.   that ColaCalc does, and it may prevent ColaCalc from seeing keypresses.
  75.   In order for ColaCalc to work, it must be placed physically after
  76.   TEMPLMON.PRG in the AUTO folder.
  77.  
  78.  
  79. Activating It:
  80. -------------
  81.  
  82.   Unless you have changed the activation keypress (see Configuration), you
  83.   can always call ColaCalc from within any program simply by pressing
  84.   Control-Undo. The only time ColaCalc may not appear is when a disk access
  85.   is occuring. To quit ColaCalc, press either Esc or Undo.
  86.  
  87.   If you call ColaCalc within a text editor or word processor, you can have
  88.   it pass the value in the display to the program, to become part of the
  89.   text. Simply hold down the Alternate key while pressing Esc or Undo to
  90.   quit. As soon as you release the Alternate key, the text editor will
  91.   receive the display value, as though it had been typed on the keyboard.
  92.   It is important that you not press any of the Shift keys while this is
  93.   going on, or the editor may become confused.
  94.  
  95.  
  96. The Display:
  97. -----------
  98.  
  99.   Here is a diagram of what the parts of the display mean:
  100.  
  101.                 ulb 10100010101010001010100010101001 XOR 1.......9.
  102.                 ||| \                              /  |  \         \
  103.                / | \  --------- number -----------    |   function key memories
  104. signed/unsigned  |  base                           operator
  105.              word size
  106.  
  107.  
  108.   All keyboard controls listed below are the defaults.
  109.  
  110.   Signed (S key); Unsigned (U key):
  111.  
  112.     These control whether or not a negative number is to be displayed with
  113.     a minus sign in front of it (signed) or if the sign bit should be
  114.     displayed as part of the number (unsigned). These can also affect
  115.     translating between word sizes (see below).
  116.  
  117.   Word Size: Byte (Alt-B); Word (Alt-W); Long (Alt-L):
  118.  
  119.     By setting the word size you affect how much of the number is
  120.     displayed.  If, for example, the display is set for Byte, the largest
  121.     value that can be displayed is FF (hex).
  122.  
  123.     When changing from a small word size to a larger one, the value is
  124.     sign-extended if the display is set to show the sign, otherwise it is
  125.     not.  This means that if, for example, you are converting FF from a
  126.     byte to a word without the sign, then this will become 00FF. If, on the
  127.     other hand, the sign is being used, FF (which shows up as -1) will
  128.     still be -1 after the extension.
  129.  
  130.   Base: Binary (Control-B); Octal (Control-O); Decimal (Control-D);
  131.       Hexadecimal (Control-H):
  132.  
  133.     These control the base to display values in. In Binary mode, large
  134.     numbers will have small circles after every eight bits to indicate the
  135.     byte boundaries.
  136.  
  137.   Number:
  138.  
  139.     The keys 0-9 and A-F (or a-f) can be used to enter numbers. The keypad
  140.     keys will also work under the default configuration.
  141.  
  142.   Function:
  143.  
  144.     This portion of the display shows what function was last entered. It may
  145.     also contain "-E-" if an error occurred; if this happens, press
  146.     Clr/Home.
  147.  
  148.   Function Key Memories:
  149.  
  150.     The F1-F10 keys can be assigned values by pressing Shift along with the
  151.     appropriate F-key. A number can be recalled later by pressing just the
  152.     function key, without Shift. If a particular function key has a
  153.     non-zero value assigned to it, this will show up in the function key
  154.     segment of the display.
  155.  
  156.   The display will not include the function key segment or the function
  157.   name if you are using low resolution.
  158.  
  159.  
  160. Miscellaneous Keys:
  161. ------------------
  162.  
  163.   =, Return, Enter      Calculate result
  164.   Undo, Esc             Quit ColaCalc
  165.   Alt-Undo, Alt-Esc     Quit and type value
  166.   Clr/Home              Clear display/Clear error
  167.   Shift-Fkey            Set memory
  168.   Fkey                  Recall memory
  169.   Backspace             Undo last digit typed
  170.   Help                  Enter/Exit Keypress mode
  171.  
  172.   The first time you press Clr/Home clears the display or any error
  173.   condition, which shows up as "-E-". If you press it a second time, any
  174.   operator still waiting to be processed is cleared.
  175.  
  176.   When in Keypress mode, the display shows the value for any shift keys
  177.   pressed, the scan code of the last key pressed, its ASCII value in hex,
  178.   and the actual character that key produces (if non-zero.) This is handy
  179.   for writing your own configuration file (see below). To exit Keypress
  180.   mode, press the Help key again.
  181.  
  182.  
  183. Operators:
  184. ---------
  185.  
  186.   Unary operators (NEG, NOT and the PEEKs) are processed immediately.
  187.   Binary operators (like + and *) are processed in the order they are
  188.   received, with the exception of * and /, which take highest precedence.
  189.   This means that:
  190.  
  191.     1 + 2 * 3      is processed as  1+(2*3)
  192.     1 * 2 + 3      is processed as  (1*2)+3
  193.     1 + 2 * 3 / 2  is processed as  1+((2*3)/2)
  194.     1 & 2 * 3      is processed as  1&(2*3)
  195.  
  196.   If the second operand is not entered for a binary operator, then the
  197.   first operand is reused. This means that:
  198.  
  199.     2 * =          is processed as  2*2
  200.     4 / =          is processed as  4/4
  201.  
  202.   A binary operator can be replaced with another by simply entering the new
  203.   operator before typing anything else. Thus:
  204.  
  205.     1 + * 4        is processed as  1*4
  206.     3 / - 2        is processed as  3-2
  207.  
  208.  Key          Operation                         Type (Unary or Binary)
  209.  ---          ---------                         ---------------------
  210.   +             Add                                       B
  211.   -             Subtract                                  B
  212.   *             Multiply                                  B
  213.   /             Divide                                    B
  214.   %             Modulo (result after division)            B
  215.   !             NOT (one's complement)                    U
  216.   Delete        NEG (two's complement)                    U
  217.   &             AND                                       B
  218.   |             OR                                        B
  219.   ^             XOR (exclusive or)                        B
  220.   left arrow    ROL (rotate left)                         B
  221.   Control-left  LSL (shift left)                          B
  222.   right arrow   ROR (rotate right)                        B
  223.   Control-right LSR/ASR (shift right)                     B
  224.   Control-P     PEEK LONG                                 U
  225.   Left Shift-P  PEEK WORD                                 U
  226.   Alt-P         PEEK BYTE                                 U
  227.  
  228.  
  229.   Both ROR and ROL act just like their equivalent 68xxx instructions. The
  230.   value to be manipulated is entered first, followed by the operator, and
  231.   then the number of bits to rotate.
  232.  
  233.   The Control-right arrow will use a logical shift if the display does not
  234.   show the sign. In Signed mode, an arithmetic shift is performed.
  235.  
  236.   The three types of PEEK work by treating the value in the display as a
  237.   pointer into the computer's memory. The value at that memory location is
  238.   then moved into the display. For PEEK WORD and PEEK BYTE, the value is
  239.   sign-extended if the Sign mode is set. Attempting to PEEK LONG or PEEK
  240.   WORD at an odd address will generate an error.
  241.  
  242.  
  243. Configuration:
  244. -------------
  245.  
  246.   When it first runs, ColaCalc looks for a file called COLACALC.DAT in the
  247.   same folder where COLACALC.PRG is, which contains configuration
  248.   information.  This file can be modified with a text editor. Each line
  249.   contains one keyboard equivalent or function key assignment. The first
  250.   part of a line must always contain data to be read by ColaCalc; the
  251.   remainder of the line is ignored and can be used for comments. Blank
  252.   lines are ignored.
  253.  
  254.   The basic layout of the file is as follows:
  255.  
  256.     Default display state
  257.     Key to activate
  258.     26 Operators and display controls
  259.     10 Function key defaults
  260.     Screen buffer size
  261.  
  262.   The first line must contain three characters for the default display, and
  263.   they must all be lowercase. All other values must either be in hex or
  264.   must be a single raw ASCII character. The various values can be separated
  265.   by spaces or tabs.
  266.  
  267.   There are two ways that keypresses can be defined: either by ASCII value
  268.   or by scan code. To define a keypress by ASCII, enter an asterisk in the
  269.   first column and the ASCII character (either the character itself or its
  270.   hex value) in the second column. To enter a keypress by its scan code,
  271.   the first column contains the shift key status, from the table below, and
  272.   the second contains the scan code:
  273.  
  274.     Key Pressed:     Value:
  275.     Right Shift        1
  276.     Left Shift         2
  277.     Control            4
  278.     Alternate          8
  279.  
  280.   For example, to specify the "p" key, you would use "* p". To specify
  281.   Control-Alternate-p, you would use "C 19" (8+4=C, and $19 is the scan
  282.   code.) The Keypress mode in ColaCalc (activated with the Help key) is
  283.   helpful for determining what values to use.
  284.  
  285.   Screen Buffer Size
  286.  
  287.   When ColaCalc first runs, it allocates all the memory it will ever use.
  288.   The largest block of memory it needs is to store the original screen
  289.   underneath the main calculator display.
  290.  
  291.   Since ColaCalc usually runs from the AUTO folder, it may not be able to
  292.   know in advance how much memory to allocate for ths buffer if you use a
  293.   Crazy Dots card or a Falcon. Why? Simply because the video mode that AUTO
  294.   folder programs run in is usually different from the final mode under
  295.   these circumstances. If the final mode happens to require more memory
  296.   than ColaCalc has already allocated (based on the size of the screen when
  297.   it ran in the AUTO folder) then the calculator display will either be at
  298.   half-height, or it will not appear at all.
  299.  
  300.   To avoid this problem, you can specify the number of bytes of video
  301.   memory that should always be allocated for the screen buffer in advance.
  302.   The last line of COLACALC.DAT contains this number, in hex. To calculate
  303.   it for a given screen resolution, use the following formula:
  304.  
  305.     screen_width_in_pixels / 8 * bitplanes * font_height
  306.  
  307.   The font_height should always be either 8 or 16. Here are some examples:
  308.  
  309.     Mode      screen_width (dec)   planes   font_height   buffer_size (hex)
  310.   ---------   ------------------   ------   -----------   -----------------
  311.   ST Low            320               4          8              500
  312.   ST Medium         640               2          8              500
  313.   ST High           640               1         16              500
  314.   TT Low            320               8         16             1400
  315.   TT Medium         640               4         16             1400
  316.   TT High          1280               1         16              A00
  317.   256-color         640               8         16             2800
  318.   32K-color         640              16         16             5000
  319.  
  320.   Note that if you are only ever going to use ST compatible video modes,
  321.   you do not need to change this value, since all ST video modes use the
  322.   same amount of memory.
  323.  
  324.  
  325. Version Changes:
  326. ---------------
  327.  
  328.   1.1:  Added Alt-Esc and Alt-Undo, for stuffing keyboard buffer.
  329.         Won't ever react to Undo followed (much later) by Control.
  330.  
  331.   1.2:  Worked on keyboard stuffing a bit.
  332.  
  333.   1.3:  Fixed ROL & ROR in several ways.
  334.         Works with the Crazy Dots and the Falcon's new video modes.
  335.         Will now always use the 8 x 16 font on larger displays, even with
  336.           things like the Crazy Dots.
  337.