The Museum of HP Calculators

HP Forum Archive 15

[ Return to Index | Top of Index ]

a very weird 12c program
Message #1 Posted by Don Shepherd on 29 May 2005, 8:55 p.m.

OK guys, I finally found a use for indirect addressing on a 12c. I know that Valentin and Katie, among others I'm sure, have used this concept before, and now it's my turn.

Here is the background. When I die, I want my tombstone to read "Here lies Don Shepherd. He lived 10110110110100101 days." That would be the number of days I lived, in binary. Yes, I know this is weird, but where is it written that you have to be normal? The problem is, I won't be around to tell the stonecutter what number to use. Thus the need for a program that my wife can run after I reach the pearly gates.

Since my 12c will surely be around in another 30-40 years (probably using the current set of batteries too!), that is my platform. I will leave instructions for my wife to run the program: 8.141950 ENTER (the date I died in the format mm.ddyyyy) R/S. After the program runs, RCL 1 and write down the ones and zeroes, then RCL 2 and write down the ones and zeroes (when you RCL 2, if there are less than 10 digits displayed, add zeroes to the LEFT until you have 10 digits). Give these digits to the stonecutter.

It is necessary to use two registers for the binary equivalent of the decimal number of days. That is where indirect addressing works like a charm. Line numbers 22 to 24 in the listing are where the ones and zeroes are added, either to register 2 (for the first part) or 1 (for the last part).

Anyhow, I know this is kind of dumb, but it does point out that indirect addressing on a 12c can be a useful thing. Thanks to Katie and Valentin.

Here is the 12c program listing:

Register Usage 0 # of days between 2 dates, integer 1 output binary value, high order bits 2 output binary value, low order bits 3 multiplier (1, 10, 100, 1000, and so on) 4 10000000000 constant 5 temp use

01 dys days between 2 dates entered on stack 02 sto 0 03 clr stat clears R1-R6 (only need 1 and 2 though) 04 1 multiplier starts at 1 05 sto 3 06 2 add into R2 at the start 07 n 08 1 09 eex 10 1 11 0 12 sto 4 R4 tests when to switch to R1 13 rcl 0 14 2 loop starts here 15 / 16 sto 5 temp storage 17 frac will be .0 or .5 18 2 19 x will be 0 or 1 20 rcl 3 multiplier 21 x 22 rcl cfj 23 + 24 sto cfj indirect add to R2 or R1 25 1 26 0 27 sto x 3 update multiplier 28 rcl 3 multiplier 29 rcl 4 if 10^10 switch to R1 30 - 31 x=0 32 gto 34 33 gto 37 34 1 35 sto 3 start multiplier at 1 again 36 n switch to R1 37 rcl 5 recall temp value 38 intg only look at integer part 39 x=0 40 gto 00 you are done 41 gto 14 else keep looping

      
Alternatives to your tombstone
Message #2 Posted by John L. Shelton on 31 May 2005, 1:39 a.m.,
in response to message #1 by Don Shepherd

Perhaps your tombstone could be in the shape of an HP calculator, though the "portrait mode" calculators would look more reasonable.

By the time you die (perhaps 2050, rather than 1950 in your example), you might be able to afford a digital tombstone, one with keys and a display, and a very-long-life battery (or solar cell.) Then I'd suggest you pre-program the keys to show your "message" in binary, octal, hex, or decimal.

I suspect, however, with rapidly increasing cost of land, that virtual burial will be common by then. People will have websites (in the .CEM domain), and during life, will design their final web page. I'd much rather be "buried" that way.

Let's see... tombstone.parkcrest.cem/2050/jshelton

            
Re: Alternatives to your tombstone
Message #3 Posted by Don Shepherd on 31 May 2005, 8:35 p.m.,
in response to message #2 by John L. Shelton

That's pretty good, John. Actually, I considered the "digital tombstone" comcept once, but the cemetery where I will be buried (Cave Hill, in Louisville, Colonel Sanders is also buried there!) is very conservative regarding allowing unconventional things. They only want granite markers, they frown on glass panels (although they have allowed some of that in the past), and I know if I went to them with the idea of an interactive computer associated with a tombstone, they would laugh at me. I would not be surprized to see such things in the future in cemeteries that are not so conservative.

Let's see, a tombstone in the shape of a HP calculator. My wife would NEVER go for that! I think that she will begrudgingly go for the binary days lived, because that's only a "little" weird. She would frown on major weird.

Thanks for your response, I enjoyed it!

      
Re: a very weird 12c program
Message #4 Posted by Charlie O. on 31 May 2005, 9:59 a.m.,
in response to message #1 by Don Shepherd

Being a non programmer, I don't understand line 41. How does it get called and why?

            
Re: a very weird 12c program
Message #5 Posted by Arnaud Amiel on 31 May 2005, 11:56 a.m.,
in response to message #4 by Charlie O.

Quote:
39  x=0
40  gto 00	you are done
41  gto 14	else keep looping

Line 39 can be read as if X=0 do line 40 else do line 41.

I hope this helps.

Now get yourself a cheap hp12C and enjoy learning programming.

Good luck

Arnaud

      
Re: a very weird 12c program
Message #6 Posted by GWB on 31 May 2005, 9:57 p.m.,
in response to message #1 by Don Shepherd

"Here lies Don Shepherd. He lived 10110110110100101 days."

I would add: ... Don Shepherd, a.k.a. Bicentennial Man. ...

10110110110100101 days are 256.28 years (93605/365.25).

That sad day for all of us will be on a Tuesday, 11/25/2206. Have I miscalculated anything?

            
Re: a very weird 12c program
Message #7 Posted by Don Shephed on 31 May 2005, 10:20 p.m.,
in response to message #6 by GWB

Yes, I just typed that in randomly as an example, to show the general effect.

If I lived exactly 100 years (not a high probability since I am becoming a middle school math teacher relatively late in life), it would be 1000111010101101. I figured I will need the 16th binary digit when I am 89!

I think my 12c batteries may outlive me!

:)

Don


[ Return to Index | Top of Index ]

Go back to the main exhibit hall