HP35 Programs

download HP35 Programs

of 29

Transcript of HP35 Programs

  • 8/6/2019 HP35 Programs

    1/29

    2DVEC+ hp32sIIA small program to add two planar vectors given their magnitudes andpolar angles (from some line). The answer gives the magnitude andangle of the sum.

    Input in the stackT: angle of first vector

    Z: magnitude of first vectorY: angle of second vectorX: magnitude of second vector

    Output in the stackY: angle of sumX: magnitude of sum

    This program does not use any variables. It only manipulates the stack.

    Memory requirements:Total: 12 bytes. Program: 12 bytes. Variables: 0.

    Left free: 372 bytes. No Flags used.CHKSUM=7A0B 012.0

    ------------------A01 LBL AA02 theta,r->y,xA03 RdownA04 RdownA05 theta,r->y,xA06 CMPLX+A07 y,x->theta,rA08 RTN

    **************************************************************************************** BEGIN PROGRAM LISTING ****************************************************************************************

    LINEAR3 hp32sIIA program to solve a linear system of 3 equations with 3 unknowns.

    System:

    Ax+By+Cz = E (A NOT ZERO)

    Gx+Hy+Iz = KMx+Ny+Oz = P

    The program stores all coefficients in the memory of the sameletter variable. The input is by row including the independent terms:A,B,C,E, G,H,I,K, M,N,O,P.The results for x,y,z are shown in the corresponding stack registers(use roll to see them).

    WARNINGS:The program clears ALL variables (not sums) before starting.To save memory the program is very primitive; it does not do pivoting,and it may fail in some few instances even for non singular

    matrices (change the order of the rows if this happens or if A is zero).You can also use this program to solve systems with only 2 unknowns.For example, to solve a 2x2 system (x,y unknowns) enter the

  • 8/6/2019 HP35 Programs

    2/29

    equivalent 3x3 system:

    Ax+By+0z = E (A NOT ZERO)Gx+Hy+0z = K0x+0y+1z = 0

    Memory requirements:

    Total:193.5 bytes. Program:97.5 bytes. Variables:96 bytes (8x12).Left free: 43.5 bytes. No Flags used.C CHKSUM=F0b4 097.5

    x--------------x--------------x--------------x--------------x-----------C01 LBL C C11 INPUT M C21 STOx P C31 RCL B C41 STOx OC02 CLVARS C12 INPUT N C22 RCL B C32 RCLx M C42 STOx PC03 INPUT A C13 INPUT O C23 RCLx G C33 STO- N C43 RCL IC04 INPUT B C14 INPUT P C24 STO- H C34 RCL C C44 RCLx NC05 INPUT C C15 RCL A C25 RCL C C35 RCLx M C45 STO- OC06 INPUT E C16 STOx H C26 RCLx G C36 STO- O C46 RCL KC07 INPUT G C17 STOx I C27 STO- I C37 RCL E C47 RCLx N

    C08 INPUT H C18 STOx K C28 RCL E C38 RCLx M C48 STO- PC09 INPUT I C19 STOx N C29 RCLx G C39 STO- P C49 RCL OC10 INPUT K C20 STOx O C30 STO- K C40 RCL H C50 STO/ P

    C51 RCL P C61 RCL PC52 STOx I C62 RCL KC53 STOx C C63 RCL EC54 RCL K C64 RCL/ AC55 RCL- I C65 RTNC56 RCL/ HC57 STO KC58 RCLx BC59 RCL+ C

    C60 STO- E

    **************************************************************************************** BEGIN PROGRAM LISTING ****************************************************************************************

    LINEAR4 hp32sIIA program to solve a linear system of 4 equations with 4 unknowns.

    System:

    Ax+By+Cz+Dw = E (A NOT ZERO)Fx+Gy+Hz+Iw = JKx+Ly+Mz+Nw = OPx+Qy+Rz+Sw = T

    The program stores all coefficients in the memory of the sameletter variable. The input is by row including the independent terms:A,B,C,D,E, F,G,H,.... There is a small pause before input the lastrow (P,Q,R,S,T) due to the need to do some calculations to empty fourvariables (i,G,M,N) because of the memory limitations of the hp32sII.The results for x,y,z,w are shown in the corresponding stack registers(use roll to see them).

    WARNINGS:The program clears ALL variables (not sums) before starting.

  • 8/6/2019 HP35 Programs

    3/29

    To save memory, the program is very primitive; it does not do pivoting,and it may fail in some few instances even for non singularmatrices (change the order of the rows if this happens or if A is zero).You can also use this program to solve systems with only 3 or 2unknowns. For example, to solve a 2x2 system (x,y unknowns) enter theequivalent 4x4 system:

    Ax+By+0z+0w = E (A NOT ZERO)Fx+Gy+0z+0w = J0x+0y+1z+0w = 00x+0y+0z+1w = 0

    Memory requirements:Total:340.5 bytes. Program:204.5 bytes. Variables:136 bytes (8x17).Left free: 43.5 bytes. No Flags used.B CHKSUM=56F9 23.0L CHKSUM=8112 181.5

    x--------------x--------------x--------------x--------------x-----------

    B01 LBL B L01 LBL L L11 RCL C L21 RCLx K L31 STO- OB02 CLVARS L02 INPUT(i) L12 RCLx F L22 STO- L L32 RCL GB03 7.015 L03 RCL A L13 STO- H L23 RCL C L33 STOx MB04 STO i L04 STOx (i) L14 RCL D L24 RCLx K L34 STOx NB05 INPUT A L05 ISG i L15 RCLx F L25 STO- M L35 STOx OB06 INPUT B L06 GTO L L16 STO- I L26 RCL D L36 RCL HB07 INPUT C L07 STO/ K L17 RCL E L27 RCLx K L37 RCLx LB08 INPUT D L08 RCL B L18 RCLx F L28 STO- N L38 STO- MB09 INPUT E L09 RCLx F L19 STO- J L29 RCL E L39 RCL IB10 INPUT F L10 STO- G L20 RCL B L30 RCLx K L40 RCLx L

    L41 STO- N L51 INPUT Q L61 RCL B L71 RCLx P L81 RCLx QL42 RCL J L52 INPUT R L62 RCLx P L72 STO- T L82 STO- S

    L43 RCLx L L53 INPUT S L63 STO- Q L73 RCL G L83 RCL JL44 STO- O L54 INPUT T L64 RCL C L74 STOx R L84 RCLx QL45 0 L55 RCL A L65 RCLx P L75 STOx S L85 STO- TL46 STO i L56 STOx P L66 STO- R L76 STOx T L86 RCL ML47 STO F L57 STOx Q L67 RCL D L77 RCL H L87 STOx SL48 STO K L58 STOx R L68 RCLx P L78 RCLx Q L88 STOx TL49 STO L L59 STOx S L69 STO- S L79 STO- R L89 RCL NL50 INPUT P L60 STOx T L70 RCL E L80 RCL I L90 RCLx R

    L91 STO- S L101 RCL O L111 STO J L121 RTNL92 RCL O L102 RCL- N L112 RCLx BL93 RCLx R L103 RCL/ M L113 RCL+ DL94 STO- T L104 STO O L114 RCL+ CL95 RCL S L105 STOx H L115 STO- EL96 STO/ T L106 STOx C L116 RCL TL97 RCL T L107 RCL J L117 RCL OL98 STOx N L108 RCL- I L118 RCL JL99 STOx I L109 RCL- H L119 RCL EL100 STOx D L110 RCL/ G L120 RCL/ A

    **************************************************************************************** BEGIN PROGRAM LISTING ****************************************************************************************

    Distance and Direction for the HP-32SII

  • 8/6/2019 HP35 Programs

    4/29

    Written by Dave Coffin around 1992.OverviewThis program calculates the distance and initial heading of the shortest path between two points on the Earth's surface.UsageA Moslem must always face toward Mecca during prayer. Which way should a Moslemin Boston face?

    XEQ DN? 42.3566 Downtown BostonE? -71.0569 Always negative in USA!!N? 21.426 Mecca, Saudi ArabiaE? 39.8385397.33132593 Distance in nautical milesxy60.420494571 Compass heading (30 degrees north of east)

    This is counter-intuitive because, on a flat map of the world, Mecca appears farto the east and a little south of Boston. But if you find these two cities on a

    globe and connect them with a tight string, you can see that the shortest pathgoes north before it goes south.Program

    Distance output is in nautical miles. Change line D30 to 111.12 for kilometers,or 69.046767 for statute miles.

    D01 LBL DD02 DEGD03 INPUT ND04 STO XD05 INPUT ED06 INPUT N

    D07 1D08 ?,r?y,xD09 INPUT ED10 R?D11 -D12 xyD13 ?,r?y,xD14 R?D15 xyD16 y,x??,rD17 xyD18 RCL- XD19 xyD20 ?,r?y,xD21 180D22 R?D23 R?D24 +/-D25 y,x??,rD26 R?D27 -D28 xyD29 ACOSD30 60D31

    D32 RTN

    HP-32SII: checksum = AAAA, length = 48.0

  • 8/6/2019 HP35 Programs

    5/29

    HP-33S: checksum = EE88, length = 132

    **************************************************************************************** BEGIN PROGRAM LISTING ****************************************************************************************

    Composite Body: Neutral Axis and Moment of Inertia for the HP-32SII

    This program is by Eric Lundgren and is used here by permission.

    This program is supplied without representation or warranty of any kind. Eric Lundgren and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from theuse of this program material or any part thereof.Overview

    For a buildup of n rectangular sections (ibeam, c-channel, sandwich, etc.), this

    program computes the location of neutral axis (measured from bottom of section), and the moment of inertia.

    NOTE: One can model two plates with open space between by assigning B=0, H=distance between for the section between the plates.

    The program was written for the new hp33s, but has been tested on the 32sii andworks. Should also work for most HPs supporting keystroke rpn programming, likethe hp42s. Hope it is of some use!Listing

    LBL I123456789

    RCL ZX != Y ?CLVARS123456789RCL ZX != Y ?INPUT N123456789STO ZINPUT BINPUT HRCL H2/RCL +TRCL BRCL * H*RCL +QSTO QRCL BRCL H*RCL +RSTO R

    1RCL +VSTO V

  • 8/6/2019 HP35 Programs

    6/29

  • 8/6/2019 HP35 Programs

    7/29

  • 8/6/2019 HP35 Programs

    8/29

  • 8/6/2019 HP35 Programs

    9/29

    LBL NXYSTO NROLLDENTERIPSTO I

    ROLLDFP100*ENTERIPSTO FROLLDFP41O^X*

    STO PRCL I2X

  • 8/6/2019 HP35 Programs

    10/29

    /IPSTO PRCL B*IP+/-

    RCL F+RCL D/IPSTO IRCL D*IPRCL PRCL B*

    IP++/-RCL F+STO F14RCL IX

  • 8/6/2019 HP35 Programs

    11/29

  • 8/6/2019 HP35 Programs

    12/29

    M CK= 2330 19.5W CK= F42C 9.0I CK= 8F99 21.0

    Program variables: F, I, N, P.With this reduced version there is no longer functions D or B, but there is newfunction I.

    XEQ I From days old, determine Intellectual Biorhythm number.

    LBL NXYSTO NROLLDENTERIPSTO IROLLDFP

    100*ENTERIPSTO FROLLDFP41O^X*STO PRCL I2

    X

  • 8/6/2019 HP35 Programs

    13/29

    STO IXYSTO PXY/IPRCL I

    *RCL PXY-RTNLBL W1+7XEQ MRTNLBL I

    DEG33XEQ M33/180*2*SIN100*RTN

    **************************************************************************************** BEGIN PROGRAM LISTING ****************************************************************************************

    Motion Program for the 33S

    This program is by Ed Mooney and is used here by permission.

    This program is supplied without representation or warranty of any kind. Ed Mooney and The Museum of HP Calculators therefore assume no responsibility and shallhave no liability, consequential or otherwise, of any kind arising from the useof this program material or any part thereof.Overview

    Motion Program (with constant acceleration): Five variables: Enter any three variables, finds remaining two variables . Note that usually either the initial orfinal velocity is known to be equal to "0.

    Variables:This program works for both linear and rotational systems.X: Distance (rotational: Angular Position), (flag 0)I: Initial velocity (rotational: Initial Angular Velocity), (flag 1)

    F: Final velocity (rotational: Final Angular Velocity), (flag 2)A: Acceleration (rotational: Angular Acceleration), (flag 3)T: Time (rotational: Time), (flag 4)

  • 8/6/2019 HP35 Programs

    14/29

    To use: XEQ V

    Unknowns are entered as "0". If a variable is known to be equal to "0", Press (rolldown) and Enter 1E-99 (1E-99 virtually equals 0).Listing

    V01 LBL VV02 CF 0V03 CF 1V04 CF 2V05 CF 3V06 CF 4V07 1E-99V08 Input XV09 X=0?V10 SF 0 X unknownV11 1E-99V12 Input I

    V13 X=0?V14 SF 1 I unknownV15 1E-99V16 Input FV17 X=0?V18 SF 2 F unknownV19 1E-99V20 Input AV21 X=0?V22 SF 3 A unknownV23 1E-99V24 Input TV25 X=0?

    V26 SF 4 T unknownV27 FS?0V28 GTO E X unknownV29 FS?1V30 GTO F I unknown, X knownV31 FS?2V32 GTO I F unknown, X and I knownV33 RCL X T and A unknown, X, I and F knownV34 2V35 XV36 RCL IV37 RCL FV38 +V39 V40 STO TV41 VIEW TV42 RCL FV43 RCL IV44 -V45 RCL TV46 V47 STO AV48 VIEW AV49 GTO VV50 RTN LN= 222, CK= 52DE

    E01 LBL E X unknownE02 FN=JE03 FS?1

  • 8/6/2019 HP35 Programs

    15/29

  • 8/6/2019 HP35 Programs

    16/29

  • 8/6/2019 HP35 Programs

    17/29

    Input is in variables ABC, XYZ. Answer is in the stack (x,y,z)

    Memory requirements:Total: 82.5 bytes. Program: 34.5 bytes. Variables: 48=6x8.Left free: 301.5 bytes. No Flags used.CHKSUM=D190 034.5

    ------------------X01 LBL XX02 INPUT AX03 INPUT BX04 INPUT CX05 INPUT XX06 INPUT YX07 INPUT ZX08 RCL YX09 RCLx AX10 RCL XX11 RCLx B

    X12 - z componentX13 RCL XX14 RCLx CX15 RCL AX16 RCLx ZX17 - y componentX18 RCL ZX19 RCLx BX20 RCL YX21 RCLx CX22 - x componentX23 RTN

    **************************************************************************************** BEGIN PROGRAM LISTING ****************************************************************************************

    **************************************************************************************** BEGIN PROGRAM LISTING ****************************************************************************************

    Feet-Inches-Fractions Calculator for the HP-41CX

    This program is 1984 by Fred E. Lusk III, PE and is used here by permission.Introduction

    FEET performs feet-inches-fractions (F-I-F) calculations using a two-register RPN stack ("XX" and "YY"). The program handles addition and subtraction of two F-I-F numbers (as long as the result isn't negative), multiplication and division of an F-I-F number by a non-negative constant, and F-I-F to decimal and decimal to F-I-F conversions. The program also provides one data storage register ("RR").

    One interesting feature of the program is that the user is not limited to 16thsof an inch, though that is the default, or even the binary fractions 1/2, 1/4, 1/8, etc. FEET can work with ANY fraction, including 1/10, 1/31, 1/88, etc. The p

    rogram handles incompatible fractions by rounding values off to the nearest multiple of the selected fraction. For example, if FEET is set for 8ths of an inch,an entry of 17/23" will be rounded to 6/8", then reduced to 3/4" and displayed.

  • 8/6/2019 HP35 Programs

    18/29

    In addition, an entry such as 1'15-25/8" will be corrected to 2'6-1/8". The program also provides a feet-inches (F-I) only mode that eliminates the need to enter fractions. F-I mode is set by entering an initial fraction value of 0 or 1.

    As written, FEET requires an HP-41CX with at least 438 bytes of available program space plus 15 data registers. The program uses several extended functions, including XF, XTOA, and REGMOVE, though there are workarounds. The heart of the p

    rogram (the part that reduces the fractions) is based on the fraction reductionroutine in the PPC ROM. However, a PPC ROM is not required.

    As well as this program works and as "cool" as I think it is, I am planning a major rewrite. FEET currently stores separate numbers for the feet, inches, numerator, and denominator that comprise each dimension value. The next version will store just one number for each dimension (e.g. 1'2-3/4" would be stored as 236 ifthe fraction is set to 16ths or 59 if the fraction is set to 4ths). The original programming decision was based on the false notion that big numbers with smallfractions would lead to inaccuracies if the entire dimension was reduced to a single number. The reality is that 10000'1-1/16" (an absurdity) would reduce to 1,920,017 16ths, which is well within the non-scientific-notation dynamic range o

    f the HP-41CX. This change will simplify data handling and eliminate the need for the REMOVE command. I may even expand the FEET stack to three or four registers, permit the use of negative numbers, and clean up the program structure. Thiswill also accomplish what I was trying to do in creating an HP-42S version, butnever got around to finishing.Function Keys

    RESET STO RCL D>F F>D[a] [b] [c] [d] [e]

    + - * / ENTER[A] [B] [C] [D] [E]

    RESET Restart the program. This is a quick alternative to XEQ "FEET",and is useful for changing the fraction setting, although the contents of XX andYY are cleared.STO Copy the contents of XX to RR. XX and YY are left undisturbed. Flag 0 is set as a reminder that RR is in use.RCL Recall the contents of RR to XX. The previous contents of XX aremoved to YY. The original contents of YY are lost.D>F Convert the decimal value in X (in the regular RPN stack) to F-I-F or F-I and place in XX. The previous contents of XX are moved to YY. The original contents of YY are lost.F>D Convert the F-I-F or F-I contents of XX to decimal feet. The FEET stack is left undisturbed.+ Add the contents of XX and YY. The result is placed in XX. Because YY is the top of the two-register FEET stack, YY remains intact.- Subtract XX from YY (YY must be greater than XX). The result isplaced in XX. Because YY is the top of the two-register FEET stack, YY remains intact.* Multiply the contents of XX by the constant in X. The result isplaced in XX. YY is undisturbed./ Divide the contents of XX by the constant in X. The result is placed in XX. YY is undisturbed.ENTER ENTER: Process the contents of the four-register RPN stack and place in XX and YY

    RPN stack for F-I-F modeX: Denominator

    Y: NumeratorZ: InchesT: Feet RPN Stack for F-I mode

  • 8/6/2019 HP35 Programs

    19/29

    X: InchesY: FeetGeneral Instructions

    To run program: XEQ [ALPHA] FEET [ALPHA]Enter the desired fraction at the FRACTION ? prompt and hit [R/S]. If calcul

    ations will be performed using 16ths, the user may skip entering 16 and just hit

    [R/S] because the default value of 16 is already in X. The program can use anyvalue for the fraction. Use 0 or 1 to set F-I mode, which does not use fractionsat all.

    Data EntryFor F-I-F mode:Feet [ENTER^]Inches [ENTER^]Numerator [ENTER^]Denominator [E]For F-I mode:Feet [ENTER^]Inches [E]

    See the following examples for additional instructions.

    Examples

    1. a) Find the missing dimension to the nearest 1/16".b) Multiply the result by 2/3 (just for kicks).c) Convert to decimal feet and back again.(drawing not to scale)

    KEYBOARD DISPLAY Notes

    --------------------------------------------------------------------XEQ [ALPHA] FEET [ALPHA] FRACTION ?[R/S] FT^, IN^, N^, D {1.1}2 [ENTER^]3 [ENTER^]5 [ENTER^]8 [E] 2'3-5/8"[A] 4'7-1/4" {1.2}7 [ENTER^]16 [A] 0'0-7/16" {1.3}

    4'7-11/16"30 [ENTER^]0 [ENTER^]1 [A] 2'6" {1.4}

    7'1-11/16"1 [ENTER^]0 [ENTER^]0 [ENTER^]1 [A] 1'0"

    8'1-11/16"39 [ENTER^]16 [B] 0'2-7/16"

    7'11-1/4"15 [ENTER^]1 [ENTER^]

    2 [B] 1'3-1/2"6'7-3/4"

    2 [ENTER^]

  • 8/6/2019 HP35 Programs

    20/29

    0 [ENTER^]32 [ENTER^]100 [B] 2'0-5/16"

    4'7-7/16" {1.5}2 [ENTER^]3 / [C] 3'0-15/16" {1.6}[e] 3.0781' {1.7}

    [d] 3'0-15/16" "Notes{1.1} The default value is 16, so no entry is needed this time.{1.2} Or: 2 [C]{1.3} The new number is displayed while the result is calculated (typ).{1.4} For a dimension without any fraction, any denominator will do.{1.5} The result for a).{1.6} The result for b).{1.7} The results for c).

    2. A circle has a diameter of 1'6". Find the circumference and thequarter circle length to the nearest 1/8" and to the nearest 1/100".

    KEYBOARD DISPLAY Notes--------------------------------------------------------------------XEQ [ALPHA] FEET [ALPHA] FRACTION ?8 [R/S] FT^, IN^, N^, D1 [ENTER^]6 [ENTER^]0 [ENTER^]1 [E] 1'6"[b] {2.1}[pi] [C] 4'8-1/2"

    4 [D] 1'2-1/8" {2.2}[a] FRACTION ?100 [R/S] FT^, IN^, N^, D[c] 1'6" {2.3}[pi] [C] 4'8-11/20"4 [D] 1'2-7/50" {2.4}

    Notes{2.1} The display shows F00 as set, indicating use of RR.{2.2} The first result.{2.3} Even though [a] clears F00, RR remains intact.{2.4} The second result.

    3. A 24'0" long Archimedes screw pump is to be installed at an angle of38. What are the horizontal and vertical distances between thesupports, first to the nearest inch, then to the nearest 1/4"? Thisis based on the real-life example that prompted me to write FEET: theheadworks pumps at the Arvin, CA, wastewater treatment plant.

    KEYBOARD DISPLAY Notes--------------------------------------------------------------------XEQ [ALPHA] FEET [ALPHA] FRACTION ?0 [R/S] FT^, IN {3.1}24 [ENTER^]

    0 [E] 24'0"[b]38 [COS] [C] 18'11" {3.2}

  • 8/6/2019 HP35 Programs

    21/29

    [c] 24'0"38 [SIN] [C] 14'9" {3.2}[a] FRACTION ?4 [R/S] FT^, IN^, N^, D[c] 24'0"38 [COS] [C] 18'11" {3.3}[c] 24'0"

    38 [SIN] [C] 14'9-1/4" {3.3}Notes{3.1} Or: 1 [R/S]. The display shows F01 as set, indicating F-I mode.(3.2} The first two results.{3.3} The second two results.

    Program Listing

    The annotations included with the program listing are intended to explain generally how FEET works, and are by no means exhaustive.

    LINE KEYS

    01 * LBL "FEET" ; ### FEET ###02 * LBL a ; ### RESET ###03 0 ; [03-11] Clear XX (R01-R04) and YY (R05-R08)04 STO 0105 STO 0206 STO 0307 STO 0408 STO 0509 STO 0610 STO 0711 STO 0812 XF ; Clear flags 0-713 1.005004 ; REGMOVE constant for XX and YY

    14 STO 0915 16 ; Default "Fraction" (FF)16 "FRACTION ?" ; [16-17] Prompt for FF17 PROMPT18 ABS ; [18-19] Ensure FF is non-negative integer19 INT20 X=0? ; [20-21] Convert FF=0 to FF=121 SIGN22 STO 00 ; Store FF23 1 ; [23-25] If FF=1 (or previously 0) program sets24 X=Y? ; F-I mode25 SF 0126 FIX 0 ; [26-30] Initialize remaining program settings27 CLST28 CF 2229 SF 2730 CF 2931 "FT^, IN" ; [31-35] Display data entry prompt for F-I and32 FC? 01 ; F-I-F calculations33 "^, N^, D"34 AVIEW35 RTN36 * LBL b ; ### STO ### -------------------------------------37 1.011004 ; [37-38] Copy contents of XX into RR38 REGMOVE

    39 SF 00 ; Indicate storage register is in use40 CLST41 CF 22 ; Clear data entry flag

  • 8/6/2019 HP35 Programs

    22/29

    42 AVIEW ; Redisplay XX43 RTN44 * LBL c ; ### RCL ### -------------------------------------45 RCL 09 ; [45-46] Copy contents of XX to YY46 REGMOVE47 11.001004 ; [47-48] Copy contents of RR to XX48 REGMOVE

    49 GTO 99 ; Go to routine to display XX50 * LBL d ; ### D>F ### -------------------------------------51 RCL 09 ; [51-52] Copy contents of XX to YY52 REGMOVE53 XY ; Bring input decimal value back to X54 INT ; [54-69] Parse decimal value into F-I-F and store55 STO 01 ; components56 LASTX57 FRC58 1259 *60 FS? 01 ; [60-61] Jump out if only working with F-I

    61 GTO 1562 INT63 STO 0264 LASTX65 FRC66 RCL 0067 *68 RND69 STO 0370 GTO 98 ; Go to routine to display XX71 * LBL e ; ### F>D ### --------------------------------------72 XEQ 02 ; Data handling73 RCL 01 ; [73-78] Fill RPN stack with XX components

    74 RCL 0275 FS? 01 ; [75-76] Skip [77-80] if in F-I mode76 GTO 1077 RCL 0378 RCL 0479 / ; [79-84] Convert F-I-F or F-I to decimal feet80 +81 * LBL 1082 1283 /84 +85 FIX 4 ; [85-92] Display result86 CLA87 ARCL X88 3989 XTOA90 XY91 FIX 092 AVIEW93 RTN ; Result kept in X so [d] will "reverse" process94 * LBL A ; ### + ### ---------------------------------------95 SF 06 ; Set addition flag96 * LBL B ; ### - ###97 XEQ 02 ; XEQ routine to convert RPN stack to F-I-F or F-I98 FS?C 06 ; [98-103] Subtraction = adding -XX to YY

    99 GTO 01100 -1101 ST* 01

  • 8/6/2019 HP35 Programs

    23/29

    102 ST* 02103 ST* 03104 * LBL 01105 RCL 05 ; [105-121] XX + YY106 ST+ 01107 RCL 06108 ST+ 02

    109 FS? 01110 GTO 98111 RCL 03112 RCL 04113 /114 RCL 07115 RCL 08116 /117 +118 RCL 00119 *120 RND

    121 STO 03122 GTO 98123 * LBL 02 ; -------------------------------------------------124 FS? 22 ; [124-125] If data entered into RPN stack, XEQ 21125 XEQ 21 ; to raise FEET stack126 FS?C 22 ; [126-127] if data entered into RPN stack, XEQ 97127 XEQ 97 ; to process data in RPN stack128 RTN129 * LBL C ; ### * ### ---------------------------------------130 ST* 01131 ST* 02132 ST* 03133 GTO 03

    134 * LBL D ; ### / ### ---------------------------------------135 ST/ 01136 ST/ 02137 ST/ 03138 * LBL 03139 RCL 01 ; [139-166] Reduce XX to proper components140 INT141 STO 01142 LAST X143 FRC144 12145 *146 ST+ 02147 RCL 02148 FS? 01149 GTO 15150 INT151 STO 02152 LASTX153 FRC154 RCL 03155 RCL 04156 /157 +158 RCL 00

    159 *160 RND161 STO 03

  • 8/6/2019 HP35 Programs

    24/29

    162 GTO 98163 * LBL 15164 RND165 STO 02166 GTO 98167 * LBL E ; ### ENTER ### -----------------------------------168 SF 05 ; Set FEET data entry flag

    169 * LBL 97 ; Jump-in point for other subroutines170 FS? 01 ; [170-171] If in F-I mode, skip fraction171 GTO 07172 / ; [172-175] Convert fraction to multiple of FF173 RCL 00174 *175 RND176 STO 03 ; Store fractional part of XX177 RDN178 * LBL 07179 STO 02 ; Store inches part of XX180 RDN

    181 STO 01 ; Store feet part of XX182 * LBL 98183 RCL 03 ; [183-...] Normalize XX, incl. reducing fraction184 X

  • 8/6/2019 HP35 Programs

    25/29

    222 RCL 01 ; [222-224] After normalizing, if the feet part of223 X

  • 8/6/2019 HP35 Programs

    26/29

    F00: RR in useF01: F-I mode setF22: Data entryF27: USER ModeF29: Digit separators(F02-F07 cleared for "clean" display)

    **************************************************************************************** BEGIN PROGRAM LISTING ****************************************************************************************

    HP-35S Multiple cashflow / NPV / IRR / NFV / NUS program

    Hello all,Please find below my financial program for the HP-35s calculator for multiple cashflows / investment analysis.

    Note:

    - indirect registers are used for the multiple cashflows- indirect registers are NOT cleared after end of program- when run again previous values of the cashflows are recalled to stack

    level T(ready to be used again), the cashflow counter is shown on stack level

    X- after entering each cashflow value press the [R/S] key to continue- the number of cashflows is limited by memory only- two labels are used because the solver is used with a program to calcu

    late the IRR (label R program)- obviously you can use different labels (instead of C and R)- to continue after solution for P etc is shown just press [R/S] key

    C001 LBL CC002 SF10C003 INPUT NC004 1C005 +C006 STO JC007 1C008 STO (J)C009 INPUT IC010 STO RC011 0C012 STO JC013 EQN CF0,CF1, ,CFNC014 PSEC015 RCL JC016 RCL (J)C017 STOPC018 STO (J)C019 1C020 STO+ JC021 RCL JC022 RCL NC023 x

  • 8/6/2019 HP35 Programs

    27/29

    C029 0C030 STO JC031 RCL (J)C032 1C033 RCL IC034 100C035 /

    C036 +C037 RCL JC038 ^C039 /C040 STO+ PC041 RCL JC042 RCL NC043 x=y?C044 GTO C048C045 1C046 STO+ JC047 GTO C031

    C048 VIEW PC049 0C050 STO FC051 0C052 STO JC053 RCL (J)C054 1C055 RCL IC056 100C057 /C058 +C059 RCL NC060 RCL J

    C061 -C062 ^C063 *C064 STO+ FC065 RCL JC066 RCL NC067 x=y?C068 GTO C072C069 1C070 STO+ JC071 GTO C053C072 VIEW FC073 CF 10C074 EQN P/((1-(1/(1+I/100)^N))/(I/100))C075 STO UC076 VIEW UC077 0C078 STO QC079 0C080 STO JC081 FN= RC082 SOLVE RC083 VIEW RC084 RCL PC085 RCL F

    C086 RCL UC087 RCL RC088 RTN

  • 8/6/2019 HP35 Programs

    28/29

    R001 LBL RR002 RCL (J)R003 1R004 RCL RR005 100R006 /

    R007 +R008 RCL JR009 ^R010 /R011 STO+ QR012 RCL JR013 RCL NR014 x=y?R015 GTO R019R016 1R017 STO+ JR018 GTO R002

    R019 RCL QR020 0R021 STO JR022 0R023 STO QR024 RdownR025 RdownR026 RTN

    variables used:N = number of periods, excluding investment at t=0

    I = interest or cost of capital in %J = loop counter for cashflowsP = NPVF = NFVU = NUSR = IRR in %Q = temporary variable for solver

    An example:

    *INPUT*N=8I=10CF0=-130000CF1=7000CF2=-10000CF3=20000CF4=20000CF5=20000CF6=12000CF7=-8000CF8=178500

    *OUTPUT*NPV=-4855.85

    NFV=-10408.94NUS=-910.20IRR=9.37%

  • 8/6/2019 HP35 Programs

    29/29

    The output is available in the aforementioned registers and on the 4 stack levels.Note that NPV