Canola  0.8.D001
Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
calculator Class Reference

#include <calculator.h>

Inheritance diagram for calculator:
calculator_asm calculator_gnome calculator_proxy calculator_test

List of all members.

Public Types

enum  program_mode_t { program_mode_learn, program_mode_operation, program_mode_program_check, program_mode_operation_check }
enum  program_selector_t { program_selector_i_ii, program_selector_i, program_selector_ii }
typedef boost::shared_ptr
< calculator
pointer

Public Member Functions

virtual ~calculator ()
virtual void on_opcode (opcode_t op, const location::pointer &where)
void on_opcode_lrn (opcode_t op, const location::pointer &where)
void on_opcode_ope (opcode_t op, const location::pointer &where)
void on_opcode_pro_che (opcode_t op, const location::pointer &where)
void on_opcode_ope_che (opcode_t op, const location::pointer &where)
void on_error (const char *fmt,...)
virtual void on_error_v (const char *fmt, va_list ap)=0
virtual void run (void)=0
program_mode_t program_mode_get (void)
void program_mode_set (program_mode_t pm)
program_selector_t program_selector_get (void) const
void program_selector_set (program_selector_t ps)
void precision_and_rounding_set (const precision_and_rounding &value)
const precision_and_roundingprecision_and_rounding_get (void) const
void clear_program (void)
bool load_program (const std::string &filename, bool binary)
void save_program_as (const std::string &filename, bool binary)
void accumulate_mode_set (bool value)
void constant_mode_set (bool value)
void program_card_walk (program_card_functor &f) const
virtual void property (const std::string &name, const std::string &value)
bool strict_memory_number_checking_required (void) const
void strict_memory_number_checking_set (bool)
bool save_memories_as_program (const std::string &filename)

Static Public Member Functions

static const char * program_mode_name (program_mode_t pm)

Protected Types

typedef boost::shared_ptr
< debugger
debugger_pointer

Protected Member Functions

 calculator ()
void update_display (void)
void clock_tick_event (void)
bool clock_tick_expected (void) const
virtual void clock_tick_start_running (void)=0
void printer_finished_event (void)
bool printer_finished_event_expected (void) const
void update_debugger (debugger &where)
void set_address (int n)
bool get_step (int addr, unsigned char &op, location::pointer &where) const

Private Types

enum  mstate_t {
  mstate_reset, mstate_lhs_digits_before_dot, mstate_lhs_digits_after_dot, mstate_lhs_complete,
  mstate_mul, mstate_mul_digits_before_dot, mstate_mul_digits_after_dot, mstate_mul_complete
}
enum  deferred_action_t { deferred_action_none, deferred_action_multiplication, deferred_action_division }
enum  clock_tick_mode_t {
  clock_tick_mode_disabled, clock_tick_mode_running, clock_tick_mode_entry, clock_tick_mode_sj,
  clock_tick_mode_ej
}
typedef std::map< std::string,
std::string > 
properties_t

Private Member Functions

virtual void derived_print (const display &value)=0
virtual void derived_feed (void)=0
virtual void derived_off (void)=0
virtual void derived_update_display (const display &value)=0
virtual void printer_timer_start_running (void)=0
bool accumulate_mode_get (void) const
void update_display_lrn (void)
void calculate_display_lrn (display &disp, int addr, int op)
void update_display_ope (void)
unsigned char next_opcode (void)
unsigned find_flag_jump (unsigned char label)
unsigned wrap_address (unsigned addr) const
void update_display_lamps (display &value)
void execute_one_instruction (void)
void program_print (void)
unsigned find_subroutine_flag_jump (unsigned char label)
location::pointer next_location (void) const
void constant_mode_eval (bool neg)
void non_constant_mode_eval (bool neg)
void eval (bool neg)
void eval_mul (bool neg)
std::string get_property (const std::string &name, const std::string &dflt="") const
bool get_bool_property (const std::string &name, bool dflt=false) const
bool have_property (const std::string &name) const
void maybe_accumulate (void)
 calculator (const calculator &)
calculatoroperator= (const calculator &)

Static Private Member Functions

