The Museum of HP Calculators

HP Forum Archive 16

[ Return to Index | Top of Index ]

HP-41 Advantage Pac AIP function, anyone?
Message #1 Posted by Arne Helme on 7 Sept 2006, 8:23 a.m.

Hi all,

I am looking for an implementation of the HP-41 Advantage Pac AIP function that I can use without the need to have the Advantage Pac installed? Is the code available?

Related question: what is the most efficient (synthetic) way to save and restore the current FIX decimal setting an an HP-41 if I want to implement this function myself?

Regards,

Arne

      
Re: HP-41 Advantage Pac AIP function, anyone?
Message #2 Posted by Valentin Albillo on 7 Sept 2006, 9:31 a.m.,
in response to message #1 by Arne Helme

Hi, Arne:

    I don't recall the exact specifics of how AIP works with all kinds of values in the X register, but some modification of this simple code I wrote for your sake will probably be what you need:
         
                   Stack contents
                ----------------------   
                  X   Y   Z   T   L
                ----------------------
                  X   Y   Z   T   L
       RCL d      d   X   Y   Z   L   recall all flags
       X<>Y       X   d   Y   Z   L   bring back the former value in X  
       FIX 0      X   d   Y   Z   L   specify no decimals 
       CF 29      X   d   Y   Z   L   supress decimal point showing
       INT       IX   d   Y   Z   X   truncate X to its integer part
       ARCL X    IX   d   Y   Z   X   append it to the alpha register
       Rdown      d   Y   Z   IX  X   bring back the flags
       STO d      d   Y   Z   IX  X   restore all flags
       X<> L      X   Y   Z   IX  d   restore the initial value of X
    

    This code preserves the values in stack registers X,Y,Z that are there upon entry and leaves the integer part of the X value appended to the ALPHA register, without decimal point. Only T and LastX are lost and the display mode and number of decimal places are fully restored upon exit.

Best regards from V.

Edited: 7 Sept 2006, 9:36 a.m.

            
Re: HP-41 Advantage Pac AIP function, anyone?
Message #3 Posted by Arne Helme on 7 Sept 2006, 9:45 a.m.,
in response to message #2 by Valentin Albillo

Valentin,

thanks a lot for your quick response and code! I suspected that a synthetic instruction or two would do the trick!

-- Arne

                  
Re: HP-41 Advantage Pac AIP function, anyone?
Message #4 Posted by Valentin Albillo on 7 Sept 2006, 9:55 a.m.,
in response to message #3 by Arne Helme

You're welcome, Arne.

    Please try it out and let me know if it doesn't work correctly. I did wrote it right now, directly from my head as I have neither the AIP documentation nor the HP-41C manuals, not to mention an actual HP-41C ! So I've been unable to try it myself but I'm confident it will run satisfactorily.

Best regards from V .

      
Re: HP-41 Advantage Pac AIP function, anyone?
Message #5 Posted by Tom F on 7 Sept 2006, 1:13 p.m.,
in response to message #1 by Arne Helme

If you have the HP-41CX you can simply use RCLFLAG and STOFLAG to save and restore the FIX/SCI/ENG settings, along with a number of other settings as well. I believe these functions operate on flags 0 thru 43 which include the display setting.

            
Re: HP-41 Advantage Pac AIP function, anyone?
Message #6 Posted by Namir on 7 Sept 2006, 4:19 p.m.,
in response to message #5 by Tom F

Tom,

I just checked your method and it works like a champ. To display integers in the alpha registers you can use RCLFLAG and STOFLAG:

RCLFLAG
"N="
FIX 0
CF 29
ARCL Y
STOFLAG
RDN
PROMPT

The above code works using the stack to store the states of the flags.

Here is a version as a subroutine that preserves the stack using the LastX register as a temporary storage:

LBL "SHOWINT
RUP
STO ST L
RDN
RCLFLAG
FIX 0
CF 29
ARCL Y
STOFLAG
X <> ST L
RDN
PROMPT
RTN

Here is an example that uses the above code:

...
"N=
XEQ "SHOWINT
...

Namir

Edited: 8 Sept 2006, 2:10 a.m.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall