The Museum of HP Calculators


Modulo for the HP-29C

This program is by Xavier A. Brazil and is used here by permission.

This program is supplied without representation or warranty of any kind. Xavier A. Brazil and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Overview

These are just a few keystrokes that you may use without programming to calculate the modulo- of two numbers, showing how the stack works:

Number1, ENTER, Number2, ENTER, ENTER, ROLL DOWN, ROLL DOWN, /, g FRAC, *

This can be also a (very) short program:

INSTRUCTIONS
1. In PRGM Mode, type in the routine;
2. In RUN Mode, type in the 1st number, press ENTER;
3. Press the 2nd number, then press GSB 1.

(Since the '1' key is at the same place than INT & FRAC instructions, the best is to use this sub-routine number, but a change for the 'R/S' key is possible)

Note: the program will not verify the validity of the numbers you entered.

EXAMPLE

45
ENTER
6
GSB 1 --> 3

Note: This program (first designed for the HP-29c) is easy to adapt to other hanhelds like HP-25, HP-65 or HP-67, which have the FRAC instruction (or similar) without having the MODULO instruction.

Listing

Step      Code        Instruction

01        15 13 01    g LBL 1
02        31          ENTER
03        31          ENTER
04        22          ROLL DOWN
05        22          ROLL DOWN
06        71          /
******************************
You may type a 'PAUSE' 
instruction here to know the 
result of the division.
******************************
07        15 62       g FRAC
08        61          *
09        15 12       RTN

Go back to the software library
Go back to the main exhibit hall