static const char * mstate_name (mstate_t s)

Private Attributes

mstate_t mstate
precision_and_rounding precro_front_panel
precision_and_rounding precro_current
number x_register
number y_register
number memory [16]
program_selector_t program_selector
unsigned char address
unsigned char programme [256]
location::pointer programme_location [SIZEOF(programme)]
program_mode_t program_mode
interpose::pointer interpose_by_program_mode [4]
deferred_action_t deferred_action
clock_tick_mode_t clock_tick_mode
bool printer_delay_active
bool accumulate_mode
std::list< unsigned > call_stack
bool constant_mode
deferred_action_t constant_mode_action
number constant_mode_rhs
properties_t properties
bool strict_memory_number_checking
int number_of_keys_since_ej

Detailed Description

The calculator class is used to represent the interface to a general state of the 1614p emulation. It isn't necessarily a Gnome widget.

Definition at line 43 of file calculator.h.


Member Typedef Documentation

typedef boost::shared_ptr<debugger> calculator::debugger_pointer [protected]

Definition at line 422 of file calculator.h.

typedef boost::shared_ptr<calculator> calculator::pointer

Definition at line 46 of file calculator.h.

typedef std::map<std::string, std::string> calculator::properties_t [private]

Definition at line 886 of file calculator.h.


Member Enumeration Documentation

Enumerator:
clock_tick_mode_disabled 
clock_tick_mode_running 
clock_tick_mode_entry 
clock_tick_mode_sj 
clock_tick_mode_ej 

Definition at line 693 of file calculator.h.

Enumerator:
deferred_action_none 
deferred_action_multiplication 
deferred_action_division 

Definition at line 655 of file calculator.h.

enum calculator::mstate_t [private]

The mstate_t type is used to describe the state machine used to digit keys and arithmetic keys. The state machine implementation can be found in the on_opcode_ope method.

Enumerator:
mstate_reset 

