HP-41 Advantage Pac AIP function, anyone?



#7

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


#8

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.


#9

Valentin,

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

-- Arne


#10

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 .

#11

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.


#12

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.


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP50g: Writing a function that returns a function Chris de Castro 2 493 12-10-2013, 06:49 PM
Last Post: Han
  HP-41(CL): The easiest way to transfer FOCAL programs from a Linux PC to the HP-41 Geir Isene 13 1,289 12-05-2013, 02:40 AM
Last Post: Hans Brueggemann
  IFERR function on HP Prime Mic 2 433 12-02-2013, 01:33 AM
Last Post: cyrille de Brébisson
  HP67/97 M.E. Pac cover Ignacio Sánchez 2 375 11-22-2013, 04:04 AM
Last Post: Ignacio Sánchez Reig
  HP Prime: Dirichlet's eta function recognized but not numerically evaluated Helge Gabert 0 244 11-16-2013, 03:41 PM
Last Post: Helge Gabert
  Possible bug with sqrt function in the HP prime Michael de Estrada 6 575 11-15-2013, 12:49 PM
Last Post: Michael de Estrada
  HP-41 MCODE: The Last Function - at last! Ángel Martin 0 253 11-08-2013, 05:11 AM
Last Post: Ángel Martin
  request M.E. pac for HP-67/97 wallet cover scan Ignacio Sánchez 0 279 11-06-2013, 09:36 AM
Last Post: Ignacio Sánchez Reig
  HP-67/97 Mechanical engineering PAC cover Ignacio Sánchez 0 259 10-30-2013, 04:35 AM
Last Post: Ignacio Sánchez Reig
  HP Prime 'where' function bluesun08 11 930 10-29-2013, 06:56 PM
Last Post: Joe Horn

Forum Jump: