The Museum of HP Calculators

HP Forum Archive 13

[ Return to Index | Top of Index ]

(42S) Why an AIP & no AFP?
Message #1 Posted by Sean McNamee on 10 Nov 2003, 3:39 p.m.

The AIP cmd on the wonderful 42s puts the Integer Part into the Alpha reg, but there is no cooresponding Fractional Part cmd. I'm going to write it, if there's no built-in method.

      
Re: (42S) Why an AIP & no AFP?
Message #2 Posted by Raymond Del Tondo on 10 Nov 2003, 5:52 p.m.,
in response to message #1 by Sean McNamee

Just do FP, then 1E2 * , then AIP ;-) Depending on the decimal places you want adjust the multiplicator. If the 42S had something like MANT, it would be even easier.

Raymond

      
Re: (42S) Why an AIP & no AFP?
Message #3 Posted by Valentin Albillo on 12 Nov 2003, 7:57 a.m.,
in response to message #1 by Sean McNamee

Sean posted: " Why an AIP & no AFP?"

AIP is an utility function taken from the Advantage ROM, included just for convenience. Its intended use is to quickly and effortlessly append a subindex extracted from the first part of a control number in nnn.mmm format to some matrix element in the Alpha register, for displaying or printing, such as "A(2)= 27.1023". Sample fragment of code (HP-41C, Advantage ROM):

  50 LBLC            loop to retrieve and display each coefficient
  51 MRIJ            recalls the current value of the index
  52 "A"             begins to form the prompt to display each coefficient
  53 AIP             ... appends the index to the prompt 
  54 "|-="           ... completes the prompt
  55 MRR+            retrieves the value of the current coefficient from the vector
  56 ARCL X          ... appends the value of the coefficient to the prompt 
  57 PROMPT          shows the value to the user and waits for execution to resume
  58 FC? 10          are we done showing all coefficients ?
  59 GTO C           not yet, go back to display the next coefficient

Without AIP you'd need to disturb the control number (23.037) to take its integer part, change the display to FIX 0 and no decimal point, alpha-recall the resulting contents of X to append the first part of the control number to the alpha register, and then probably restore the previous FIX-n display, and RDN, LASTX to restore the control number to its previous state. Instead, a single AIP removes all that drudgery, doesn't disturb LASTX, and makes constructing alpha prompts that much more simple.

As it is, AFP does not exist, but if it did, it would proably do the same with the *second* part of the control number, i.e.: with 23.037 in the X register, some hypothetic AFP would append 37 to the contents of the Alpha register. That probably isn't what you intended.

Best regards from V.

            
AFP
Message #4 Posted by Sean on 12 Nov 2003, 5:18 p.m.,
in response to message #3 by Valentin Albillo

OK, I wrote it:

01 LBL "FP2A"
02 STO 01
03 RDN
04 STO 02
05 RDN
06 STO 03
07 RDN
08 STO 04
09 RDN
10 AIP
11 RCL 01
12 FP
13 X=0?
14 GT0 02
15 +"."
16 LBL 01
17 10
18 *
19 AIP
20 FP
21 X=0?
22 GTO 02
23 GTO 01
24 LBL 02
25 RCL 04
26 RCL 03
27 RCL 02
28 RCL 01
29 RTN


[ Return to Index | Top of Index ]

Go back to the main exhibit hall