This is the state the calculator is in when it is reset. It is also the state entered after a [+=] or [-=] key. As such, this state does not imply that x_register or y_register are zero (they could be, but don't assume they are).

mstate_lhs_digits_before_dot 
mstate_lhs_digits_after_dot 
mstate_lhs_complete 
mstate_mul 
mstate_mul_digits_before_dot 
mstate_mul_digits_after_dot 
mstate_mul_complete 

Definition at line 511 of file calculator.h.

The Program Mode Switch controls how the calculator interprets key strokes, either storing a program, or operating as a calculator, or running a program.

See the 1614P Instruction Manual, p. 13.

Enumerator:
program_mode_learn 

"1) LRN (Learn) When storing a program, manually using the keyboard, and when a program card is read into the calculator or when clearing a program, the switch is set in this position,"

program_mode_operation 

"2) OPE (Operation) (i) The switch is set in this position when a program calculation is executed using actual data. (ii) The switch is also set in this position when an ordinary manual calculation is made."

program_mode_program_check 

"3) PRO CHE (Program Check) (i) The switch is set in this position when checking the contents of a stored program. (ii) The switch is also set in this position when partial correction to the program is to be made."

program_mode_operation_check 

"4) OPE CHE (Operation Check) Use this position for effecting calculation at each step in accordance with the contents of the stored program, so that results may be checked at each step."

Definition at line 146 of file calculator.h.

The Program Selector Switch controls the portion of the calculator's program memory to be used.

See the 1614P Instruction Manual, p. 13.

"When storing a program, executing a program calculation, and checking or clearing a program, program ranges are selected by this switch"

Enumerator:
program_selector_i_ii 
program_selector_i 
program_selector_ii 

Definition at line 208 of file calculator.h.


Constructor & Destructor Documentation

calculator::~calculator ( ) [virtual]

The destructor.

Definition at line 31 of file calculator.cc.

calculator::calculator ( ) [protected]

The default constructor. For use by derived classes only.

Definition at line 36 of file calculator.cc.

calculator::calculator ( const calculator ) [private]

The copy constructor. Do not use.


Member Function Documentation

bool calculator::accumulate_mode_get ( void  ) const [private]

The accumulate_mode_get method may be used to obtain the state of the accumulate_mode instance variable.

Definition at line 490 of file calculator.cc.

void calculator::accumulate_mode_set ( bool  value)

The accumulate_mode_set method may be used to change the state of the accumulate_mode instance variable.

Parameters:
valueThe new accumulate mode setting.

Definition at line 498 of file calculator.cc.

void calculator::calculate_display_lrn ( display disp,
int  addr,
int  op 
) [private]

The calculate_display_lrn method is used to calculate what would be displayed and/or printed for the given opcodes.

Parameters:
dispThe retiurned constructed display value.
addrThe address of the opcode (1..240)
opThe opcode of interest (0..127)

Definition at line 44 of file update_display.cc.

void calculator::clear_program ( void  )

The clear_program method is used to remove the program from the selected bank.

Definition at line 23 of file load_program.cc.

void calculator::clock_tick_event ( void  ) [protected]

The clock_tick_event method is used to inform the claculator that a clock tick has occurred. This is used to run the program steps, when in Program Mode OPE and the user has pressed the Start button. Unexpected clock tick events will be discarded.

Use the clock_tick_expected method if you need to know whether or not to re-trigger the clock tick from your callback handler.

Definition at line 406 of file calculator.cc.

bool calculator::clock_tick_expected ( void  ) const [protected]

The clock_tick_expected method may be used to determine whether or not the calculator thinks the instruction clock is ticking.

Definition at line 451 of file calculator.cc.

virtual void calculator::clock_tick_start_running ( void  ) [protected, pure virtual]

The clock_tick_start_running method is called by the calculator to inform the derived class that it should kick off a clock tick idle handler. This will happen when opcode_extended_start is seen, for example. Derived classes should not assume when clocks stop and start, instend they will be explicitly informed via this method.

Implemented in calculator_gnome, calculator_asm, calculator_test, and calculator_proxy.

void calculator::constant_mode_eval ( bool  neg) [private]

The constant_mode_eval method is used to evaluate a += or -= key, when the [K] constant key is down.

Parameters:
negfalse if +=, true if -=

Definition at line 41 of file on_opcode_ope.cc.

void calculator::constant_mode_set ( bool  value)

The consatant_mode_set method is used to select the constant mode setting, to reflect the state of the [K] key.

Instruction Manual, p. 10

"This key is for constant multiplication and division. When it is depressed, it locks and function state is attained.

"Internal calculation is performed in the normal procedure. Thereafter constant multiplication and division can be made by operating the numeric and [+=] keys.

"In the case of multiplication, the multiplicant is a constant, and in the case of division, the divisor is a constant.

"This key is also used in involutions. The "n"th power of a figure is obtain by depressing the [+=] key (n-1) times. Thus, a [x] [+=] [+=] [+=] [+=] gives a5.

Definition at line 505 of file calculator.cc.

virtual void calculator::derived_feed ( void  ) [private, pure virtual]

The derived_feed method is used to implement the FD opcode, in the cases where it is valid.

Implemented in calculator_gnome, calculator_proxy, calculator_asm, and calculator_test.

virtual void calculator::derived_off ( void  ) [private, pure virtual]

The derived_off method is used to implement the OFF key.

Implemented in calculator_gnome, calculator_proxy, calculator_asm, and calculator_test.

virtual void calculator::derived_print ( const display value) [private, pure virtual]

The derived_print method is used to implement the PRINT opcode, in the cases where it is valid.

Parameters:
valueThe value to be printed.
Note:
FIXME: this will not serve, once we start printing program listings.

Implemented in calculator_gnome, calculator_proxy, calculator_asm, and calculator_test.

virtual void calculator::derived_update_display ( const display value) [private, pure virtual]

The derived_update_display method is used when interpreting opcodes to indicate that the display needs to be updated to track the calculator's internal state.

Parameters:
valueThe value to be displayed by the calculator display.

Implemented in calculator_gnome, calculator_proxy, calculator_asm, and calculator_test.

void calculator::eval ( bool  neg) [private]

The eval method is used to evaluate a += or -= key press.

Parameters:
negfalse if +=, true if -=

Definition at line 91 of file on_opcode_ope.cc.

void calculator::eval_mul ( bool  neg) [private]

The eval_mul method is used to evaluate a multiplication or division, in response to a += or -= key press.

Parameters:
negfalse if +=, true if -=

Definition at line 101 of file on_opcode_ope.cc.

void calculator::execute_one_instruction ( void  ) [private]

The execute_one_instruction method is used by clock_tick_event and on_opcode_ope_che to execute the next instruction.

"[ENT] Entry Key

"This program key is used to store a temporary stop program instruction when programming in manual LRN. During execution of program at this instruction the program stops and the ENTRY lamp lights.

"It is used for the following: 1) Entry instruction to put the calculator in stand-by state for entry. 2) Temporary stop instruction for reading calculation results."

"[SJ] Sense Jump Key

"This program key is used for both manual program storage [LRN] and executing a program [OPE].

1) When storing a program: If this key is manually depressed, a sense jump instruction SJ is stored in the program, 2) When executing a program: If this key is manually depressed at the SJ instruction in the program, the program will jump to the specified program step. If the [START] key is depressed the program will proceed to the following step. The ENTRY lamp lights at this instruction."

