Displaying HMS on 42S


The earlier discussion on HMS and that HP doesn't display it in a easy to read format got me thinking about the alpha cababilities on the 42S (and likewise the 41C).

I wrote a quick program that displays HMS as 20 H 10 M 30.12 S and allows for addition and subtraction. Enter the time as HH.MM.SSSS, execute HMS and then enter times to add or substract. It seems to work for positive times. Negative times don't diplay real well.

The display could be changed to ' and " for minutes and seconds.

Note: |- is Alpha Append.

XEQ 01
LBL 00
KEY 1 GTO 01
KEY 2 GTO 02
KEY 3 GTO 03
GTO 00

LBL 01
|- " H "
|- " M "
|- "."
|- " S "

LBL 02
GTO 01

LBL 03
GTO 01


Hi, Bill;

your program is clever and interesting! After buying my HP42S back in the 90's, I felt the need to represent degrees, minutes, seconds as well. So I wrote the following program: (this is a refined version, after a few "shrinking")

01 LBL "HF"
03 X<0?
04 |- "-"
05 ABS
06 AIP
07 |- "º"
08 XEQ 00
09 R^
10 |-"'"
11 XEQ 00
12 R^
13 |-"""
14 LBL 00
15 FP
16 .1
17 X>Y?
18 |-"0"
19 X^2
20 ÷
21 AIP
22 Rv
23 END

Rv and R^ stand for "roll down" and "roll up" respectively. The program intends to be a subroutine that simply adds the HMS representation of the number in the X-register to any existing ALPHA contents (a tag?). It deals with negative numbers as well by simply adding a "-" (minus signal) prior to add the HMS representation. I used º, ' and " instead of D, M and S because of printing issues, mostly. A CLA can be added in the begining, if needed. Also, there is no additional AVIEW or the like to show final ALPHA contents, it must be performed by the "calling" main program.

BTW, if you allow me to, I'd also add a small suggestion:

LBL 03
LBL 02
GTO 01

Both the HP41 and the HP42S have HMS+ and HMS- as standard HH.MMSSSS additon and subtraction. Both use angle/time values in HH.MMSSSSS format and return a valid HH.MMSSSS angle/time representation. I suggest the above "trick" in order to save some bytes by removing the to- and for- convertions and the extra GTO 01.

Hope you enjoy it.


Luiz (Brazil)

(I edditted the post more than four times; I think now it reads better)

Edited: 4 Aug 2004, 12:45 a.m.


Hi Luiz,

I'd totally forgoten about HMS+ and HMS-.

>>BTW, if you allow me to, I'd also add a small suggestion: 

LBL 03
LBL 02
GTO 01


Great suggestion! Shortens it up quite a bit. Thanks.
I need to add a check in the display routine to see if negative before displaying. I'll take a look at your routine to see how you do it. Thanks for posting it.

I really don't have a requirement to do H.MS addition, but I do have a need sometimes to do Minute-Second sums. I think I'll modify my routine to take input as M.S instead of H.MS. Would be a lot easier to enter a long list of minute-seconds.

Thanks for yuor routine & suggestions.


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP 50g - displaying result in engineering format Sean Freeman 10 900 11-24-2013, 05:44 AM
Last Post: C.Ret
  HMS commands Geoff Quickfall 6 570 10-14-2013, 06:27 PM
Last Post: Tim Wessman
  8/60 -> HMS PGILLET 47 2,651 05-04-2013, 11:38 AM
Last Post: Thomas Klemm
  WP34s displaying text Steve B (Canada) 3 384 04-16-2013, 04:32 PM
Last Post: Walter B
  Re: more HMS, aTIME, 34s display, 41c bugs? Christopher Johnson 0 175 03-05-2012, 11:20 AM
Last Post: Christopher Johnson
  more HMS, aTIME, 34s display, 41c bugs? Christopher Johnson 2 281 02-25-2012, 10:06 PM
Last Post: Luiz C. Vieira (Brazil)
  wp 34s vs 41c hms+ Christopher Johnson 9 592 02-23-2012, 10:04 AM
Last Post: Christopher Johnson
  HP-42S displaying Runic alphabet Bill (Smithville, NJ) 13 855 02-19-2012, 02:36 PM
Last Post: Bill (Smithville, NJ)
  H to HMS Bug in HP 15C LE? Eddie W. Shore 2 267 09-26-2011, 11:22 AM
Last Post: Eddie W. Shore
  42s questions and 42s vs 35s snaggs 13 1,232 09-19-2011, 02:44 AM
Last Post: snaggs

Forum Jump: