Class polarDust.calculator.Processor01
All Packages Class Hierarchy This Package Previous Next Index
Class polarDust.calculator.Processor01
java.lang.Object
|
+----polarDust.calculator.Processor01
- public class Processor01
- extends Object
- implements CalcCPU, CalcConstants
This class is an equivalent of a microprocessor in a calculator (minus the
display logic). It executes commands and is capable of sending messages
to a display unit (panel).
Logic organization:
2 number registers (double): R1, R2,
1 memory register (double): RM.
This class can be further broken down into:
a Command Control Unit (CCU),
an Arithmetic and Logic Unit (ALU) and
Registers
The source code.
- Version:
- 0.9, 1996.06.04
- Author:
- Sorin Lazareanu
-
Processor01(CalcDisplay)
- Creates a new Processor01 object.
-
acos()
- R1 = arccos(R1)
-
add()
- R1 = R1 + R2
-
asin()
- R1 = arcsin(R1)
-
atan()
- R1 = arctan(R1)
-
binary(int)
-
-
c()
- Clear all registers.
-
ce()
- Clear entry (R1 = 0).
-
cos()
- R1 = cos(R1)
-
digit(int)
- Performs the calculations for a digit input.
-
div()
- R1 = R2 / R1
-
dot()
- Inputs a decimal point.
-
e()
- R1 = 2.71828...
-
equ()
- Enter or result (=sign ).
-
exp()
- R1 = e^R1
-
inv()
- R1 = 1 / R1
-
ln()
- R1 = ln(R1)
-
log()
- R1 = log(R1)
-
madd()
- Add to memory.
-
mc()
- Memory register (RM) clear.
-
mr()
- Memory read.
-
msub()
- Substract from memory.
-
mul()
- R1 = R1 * R2
-
opRegAssign(int)
-
-
pi()
- R1 = 3.14156...
-
pow()
- R1 = R2 ^ R1
-
prc()
- Percent operator.
-
reg1Assign(double)
-
-
reg1AssignWithDecimals(double, int)
-
-
reg1Show(double)
-
-
reg1ShowWithDecimals(double, int)
-
-
regMAssign(double)
-
-
result(int)
-
-
sgn()
- Toggles the sign of the current number (R1 = -R1).
-
sin()
- R1 = sin(R1)
-
sqr()
- R1 = R1 * R1
-
sqrt()
- R1 = square_root(R1)
-
sub()
- R1 = R2 - R1
-
swap()
- Swap registers (R1 with R2).
-
tan()
- R1 = tan(R1)
-
unary(int)
-
Processor01
public Processor01(CalcDisplay aDisplay)
- Creates a new Processor01 object. Uses a display.
- See Also:
- CalcDisplay
digit
public void digit(int iDigit)
- Performs the calculations for a digit input.
- Parameters:
- iDigit - 0...9
dot
public void dot()
- Inputs a decimal point.
sgn
public void sgn()
- Toggles the sign of the current number (R1 = -R1).
c
public void c()
- Clear all registers.
mc
public void mc()
- Memory register (RM) clear.
equ
public void equ()
- Enter or result (=sign ).
prc
public void prc()
- Percent operator.
For more information see
the source code method result.
ce
public void ce()
- Clear entry (R1 = 0).
mr
public void mr()
- Memory read.
madd
public void madd()
- Add to memory.
msub
public void msub()
- Substract from memory.
swap
public void swap()
- Swap registers (R1 with R2).
inv
public void inv()
- R1 = 1 / R1
pi
public void pi()
- R1 = 3.14156...
e
public void e()
- R1 = 2.71828...
ln
public void ln()
- R1 = ln(R1)
log
public void log()
- R1 = log(R1)
exp
public void exp()
- R1 = e^R1
sqrt
public void sqrt()
- R1 = square_root(R1)
sqr
public void sqr()
- R1 = R1 * R1
sin
public void sin()
- R1 = sin(R1)
asin
public void asin()
- R1 = arcsin(R1)
cos
public void cos()
- R1 = cos(R1)
acos
public void acos()
- R1 = arccos(R1)
tan
public void tan()
- R1 = tan(R1)
atan
public void atan()
- R1 = arctan(R1)
add
public void add()
- R1 = R1 + R2
sub
public void sub()
- R1 = R2 - R1
mul
public void mul()
- R1 = R1 * R2
div
public void div()
- R1 = R2 / R1
pow
public void pow()
- R1 = R2 ^ R1
unary
protected void unary(int iCurrentOp)
binary
protected void binary(int iNextOp)
result
protected void result(int iNextOp)
regMAssign
protected void regMAssign(double dArg)
reg1ShowWithDecimals
protected void reg1ShowWithDecimals(double dArg,
int iDecimals)
reg1AssignWithDecimals
protected void reg1AssignWithDecimals(double dArg,
int iDecimals)
reg1Show
protected void reg1Show(double dArg)
reg1Assign
protected void reg1Assign(double dArg)
opRegAssign
protected void opRegAssign(int iOperator)
All Packages Class Hierarchy This Package Previous Next Index