a very weird 12c program « Next Oldest | Next Newest »

 ▼ Don Shepherd Posting Freak Posts: 1,392 Threads: 142 Joined: Jun 2007 05-29-2005, 08:55 PM 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 ``` ▼ John L. Shelton Member Posts: 63 Threads: 8 Joined: Jan 1970 05-31-2005, 01:39 AM 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 ▼ Don Shepherd Posting Freak Posts: 1,392 Threads: 142 Joined: Jun 2007 05-31-2005, 08:35 PM 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! Charlie O. Member Posts: 75 Threads: 15 Joined: Jan 1970 05-31-2005, 09:59 AM Being a non programmer, I don't understand line 41. How does it get called and why? ▼ Arnaud Amiel Senior Member Posts: 362 Threads: 30 Joined: Jul 2005 05-31-2005, 11:56 AM 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 GWB Member Posts: 88 Threads: 10 Joined: Jan 1970 05-31-2005, 09:57 PM "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? ▼ Don Shepherd Posting Freak Posts: 1,392 Threads: 142 Joined: Jun 2007 05-31-2005, 10:20 PM 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

 Possibly Related Threads... Thread Author Replies Views Last Post HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 865 11-11-2013, 08:28 PM Last Post: Davi Ribeiro de Oliveira hp50g screen weird line Sok-khieng Chum Hun 2 524 09-10-2013, 08:11 AM Last Post: Sok-khieng Chum Hun weird statistics bug in wp34s Andrew Nikitin 5 824 06-20-2013, 01:54 PM Last Post: Namir Weird behavior from lithium AAs Dave Britten 4 541 11-14-2012, 06:22 PM Last Post: Lars Bergström HP-12C program Gerson W. Barbosa 5 711 02-22-2012, 04:12 AM Last Post: Gerson W. Barbosa OT weird cursor behavior Martin Pinckney 10 1,055 10-17-2011, 10:54 AM Last Post: Paul Berger (Canada) 15C LE - weird self-test behavior Katie Wasserman 0 269 09-19-2011, 11:52 PM Last Post: Katie Wasserman HP 12C, 12C Platinum & 15C iOS App Walter Lam 2 486 06-02-2011, 01:25 PM Last Post: Andrés C. Rodríguez (Argentina) Weird 28S keyboard on Anniversary model Keith Midson 4 500 03-29-2011, 01:02 PM Last Post: Palmer O. Hanson, Jr. Introducing myself... and a question on a weird 48G Cristian Arezzini 12 1,026 03-07-2011, 11:51 PM Last Post: Cristian Arezzini

Forum Jump: