HP-41: CLR & STATUS

I’ve had this simple program on my HP-41 for years, “CLR”. It clears the registers, stack and Alpha as well as setting the correct flags and time/date formats. It also checked to see if the clock had been reset (as it does when the battery runs out) and prompts for Time and Date if it has.

Meeting Garth and Joe at our "mini HHC" (the yearly HP Handheld Club is in the autumn). Great to meet with some fellow geeks and talk HP calculators. Yeay!

Meeting Garth and Joe at our “mini HHC” (the yearly HP Handheld Club is in the autumn). Great to meet with some fellow geeks and talk HP calculators. Yeay!

On my trip to the US, I met with Joseph Horn and Garth Wilson. And it was from Garth I got the idea to extend my CLR program to include a simple status line with the current week number, the current moon phase (percentage of illumination of the moon) as well as the time remaining to the next upcoming alarm, if any.

The moon going through its phases

The program is simply run by XEQ “CLR”. This clears all register, stack and Alpha as well as setting the right combinations of flags. It returns with zero in the display. If you press R/S it will prompt for “DATE^TIME” if the clock has been reset (DATE, Enter, TIME) and then display a status line: (ALARM) WEEK# MOON% – Example: “01:32 27 -35%” which shows it is 1 hour and 32 minutes till the next alarm goes off (no such number if there are no future alarms), it is week #27 and the moon is illuminated 35% and it is waning (a positive number means the phase is waxing/growing). Pressing R/S again shows the running clock (the CLOCK command). You can also access the status line (and then the clock by pressing R/S) by XEQ “STATUS” without having to clear registers, stack and Alpha first (thanks Anette).

Here’s the program listing.

Hope this is of use to someone πŸ™‚

34 thoughts on “HP-41: CLR & STATUS

            1. Why? History doesn’t mean only World War II or French Revolution. It can be also HP-41, or Macintosh, or first IBM machines…

  1. Cute. You’re weclome! I’m glad I inspired you to set up an XEQ β€œSTATUS” function on this program. You never know when someone could ask you what week number it is. Then you can rapidly give an answer without clearing the registers, stack and Alpha. πŸ˜€

    1. You really had me going Anette! I thought you were this sleek, sophisticated, hot Euro chick but now I find out you are really Geek Squad at heart? . Wow. . . wow. . . LOL

  2. Hi Geir,

    I’m fine, thanks; a bit too busy due to my new life in the Caribbean side of the Atlantic, but enjoing it at most… πŸ˜‰

    There are no real “new” project in the HP-41 field, but some improvements in the Clonix and NoV’s: Clonix-41 to run at real 2.1x (really low power achieved by reducing the running time by 50%… πŸ™‚ and the suggested (by Ángel and Michael) feature that allow ROM blocks 0 & 1 to be joined on Clonix-D and NoV-64, mostly handle the multi-banked ROM’s from Ángel.

    Once these two “upgrades” are published I can put some effort in the USB-41 bidirectional comms… this should be a really new enhancement (hopefully).

    All the best.

  3. Geir, Chris,

    Thank you too, and all the HP-41 enthusiasts who have shown me their support along these years. Hope we can continue enjoing these wonderful devices in the years to come.

    Best wishes.

  4. Just found this a couple years late, but you seem to have a bug:

    049 23.062013
    050 DATE
    051 DDAYS

    Line 49 is supposed to be a date, but there is no month 23. is it supposed to be 2? 3? 12? Or should it be 06.232013?

  5. Thanks, I should have noticed that in your listing!

    I notice that the Linux “pom” program, and an app I have on my iPhone both agree on the moon phase %, but your algorithm lags those by 4-5%

    Did you come up with that algorithm on your own? It looks like it is using the date June 23, 2013 as a starting date. To get it back in sync with the other 2 programs I tried, should I just fudge the starting date until it produces the correct phase? Or would it be better to adjust one of the other values instead?

    1. Yes, find a newer and better date/time and it should get back in sync. Please provide the changed steps in the program so I can fix the listing.
      Cool to have your input and contribution πŸ™‚

  6. OK, I’ve got it a little better. I’m not 100% sure exactly what the moon phase is right now. One phone apps says 87%, and another says 86%

    I notice your program has 2 numbers, one exactly twice the other. That can be simplified using LASTx.

    These 3 lines:
    059 29.53058885
    060 MOD
    061 14.76529443

    Can be changed to:
    059 29.53058885
    060 MOD
    061 LASTx
    062 2
    063 /

    A start date of April 3, 2015 seems to work good, even though I think April 4 was full moon. This gives an answer of 86.5% right now.

    049 03.042015 (I use 4.03.2015, since I use MDY format)
    050 DATE
    051 DDAYS
    052 .35
    053 +
    054 TIME
    055 HR
    056 24
    057 /
    058 +
    059 29.53058885
    060 MOD
    061 LASTx
    062 2
    063 /
    064 STO Z
    065 –
    066 XY
    067 /
    068 100
    069 *
    etc..

  7. You might want to hold off a bit… replacing the 0.5640972221 with 0.35 on line 52 wasn’t a good move on my part. It produced a “waning” value when the moon is still waxing.

    This has gotten me intrigued enough that I found the source for the Linux (BSD Unix) “pom” program that displays the phase of the moon in a single line of text, and converted it to run on the HP-71B in BASIC (because it’s more fun than recompiling the C code on a PC of course! πŸ™‚

    I am playing around with that a bit, and may try to convert it to the HP41CX at some point. But no sense in changing your listing yet, as my corrections to your algorithm didn’t work so well near full moon!

Have your say

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s