"[EJ] Entry Jump Key

"Like MJ and UJ instructions, this key is used for manual program storage.

"When this key is depressed with the Program Mode Switch in LRN position, an entry jump instruction EJ is stored in the program.

"During execution of a program at this instruction, the program stops to await entry of data and the ENTRY lamp lights. When an entry is made and the [START] key is depressed, a jump is accomplished to the specified program step; when the [START] key is depressed without entry, the program proceeds without jumping."

"[MJ] Minus Jump Key

"Used for manual storing of programs. When this key is depressed, a minus jump instruction MJ is stored in the program.

"Minus jump instruction automatically judges the calculation results at the step immediately before this instructon is programmed; if the value is zero or positive it proceeds as it is, and if it is negative, it jumps to the specified program step."

"[UJ] Unconditional Jump Key

"This key is used to store a manual program and to execute programmed calculation.

1) Storing program: With the program mode switch set to LRN, depressing this key during manual operation stores the unconditional jump (UJ) instruction in the program.

2) Executing programmed calculation: With the program mode switch set to OPE, pushing UJ n (entry keys [0] to [9]) causes a jump to the jump destination specified in the FJ n step instruction. This key isused for program subdivision and in programs involving a relatively large number of decisions. Refer to information on decision functions for details."

"[FJ] Flag Jump Key

"This key is used in manual storing of programs in combination with [SJ], [EJ], [MJ], and [UJ] keys.

"If this key is depressed with Program Mode Switch set in LRN position, a flag for jump instruction is given, and a jump destination specifying instruction FJ is stored in the program. Each FJ instruction and the corresponding SJ, EJ, MJ or UJ instruction are accompanied by an identical flag code."

Note: actually, the flag value can be almost anything. Digits are merely very convenient, and not as confusuing as other alternatives.

Definition at line 25 of file execute_one_instruction.cc.

unsigned calculator::find_flag_jump ( unsigned char  label) [private]

The find_flag_jump method is used to scan the address space, looking for the given flag label (i.e. opcode_fj followed by this value).

Parameters:
labelThe flag jump label to look for
Returns:
The address of the opcode following the flag jump, or the lowest address in the address space if not found.

Definition at line 280 of file calculator.cc.

unsigned calculator::find_subroutine_flag_jump ( unsigned char  label) [private]

The find_subroutine_flag_jump method is used to scan the address space, looking for the given subroutine flag label (i.e. opcode_sfj followed by this value).

Parameters:
labelThe subroutine flag jump label to look for
Returns:
The address of the opcode following the subroutine flag jump, or the lowest address in the address space if not found.

Definition at line 359 of file calculator.cc.

bool calculator::get_bool_property ( const std::string &  name,
bool  dflt = false 
) const [private]

The get_bool_property method is used to obtain a specific named boolean property from the set of properties.

Parameters:
nameThe name of the property
dfltThe value ot be used if the property is not available.

Definition at line 479 of file program_card_visit.cc.

