int e l 9.5 DUAL OPERAND OPERATORS The next group of instructions assume that TWO values are on the ARGUMENT STACK. If number on the TOP of the ARGUMENT STACK is represented by the symbol [TOS] and the number NEXT to TOP of the ARGUMENT STACK is represented by the symbol [NxTOS] and the ARGUMENT STACK POINTER is represented by the symbol AGSP, then the following instructions would take the general form: TEMP1 = [TOS] TEMP2 = [NxTOS] AGSP RESULT = TEMP2 OP TEMP1 [TOS] = RESULT Where OP is one of the following operators to be described. NOTE that the group of instructions ALWAYS POP the ARGUMENT STACK by one FLOATING POINT NUMBER SIZE (i.e. 6 BYTES).
ERRORS can be handled in two different ways with the ADD, SUBTRACT, MULTIPLY, and DIVIDE routines. One option is to let MCS BASIC-52 trap ERRORS, should they occur during the operation. With this option MCS BASIC-52 will print the appropriate error message to the console device. The other option passes a STATUS CODE to the user. After the operation the Accumulator contains the status code information. The Status information is as follows:
ACC.0 -- ARITHMETIC UNDERFLOW ACC.1 -- ARITHMETIC OVERFLOW ACC.2 -- RESULT WAS ZERO (not an error, just a condition) ACC.3 -- DIVIDE BY ZERO ACC.4 -- NOT USED, ZERO RETURNED ACC.5 -- NOT USED, ZERO RETURNED ACC.6 -- NOT USED, ZERO RETURNED ACC.7 -- NOT USED, ZERO RETURNED If an ARITH. OVERFLOW or a DIVIDE BY ZERO ERROR occurs and the user is handling the error condition, the floating point processor will return a result of +- 99999999E+ 127 to the argument stack. The user can do what they want to with this result (i.e. use it or waste it). An ARITH. UNDERFLOW ERROR will return to the argument stack a result of 0 (zero). - 118 -