═══ 1. BCD Calculator Overview ═══ The BCD Calculator is a simple four-function desktop calculator that is intended to demonstrate the facilities and functions of the BCD Class object. The calculator resembles other Windows and PM Calculators with a keypad and standard arithmetic function keys. The big difference is that it operates on integers of up to 32 decimal digits in length. Since this version does not have floating point, you probably wouldn't want to replace your favorate desktop calculator. Besides, I can't imagine anyone needing 32 digit arithmetic to balance their checkbook, even in countries with currencies that have very small unit values. ═══ 1.1. Registers ═══ Three registers are displayed at the top of the calculator: o Memory o Accumulator o Entry The registers are more or less conventional except that all three are displayed. The Memory register is set from the Accumulator and Memory Recall returns it's data to the Entry register. The Accumulator is set as a result of some process on data from the Entry register. ┌──────────Sh Right Cpld───────────┐ │ ┌───────────┐ ┌──────────┐ │ ┌──────────┐ └─>┤ │ │ ├──┘ │ │ KeyPad───>┤ Entry ├────>┤ Accum ├────>┤ Memory ├──┐ ┌──>┤ │ │ │ │ │ │ │ └───────────┘ └──────────┘ └──────────┘ │ └───────────────Memory Recall────────────────────────┘ The Entry register is set from the keyboard, from a memory recall, or from the low-order digits from the accumulator on a Shift Right-Coupled operation. The Entry register has a "constant" capability such that its contents will be retained after an arithmetic function key is pressed so that you can add, (e.g.), the same value to the Accumulator multiple times. The Entry register will clear after the += key is pressed or if a numeric key is pressed signaling the entry of a new value. The registers are read only and cannot be set from the keyboard. However, you can mark a register and capture it's contents on the clipboard with a Ctrl-Insert. ═══ 1.2. Shift Function Keys ═══ Directly below the registers are four shift function keys. These are not particularly useful on a desktop calculator and are intended to demonstrate the shift functions available in the BCD Class. The keys are: Key Description <>n Shift Accum right n places. The contents of the Accumulator are shifted right by the amount specified in the Entry register. Unlike shift left, the BCD Class will allow you to shift right up to 32 digits regardless of the contents of the Accumulator. >>n, Rnd Shift Accum right n places and round. Five is added to the nth position before it is shifted out of the Accum. If the nth digit was >= 5, the result in the Accum is increased by one. >>n, Cpld Shift Accum right n places and place the shifted digits into a "coupled" register. For the purposes of this demo, I am using the Entry register to keep the digits shifted out of the Accumulator. The same result can be obtained by doing a modulus to get the right-most digits and a divide to get the left. Shift Right Coupled on the other hand, produces both results in a single operation without using the divide algorithm and is therefore much faster. ═══ 1.3. Conventional Keys ═══ The keys below the shift functions are a set of conventional calculator keys: o Numeric key pad. o Delete key which removes the last digit entered. o Arithmetic function keys. o A += key which clears the Entry register after adding it's contents to the Accumulator. o The Memory +,-,Clear and Recall keys. o Clear/Clear Entry keys. ═══ 1.4. For Further Information ═══ For further information on the BCD Class please contact: Bill Connors JBC Enterprises, Inc. (301)330-8223 CompuServe: 73124,1260