std::string calculator::get_property ( const std::string &  name,
const std::string &  dflt = "" 
) const [private]

The get_property method is used to obtain a specific named property from the set of properties.

Parameters:
nameThe name of the property
dfltThe value ot be used if the property is not available.

Definition at line 468 of file program_card_visit.cc.

bool calculator::get_step ( int  addr,
unsigned char &  op,
location::pointer where 
) const [protected]

The get_step method is used to obtain a particular step of the program.

Parameters:
addrThe address of interest.
op(Output) the opcode at he given location.
where(Output) the source file location of the opcode.

Definition at line 23 of file get_step.cc.

bool calculator::have_property ( const std::string &  name) const [private]

The have_property method is used to determine whether or not the named property is available.

Parameters:
nameThe name of the property

Definition at line 459 of file program_card_visit.cc.

bool calculator::load_program ( const std::string &  filename,
bool  binary 
)

The load_program method may be used by derived classes to load a program (actually, an opcode stream) from a file. Errors are reported via the on_error method.

Parameters:
filenameThe file to load the programme from.
binaryWhether or not the file is binary (true) or text (false).
Returns:
true on success, false if there are any errors.

Definition at line 53 of file load_program.cc.

void calculator::maybe_accumulate ( void  ) [private]

The maybe_accumulate method is used to implement the [AM1] mode behaviour. Addition or subtraction are automagically added to M1 on [+=] or [-=]. However, multiplication and division do NOT change M1 on [+=] or [-=].

Definition at line 23 of file on_opcode_ope.cc.

const char * calculator::mstate_name ( mstate_t  s) [static, private]

Definition at line 66 of file calculator.cc.

location::pointer calculator::next_location ( void  ) const [private]

The next_location method is used to obtain the location corresponding to the next programme location to be executaed (see address). The return value could be NULL, meaning no information is available.

Definition at line 269 of file calculator.cc.

unsigned char calculator::next_opcode ( void  ) [private]

The next_opcode method is used to fetch the next opcode from programme and then advance the address by one, wrapping as required.

Definition at line 257 of file calculator.cc.

void calculator::non_constant_mode_eval ( bool  neg) [private]

The non_constant_mode_eval method is used to evaluate a += or -= key, when the [K] constant key is NOT down.

Parameters:
negfalse if +=, true if -=

Definition at line 81 of file on_opcode_ope.cc.

void calculator::on_error ( const char *  fmt,
  ... 
)

The on_error method is used to present an error to the user. The original 1614P did not have this facility, but it sure makes some stuff much easier.

The default implementation prints the error on the standard output. Derived classes may choose to overload it.

Parameters:
fmtThe format of the error message. It controls the number and types of arguments following; see printf(3) for more information.

Definition at line 168 of file calculator.cc.

virtual void calculator::on_error_v ( const char *  fmt,
va_list  ap 
) [pure virtual]
void calculator::on_opcode ( opcode_t  op,
const location::pointer where 
) [virtual]

The on_opcode method is used to process a key that corresponds to an opcode. This is most of the keys on the keyboard, but none of the controls above the keys.

The actual interpretation of the key depends on several different state paramaters withing the calculator, including: operation mode (LRN, OPE, etc) whether there is a tilde key pending, etc.

Parameters:
opThe opcode to be processed
whereThe source code location of the opcode (or NULL if not available)

Reimplemented in calculator_test.

Definition at line 222 of file calculator.cc.

void calculator::on_opcode_lrn ( opcode_t  op,
const location::pointer where 
)

The on_opcode_lrn method is used by the on_opcode method to process opcodes when in Program Mode LRN.

Parameters:
opThe opcode to be processed
whereThe source code location of the opcode (or NULL if not available)

Definition at line 24 of file on_opcode_lrn.cc.

void calculator::on_opcode_ope ( opcode_t  op,
const location::pointer where 
)

The on_opcode_ope method is used by the on_opcode method to process opcodes when in Program Mode OPE.

Parameters:
opThe opcode to be processed
whereThe source code location of the opcode (or NULL if not available)

Definition at line 174 of file on_opcode_ope.cc.

