70 Section 6: Programming Basics

This is the method used above, where h was placed in the X-register before running the program. No v instruction is necessary because program execution (here: ´A) both terminates digit entry and enables the stack lift. The above program then multiplied the contents of the X-register (h) by 2.

The presence of the stack even makes it possible to load more than one variable prior to running a program. Keeping in mind how the stack moves with subsequent calculations and how the stack can be manipulated (as with ®), it is possible to write a program to use variables which have been keyed into the X-, Y-, Z-, and T-registers.

2.Direct entry. Enter the data as needed as the program runs. Write a ¦ (run/stop) instruction into the program where needed so the program will stop execution. Enter your data, then press ¦ to restart the program.

Do not key variable data into the program itself. Any values that will vary should be entered anew with each program execution.

Program Memory

At power-up (Continuous Memory reset), the HP-15C offers 322 bytes of program memory and 21 storage registers. Most program steps (instructions) use one byte, but some use two. The distribution of memory capacity can be altered, as explained in appendix C. The maximum attainable program memory is 448 bytes (with the permanent storage registers—RI, R0, and R1 — remaining); maximum number of storage registers is 67 (with no program memory).

Example. Mother's Kitchen, a canning company, wants to package a ready-to- eat spaghetti mix containing three different cylindrical cans: one of spaghetti sauce, one of grated cheese, and one of meatballs. Mother's needs to calculate the base areas, total surface areas, and volumes of the three different cans. It would also like to know, per package, the total base area, surface area, and volume.