ROM ROUTINES (INTEGER MATH)
The following integer math routines make use ACC to contain the result of the operation. ACC is 2 locations in memory at 4121 & 4122 (LSB,MSB). The number type flag (NTF) at 40AF must also be set to 02 to indicate integer.
Note that on integer overflow +, -, & * return a single precision floating point number in ACC at 4121-4124 (LSB,LSB,MSB,EXPonent). Also, / always returns a single precision floating point number. In all cases you should check NTF for the type of the result (single= 4).
Integers are stored in twos compliment form. Single precision floating point numbers are stored as a normalized binary fraction, with an assumed decimal point before the most significant bit. Since the msb is always a 1, the most significant bit also doubles as the sign bit by making it a 0 for positive and 1 for negative. The binary exponent is stored in excess 128 form; that is, 128 is added to the actual binary exponent needed. The number 0 is stored as a zero mantissa and exponent. A couple of examples are shown below:
Arithmetic Accumulator (411D-4124)
Hex Arithmetic Accululator (4127-412E)