void calculator::on_opcode_ope_che ( opcode_t  op,
const location::pointer where 
)

The on_opcode_ope_che method is used by the on_opcode method to process opcodes when in Program Mode OPE CHE.

Parameters:
opThe opcode to be processed
whereThe source code location of the opcode (or NULL if not available)

Definition at line 22 of file on_opcode_ope_che.cc.

void calculator::on_opcode_pro_che ( opcode_t  op,
const location::pointer where 
)

The on_opcode_pro_che method is used by the on_opcode method to process opcodes when in Program Mode PRO_CHE.

Parameters:
opThe opcode to be processed
whereThe source code location of the opcode (or NULL if not available)

Definition at line 22 of file on_opcode_pro_che.cc.

calculator& calculator::operator= ( const calculator ) [private]

The assignment operator. Do not use.

The precision_and_rounding_get mewthod is used to obtain the current precision and rounding settings, for application to user widgets.

Definition at line 467 of file calculator.cc.

The precision_and_rounding_set method is used to change the precision and rounding in response to the user widgets.

Parameters:
valueThe new value to be set.

Definition at line 459 of file calculator.cc.

void calculator::printer_finished_event ( void  ) [protected]

The printer_finished_event method is used to inform the calculator that the printer is ready to print again. Unexpected printer fisnished events will be discarded.

Definition at line 483 of file calculator.cc.

bool calculator::printer_finished_event_expected ( void  ) const [protected]

The printer_finished_event_expected method is used to determine whether or not a printer_finished_event is expected.

Definition at line 475 of file calculator.cc.

virtual void calculator::printer_timer_start_running ( void  ) [private, pure virtual]

The printer_timer_start_running method is called by the calculator to inform the derived class that it should kick off a printer delay 420ms timer. This will happen when opcode_print or opcode_feed opcode is seen. Derived classes should not assume when printer delays stop and start, instend they will be explicitly informed via this method.

Implemented in calculator_gnome, calculator_proxy, calculator_asm, and calculator_test.

The program_card_walk method is used to call the given functor once for each program card in the stored programme.

Parameters:
fThe functor to invoke for each card.

Definition at line 37 of file program_card_visit.cc.

The program_mode_get method may be used to obtain the current setting of the calculator's Program Mode Switch.

Definition at line 215 of file calculator.cc.

const char * calculator::program_mode_name ( program_mode_t  pm) [static]

The program_mode_name method may be used to obtain a human readable description of the program mode value.

Parameters:
pmThe program mode to be described.
Returns:
a human readable description of the program mode value.

Definition at line 101 of file calculator.cc.

The program_mode_set method may be used to change the setting of the calculator's Program Mode Switch.

Parameters:
pmthe new program mode

Definition at line 178 of file calculator.cc.

void calculator::program_print ( void  ) [private]

The program_print method is used to print a program listing on the printer.

Definition at line 22 of file program_print.cc.

The program_selector_get method may be used to obtain the current setting of the calculator's Program Selector Switch.

Definition at line 124 of file calculator.cc.

The program_selector_set method may be used to change the setting of the calculator's Program Selector Switch.

Parameters:
psthe new program selector

Definition at line 132 of file calculator.cc.

void calculator::property ( const std::string &  name,
const std::string &  value 
) [virtual]

The property method is used by the lexer to pass along a property from the program text.

Parameters:
nameThe name of the property.
valueThe value of the property.

Definition at line 529 of file calculator.cc.

virtual void calculator::run ( void  ) [pure virtual]

The run method is used to run the calculator, from interactive input, via the GUI, or equivalent.

Implemented in calculator_gnome, calculator_proxy, calculator_asm, and calculator_test.

bool calculator::save_memories_as_program ( const std::string &  filename)

The save_memories_as_program method is used to save the calculators data memories as a program.

Parameters:
filenameThe name of the text file to be written with the assembler of the program that would reproduce the data memory values.
Returns:
true on success, false if any error occurred (already reported via the on_error method).

Definition at line 27 of file save_memories_as_program.cc.

void calculator::save_program_as ( const std::string &  filename,
bool  binary 
)

