HP 35s User Manual
Have a look at the manual HP 35s User Manual online for free. It’s possible to download the document as PDF or print. UserManuals.tech offer 1114 HP manuals and user’s guides for free. Share the user manual or guide on Facebook, Twitter or Google+.
hp calculators HP 35s Programming using line numbers Programming the HP 35s Using line numbers rather than labels Example
hp calculators HP 35s Programming using line numbers hp calculators - 2 - HP 35s Programming using line numbers - Version 1.0 Programming the HP 35s Doing a simple calculation once on the HP 35s is easy. Doing the same calculation many times, or doing a complicated calculation, takes longer. It can be better to store all the steps needed for the calculation in a program. A program is a set of instructions, stored all together. Once it is written, it can be tested to see if it works correctly. Then it can be used many times, without the need to press every key of the calculation each time. A simple program is just a set of keystrokes stored so that they can be carried out with one key. The HP 35s provides many commands to let programs do more, for example stop and ask for input, or show an intermediate result. This training aid concentrates on simple programming; it also shows a few of the more advanced programming commands. Using line numbers rather than labels The HP 35s has 26 labels for use to define programs or transfers to locations within programs. Unlike the HP 33s, the HP 35s also includes the ability to transfer execution to specific line numbers within one of the 26 labels. This allows for a much greater utilization of program memory without using labels excessively. For example, the program line below illustrates how a goto instruction can now branch to a line number within a lettered label. Step B010 tests whether the value in the X register is less than the value in the Y register. If true, step B011 transfers execution to step 018 of label B. On the HP 33s, step B011 would have required a goto instruction pointing to a step with one of the 26 labels. Figure 1 In the past, using line number GTO and XEQ instructions in programs was difficult if changes were made to the program after these instructions were entered, since the program steps would have changed but the transfer instructions would still have pointed at the old line numbers, making the program work incorrectly. The HP 35s removes this constraint. When a program containing line number GTO or XEQ instructions has a step added or deleted, the HP 35s dynamically changes the lines referred to by these instructions to point at the correct location. For example, if in the program shown in figure 1 above, another step were added before step B010 such as an ABS instruction, steps B010 would become step B011 and step B011 would become step B012. More importantly, the HP 35s would change the new step B012’s GTO instruction to continue pointing at the same location within the program – step B019 in this instance. This is shown in figure 2 below. Figure 2 This dynamic renumbering allows for the use of line numbers in GTO or XEQ instructions without the drawbacks earlier, less-advanced calculators may have had.
hp calculators HP 35s Programming using line numbers hp calculators - 3 - HP 35s Programming using line numbers - Version 1.0 In detail, the HP 35s handles changes in a program containing line number GTO and/or XEQ instructions as follows: Edit performed HP 35s program dynamically changed so that A step is inserted before a GTO or XEQ instruction All GTO and XEQ instructions are renumbered to point to the revised (higher step number) location A step is deleted before a GTO or XEQ instruction All GTO and XEQ instructions are renumbered to point to the revised (lower step number) location The step pointed to by a GTO or XEQ instruction is deleted Any GTO or XEQ instructions continue to point to the same instruction. The instruction that now fills the previous step number is the destination of the transfer instruction. The HP 35s now offers the ability to take advantage of a large program memory capacity, limited only by a user’s imagination. Example 1: Rewrite the program from page 14-4 of the HP 35s User’s Guide to use only one label. Use line numbers for all transfer instructions. Solution: The program as presented on page 14-4 looks like this: S001 LBL S S002 INPUT A S003 INPUT B S004 INPUT C S005 INPUT D S006 RCL D S007 RCL C S008 RCL B S009 RCL A S010 X2 S011 XEQ Q001 S012 XEQ Q001 S013 XEQ Q001 S014 SQRT S015 RTN Q001 LBL Q Q002 X Y Q003 X2 Q004 + Q005 RTN Steps S011 through S013 would need to be changed to point at the step after S015 RTN. Since we will be removing the LBL Q instruction, steps previously labeled Q002 through Q005 will now be right after step S015 RTN. They would now be labeled S016 through S019. The XEQ instructions found at steps S011 through S013 should now point to step S016. The revised program using only one label is shown below. S001 LBL S S002 INPUT A S003 INPUT B S004 INPUT C S005 INPUT D S006 RCL D S007 RCL C S008 RCL B S009 RCL A S010 X2 S011 XEQ S016 S012 XEQ S016 S013 XEQ S016 S014 SQRT S015 RTN S016 X Y S017 X2 S018 + S019 RTN The program is not only one total line shorter but uses only one label. Consistent use of line number GTO and XEQ instructions allows for better utilization of the 26 letter labels.
hp calculators HP 35s Accessing the stack registers The stack registers Examples
hp calculators HP 35s Accessing the stack registers hp calculators - 2 - HP 35s Accessing the stack registers - Version 1.0 The stack registers The HP 35s uses an operational stack of four registers, called X, Y, Z and T and LASTx. In RPN mode, these registers are used to hold values for computations. In algebraic mode, these registers hold results from previous calculations. Chapter 2 of the HP 35s User’s Guide explains the RPN stack in detail. Many of these features work in algebraic mode as well. In RPN mode, these stack registers are easily accessed using the !, #, !$ and % keys whether in a program or in normal computations. Access to these registers within algebraic mode is essentially the same, but the way the HP 35s presents these registers to the user is slightly different. Examples The examples shown below indicate some of the ways the stack registers can be accessed within algebraic mode as well as using this type of access in RPN mode within programs. Many efficiencies can be achieved in RPN mode using these approaches. Example 1: Compute 1 + 2 then 3 + 4 and then divide 5 by the sum of the previous two results in algebraic mode. Solution: &() Figure 1 *+) Figure 2 ,-!4# Figure 3 At this point, the HP 35s displays the four level stack with the cursor beneath the Y register. This register contains the first calculation we did above (the 1 + 2). Pressing ) will copy a reference to this register back to the calculation in progress as shown below. REGY stands for “register Y.” Figure 4
hp calculators HP 35s Accessing the stack registers hp calculators - 3 - HP 35s Accessing the stack registers - Version 1.0 #.) Figure 5 #.) (REGX stands for “register X.”) Figure 6 ) (This completes the calculation) Figure 7 Answer: The answer is 0.5. The larger point is the ability to reference up to four previous results when in algebraic mode. Example 2: In RPN mode within a program, fill the stack with 1, 2, 3, and 4. Then divide the 4 by (1+2x3), but do so without losing any of the stack register contents. Solution: !/&))())*))+ Figure 8 (Note: the )key is pressed twice above in order to terminate digit entry upon the first press and then to actually place an ) into the program when pressed the second time). At this point, the four level stack is full of the four values. If you were to attempt to enter the 7 for the division, the 1 that was entered first would disappear off the top of the stack. However, the following technique can be used to operate upon a number located in the X register without losing any values from the stack. The technique involves rolling the value in X down to the T register and then entering an equation that operates upon the T register to perform the calculation. This can be quite an involved expression. The result will be placed into the X register and the previous contents of Y, Z, and T are preserved. #0
hp calculators HP 35s Accessing the stack registers hp calculators - 4 - HP 35s Accessing the stack registers - Version 1.0 Figure 9 # Figure 10 11) Figure 11 -4&(2* Figure 12 ) Figure 13 Answer: The lines entered into this program would, when executed, take the value that was originally in X and divide it by ( 1 + 2 x 3 ) without disturbing the stack. While this is actually a mixing of algebraic features within the RPN mode, it provides HP 35s users with a tremendous ability to control the calculator. .
hp calculators HP 35s Indirect register data packing program The HP 35s and indirect registers Saving program memory space Saving indirect storage space The program listing Usage instructions Entering program lines Line by line analysis of the program Saving keystrokes Usage examples
hp calculators HP 35s Indirect register data packing program hp calculators - 2 - HP 35s Indirect register data packing program - Version 1.0 The HP 35s and indirect registers The HP35s contains registers or variables that can be referenced directly or indirectly. Variables A through Z can be directly addressed, as in a !# instruction. Indirect addressing uses two of these direct variables as indices that hold the location or address where an operation is to be performed. The two variables that are used this way are $ and %. The indirect registers begin at address 0 and can go up to 800, if the user allocates that many. That is 801 additional storage registers compared to the earlier HP 33s calculator. It is also possible to address the direct variables and the statistics variables indirectly using addresses of -1 through -32. Address -1 would refer to the direct variable #, address -26 would refer to the direct variable &, and -27 trough -32 would refer to the statistical summation registers. This is shown in a table on page 14-22 of the HP 35s user’s guide. The way indirect addressing works is to store the number corresponding to the register you wish to use in either $ or %. Then you perform a !7 or !A (or any other allowed operation). For example, if you wish to recall a value stored in direct register #, you can either press # or store -1 into $ by !7 and then perform a 7. Both will recall the value stored in A. At first glance, that may not appear to be worth doing, since it takes more key presses to use the indirect method. However, where it becomes very useful is when you need to work with a lot of numbers, often within a program, or when you may not be able to know in advance where the number you wish to use is stored. Saving program memory space For example, suppose you have 20 numbers you wish to sum. A direct program might be written having these numbers stored in # through (. The program to sum them (which would take 41 lines of code and at least 120 bytes of memory), might look like: A001 LBL A A002 RCL A A003 RCL B A004 + A005 RCL C A006 + A007 RCL D A008 + … A039 RCL T A040 + A041 RTN On the other hand, a program using the indirect registers might have the numbers stored in indirect locations 1 through 20. The program to sum the 20 values might look like this one. This program only takes 10 lines of code and only 32 bytes of code. Sure, developing the second program might take a little more time than the first, but it comes at a great reduction of program memory space used. A001 LBL A A002 20 A003 STO I A004 RCL (I) A005 DSE I A006 RCL (I) A007 + A008 DSE I A009 GTO A006 A010 RTN Saving indirect storage space To allocate a portion of the HP 35s memory to hold indirect registers, store a non-zero value into the highest register needed. If you need 100 registers to hold numbers and if locations 0 to 99 will work for your need, storing a non-zero value into indirect storage location 100 will allocate HP 35s calculator memory to create the block of indirect registers 0 through 100. Warning: If you store a zero into memory location 100, the HP 35s will dynamically reclaim all zero indirect