M I D A S 0 . 0 Copyright (c) 1988 Pro Domo Software, Inc. MIDAS is a four-function calculator built to run under Windows. It performs eponymous MultIplication, Division, Addition and Subtraction, with percentages, square roots and negation. There's a single memory register. Results may be displayed in fixed or exponential format, sent to the printer or appended to a text file. MIDAS will use a numeric coprocessor (8087, 80287 or 80387) if your system has one; otherwise be sure the file win87em.exe is in your current directory or search path. MIDAS is a toe in the water, a way of trying out the WINDOWS programming environment. It may serve as the basis for a salable calculator or suite of calculators. Feel free to use it, but please note that it's copyrighted and may not be sold or otherwise put to commercial use without permission from Pro Domo Software. The usual disclaimers apply: Pro Domo doesn't guarantee MIDAS in any way and abjures all responsibility for losses incurred by its use. But if you find a bug, or have suggestions for improvements or new features, please send a note to CompuServe ID 74156,3262. We'll do our best. Suffern, NY 8/18/1988 =================================================================== 1.0 Data Entry Enter data as a sequence of keypresses. Mouse users should place the cursor on the calculator key they want to press, then click the left button. The most recently selected key is highlighted. Here are the keys and their functions: 0 - 9 decimal digits for numeric entry . decimal place for numeric entry * multiply / divide + add - subtract = display result of a pending calculation % do percentage calculations sqt take square root of current entry +/- change sign of current entry CE clear current entry AC clear all registers, including memory M+ add current entry to contents of memory register M- subtract current entry from contents of memory register MR copy contents of memory register to current entry MR comes to life only when there's a value in memory; otherwise it's grayed out. Memory is cleared by clicking on AC or by taking the first choice in the Memory menu. You may prefer to use the keyboard for data entry. (Note that the keypad is not supported.) The following functions are available via the PC's function keys: F1 CE F2 AC F3 M+ F4 M- F5 MR F6 +/- F7 sqt Pressing an unassigned key on the PC's keyboard has no effect. 2.0 Data Display The current entry is displayed on a single line. This display is never empty: when cleared, it's reset to zero. Whatever the value shown, the display line contains a total of sixteen characters: blanks, minus signs, decimal points, commas and/or decimal digits. Two single-character windows appear to the left and right of the display line. When there's a value in the memory register, the letter 'm' appears in the leftmost window. The window on the right displays the symbol for a pending operation -- for example, if you enter a number and click on '+', a '+' appears in the rightmost window. The Display menu lets you choose either of two display formats: fixed or exponential. 2.1 Fixed Format (default) MIDAS wakes up in this display mode. You can choose fixed format explicitly by clicking on the entry "Fixed-Point" under the Display rubric. In fixed format the current entry takes the form of a right-justified decimal number. A decimal point is always present, even if no digits follow it. Trailing zeros are suppressed. A minus sign precedes negative numbers. When fixed format is in effect, you can choose "Commas" from the Display menu. This option adds commas to group digits by threes. Choosing "Commas" won't add commas to the line currently on display; the new mode takes effect with the next value shown. If a fixed-format entry overflows the display line, the calculator lets you switch to exponential format. 2.2 Exponential Format To switch to exponential format, click on the entry "Exponential" under Display. Here the current entry has two parts, a fraction and an exponent. The fraction is a decimal number with one digit to the left of the decimal point, the exponent an integer value of no more than three digits. These two parts are separated by at least one blank space. The value displayed is understood to be the value of the fraction multiplied by the number 10 raised to the power shown as the exponent -- i.e., 8.95789 2 is 8.95789 times 10 to the second power, or 8.95789 times 100, or 895.789. Put more simply the 2 tells you to move the decimal point 2 places to the right. The exponent can take a negative value. 1.234 -2 is 1.234 times 10 to the power -2, or 1.234 times .01, or .01234. Since -2 is negative, the decimal point is moved to the left. The fraction too can be negative. -1.234 -2 is -1.234 times 10 to the power -2, or -1.234 times .01, or -.01234. You can't enter data in exponential format; it's a display mode only. As with "Commas," selecting this format doesn't change the current display. Exponential format begins with the next value entered. 3.0 Calculator Operations The calculator has two DATA REGISTERS, one MEMORY REGISTER and one OPERATOR REGISTER. Each data or memory register can hold any value from about 1.7e-308 to about 1.7e+308 -- ie, from .0...17 to 17...0, where the ellipsis stands for 306 zeros. Numbers are often rounded to fit the display window, but rounding doesn't affect their internal representation. The operator register stores symbols that identify functions like + or - . 3.1 Data Registers and the Operator Register We'll call the data registers the X REGISTER and the Y REGISTER. The X register always contains the value shown in the calculator's display line. The Y register gets a value when you key in a calculation that combines two numbers, like 123 + 456. In that particular case, Y holds the value 123 and X holds 456. 123 and 456 are called OPERANDS; the OPERATOR, +, is stored in the operator register. Let's consider this key sequence in more detail: 123+456= When you click on 1 and 2 and 3, the calculator uses the digits to build the value one hundred and twenty-three in the X register. When you enter + it puts + in the operator register. When you enter the 4, it moves 123 from the X register to the Y register and begins building another X-register value. Finally, when you enter = it applies the saved + operator to the two operands and puts the result back in X. If you clicked on - instead of = , the calculator would apply the saved + operator to the two operands, put the result in the X register, and save - in the operator register -- you'd be starting a new operation on top of the first one. Here's a list of the calculator functions that use the X and Y registers. 3.1.1 * (multiplication): multiply X and Y registers, leave result in X. 3.1.2 / (division): divide Y by X, result in X. 3.1.3 + (addition): add X and Y, result in X. 3.1.4 - (subtraction): subtract X from Y, result in X. 3.1.5 % (percentage): relatively subtle. The operation Y OP X % yields Y * ( 1 OP ( X / 100 ) ) where OP is one of the operators + - / or * . The result of this operation goes into X. 3.1.6 = (result): carry out a pending Y OP X operation and leave the result in X. 3.1.7 SQT (square root, function key F7): replace the value in X with its square root. 3.1.8 +/- (change sign, function key F6): change the sign of X. This change is immediately reflected in the display; you can change the sign of the displayed value and continue entering digits. 3.2 Memory Register The memory register holds a single value. You can perform the following operations on or with this value: 3.2.1 Clear the memory register. This sets its contents to zero, grays the M+ and M- keys, and makes it impossible to recall the register's contents. To clear, click on the Memory menu and select the "Clear Memory" option. 3.2.2 Add X register's contents to memory register. Use calculator key M+ or PC function key F3. If the memory register has been cleared, this brings it back to life. If you enter a series of keystrokes like 123+456 and then click on the M+ or M- key, the pending calculation will be performed, its results saved to X, and the new value of X added to or subtracted from the memory register. 3.2.3 Subtract X register's contents from memory register. Use calculator key M- or function key F4. Again, this restores a cleared memory register. See additional comments in 3.2.2. 3.2.4 Recall the memory register's value with MR or F5. This replaces the X register's current value with that stored in memory. 3.2.5 Inspect the memory register. To see its current contents, click on Memory and select "Display." 3.3 Other Functions 3.3.1 AC (function key F2): clear all registers including memory. 3.3.2 CE (function key F1): clear only the current entry (i.e., the X register). This function usually serves to delete a mistyped number without losing a pending calculation. The keystrokes 123+446456= produce the same result as 123+456= 4.0 Keeping Records 4.1 Printing to Paper To keep track of your calculations, click on the Print menu and choose "Enable Printer". What's sent to the printer will look like the tape printed by a desktop calculator. Windows spools output to the printer. This means that nothing will be printed till you've filled an output page, or until you switch off the printer (again, via the Print menu). And the output isn't continuous in a spatial sense: room is left for page breaks. Printing to a file is a better way to blaze a trail through your calculations. 4.2 Printing to a Text File To send output to a file, click on Print and choose "Print to File CALCTAPE.TXT". As you might expect, output simulating a calculator tape goes to a file named CALCTAPE.TXT in the current directory. If the file already exists, new output will be appended to it. You can later print the file or view it with the Notepad utility. 5.0 HELP Click on the Help heading and you'll get a brief listing of MIDAS's functions and function keys.