The save_program_as method may be used bu derived classes to save the calculator's stored programme to a file, as binary. Errros are reported via the on_error method.

Parameters:
filenameThe file to receive the programme.
binaryWhether or not the file is binary (true) or text (false).

Definition at line 86 of file save_program_as.cc.

void calculator::set_address ( int  n) [protected]

The set_address method is used by derived classes when the user, usually through some sort of GUI, updates the address.

Note:
This method will NOT call the update_debugger method.

Definition at line 44 of file update_debugger.cc.

The strict_memory_number_checking_required method is used to determine whether or not the number keys following M3~ keys (et al) must be followed by a digit key (true) or any key (false). The actual 1614P silently permits any key, and uses only the lower 4 bits.

Definition at line 536 of file calculator.cc.

The strict_memory_number_checking_set method is used to change the strict memory number checking preference.

Definition at line 544 of file calculator.cc.

void calculator::update_debugger ( debugger where) [protected]

The update_debugger method si used to ask the calculator to pass on its state to the given debugger instance (usually a Gnome, window, but not necessarily).

Parameters:
whereWhere to display the debugging information.

Definition at line 23 of file update_debugger.cc.

void calculator::update_display ( void  ) [protected]

The update_display method calculates the appropriate display value, and then calls derived_update_display to cause the derived class to display the approriate value.

Definition at line 22 of file update_display.cc.

void calculator::update_display_lamps ( display value) [private]

The update_display_lamps method is used to consistently set the appropriate lamps for the user interface.

Definition at line 72 of file update_display.cc.

void calculator::update_display_lrn ( void  ) [private]

The update_display_lrn method is used to re-draw the display when in LRN mode.

Definition at line 95 of file update_display.cc.

void calculator::update_display_ope ( void  ) [private]

The update_display_ope method is used to re-draw the display when in OPE mode.

Definition at line 108 of file update_display.cc.

unsigned calculator::wrap_address ( unsigned  addr) const [private]

The wrap_address method is used to calculate the appropriate wrapped value for this given address, taking into account program_selector value.

Parameters:
addrThe address to be checks, and wrapped if necessary.

Definition at line 231 of file calculator.cc.


Member Data Documentation

The accumulate_mode instance variable is used to remember the state of the AM1 key.

See the Instruction Manual, p. 9

"[AM1] Accumulative Memory 1 Key

"For automatic accumulation. Used in sums and differences of products and quotients. By depressing the [+=] key or [-=] key, the displayed data is added to or subtracted from Memory 1. This is a lock key for Memory 1. (Not used in programming.)"

Definition at line 779 of file calculator.h.

unsigned char calculator::address [private]

The address instance variable is used to remember where the next opcode to be accessed is, relative to the start of the programme array.

The 1614P used an antiquated notion of address space, being from 1..240 (rathe rthen a more moder zero-based approach). By using an array larger than that, we can accommodate this, without constant resort to subracting one.

Definition at line 630 of file calculator.h.

std::list<unsigned> calculator::call_stack [private]

The call_stack instance variable is used to remember the returned addresses for called subroutines. It is not clear if the 1614P was even capable of more than one level of calls (although it may explain the last 5 bytes in the programme space).

Definition at line 788 of file calculator.h.

The clock_tick_mode instance vareiable is used to remember whether or not the calculator thinks the clock is running. This will be true when in Program Mode OPE, and the user has pressed the Start key (or UJ n).

Definition at line 708 of file calculator.h.

bool calculator::constant_mode [private]

The constant_mode instance variable is used to remember the state of the [K] key, and adjust multiplication and division accordingly.

Instruction Manual, p. 10

"This key is for constant multiplication and division. When it is depressed, it locks and function state is attained.

"Internal calculation is performed in the normal procedure. Thereafter constant multiplication and division can be made by operating the numeric and [+=] keys.

"In the case of multiplication, the multiplicant is a constant, and in the case of division, the divisor is a constant.

"This key is also used in involutions. The "n"th power of a figure is obtain by depressing the [+=] key (n-1) times. Thus, a [x] [+=] [+=] [+=] [+=] gives a5.

Definition at line 833 of file calculator.h.

The constant_mode_action instance variable is used to remember the appropriate operation (multiplication or division) to apply when the [+=] or [-=] key is used when in constanht mode (when the [K] key is locked down).

Definition at line 841 of file calculator.h.

The constant_mode_rhs instance variable is used to remember the right hand side of the repeated multiplication or division to be performed when the [+=] or [-=] key is pressed when in constant mode (when the [K] key is locked down).

Definition at line 849 of file calculator.h.

The deferred_action instance variable is used to remember the previous arithmetic operation key.

Definition at line 666 of file calculator.h.

Definition at line 653 of file calculator.h.

number calculator::memory[16] [private]

Definition at line 551 of file calculator.h.

Definition at line 531 of file calculator.h.

The number_of_keys_since_ej instance variable is used to remember how many keys have been pressed since the EJ opcode occurred, to decive which way to branch. It is also used to know whether or not the ENT opcode should also print.

Definition at line 948 of file calculator.h.

The precro_current instance variable is used to remember the number of decimal places and rounding. This is usually the same as precro_front_panel instance variable, except after the opcode_round_up, opcode_round_off and opcode_round_down opcodes.

Definition at line 545 of file calculator.h.

The precro_front_panel instance variable is used to remember the setting selected by the user for the number of decimal places.

Definition at line 537 of file calculator.h.

The printer_delay_active method instance variable is used to remember whether or not a printer delay is active. This is used to pause instruction execution until the printer finishes printing a line.

Definition at line 716 of file calculator.h.

The program_mode instance variable is used to remeber the calculator's current program mode.

Definition at line 651 of file calculator.h.

The program_selector instance variable is used to remember the addressing mode in use. This controls how the program space is segmented.

"Program Selector Switch

"When storing a program, executing a program calculation, and checking or clearing a program, program ranges are selected by this switch.

1) Program storage

(i) When two independent programs are stored at the same time, a program within 120 steps is stored on side I and a program within 120 steps is stored on side II.

(ii) When one program of over 120 steps is stored, the switch is set in the I+II position.

(iii) When the respective programs at I and II positions exceed 120 steps and 120 steps respectiveIy, the excess is stored automatically in II or I.

2) Execution of a program

The program is also classified by the changeover among I + II, I and II in the case of program calculation execution in accordance with the stored program.

(i) To execute a program by using the contents of program A, set the switch in I + II or I position.

(ii) To execute a program by using the contents of program B, set the switch in II position.

(iii) When the two programs are stored and they are used as required, execute program A with the switch set to I position, and execute program B with the switch set in II position.

3) Check of program contents

Checking of a particular stored program is also accomplished by selecting I+II, I or II.

(i) When checking program A, set the selector to either I+II or I.

(ii) When checking program B, set the selector to II.

(iii) When checking a dual program, set the selector at I for A and II for B.

4) Clearing contents of program

When clearing a program, the range to be cleared is determined by the changeover among I+II, I and II.

(i) To clear I+II range, steps 1 through 240, set the switch in I+II position.

(ii) To clear I range, steps 1 through 120, set the switch in I position.

(iii) To clear II range, steps 121 through 240, set the switch in II position.

Definition at line 618 of file calculator.h.

unsigned char calculator::programme[256] [private]

The programme instance variable is used to remember the store programme of the calculator. The array is acrually larger then the original ,machine, but than means we don't have to constantly subtract one all the time.

Definition at line 638 of file calculator.h.

The programme_location instance variable is used to remember the source file location of each of the opcodes in the programme instance variable.

Definition at line 645 of file calculator.h.

The properties instance variable is used to remember the properties of the program card set.

Definition at line 892 of file calculator.h.

The strict_memory_number_checking instance variable is used to remember whether or not the key following M3~, SM3~, RM3~ and CM3~ must be a numeric key (true) or is permitted to be any key, of which the lower 4 bits will be used.

Definition at line 940 of file calculator.h.

Definition at line 547 of file calculator.h.

Definition at line 549 of file calculator.h.


The documentation for this class was generated from the following files: