(42S) HP 67 Calendar Functions (Standard Pac)
01-05-2020, 03:43 AM
Post: #1
 Dave Britten Senior Member Posts: 1,887 Joined: Dec 2013
(42S) HP 67 Calendar Functions (Standard Pac)
This is a pretty straight conversion of the Calendar Functions program included in the HP 67 Standard Pac. I've only made a few changes to it in the conversion:

1. Added a nice 42S menu to replicate the key labels on the card.
2. Replaced registers A, I, and C with 00, 01, and 02 respectively.
3. Replaced some 67 idioms with their 42S counterparts (F? 3 to FS?C 22, STOi to STO IND 01, etc.).
4. Replaced usage of divide-FRAC-multiply with the MOD operator to eliminate rounding error. This also eliminated the need for LBL E to call LBL 3, and the LBL 3 step was removed.

Usage

For more detailed instructions and examples, see the HP 67 Standard Pac, page 04-01. Here's the basics:

DT1: Date 1
DT2: Date 2
DAYS: Days (number of days between DT1 and DT2)
W.D: Weeks + Days (numbers of weeks and days between DT1 and DT2, in W.D format)

DT1, DT2, DAYS, and W.D act as both inputs and outputs. To input a value, enter it in X, and press the appropriate key. To calculate a value, press the key without entering any data. After entering any two of these values (but only one of either DAYS or W.D), you can calculate the other two values.

→DOW works independently. Enter a date into X, and press the →DOW key to calculate the day of the week. 0=Sunday, 1=Monday, 6=Saturday.

All dates are entered in MM.DDYYYY format, and this program is accurate for dates between March 1, 1900 and February 28, 2100.

Code:
00 { 294-Byte Prgm } 01▸LBL "DATE67" 02 CLMENU 03 "DT1" 04 KEY 1 XEQ A 05 "DT2" 06 KEY 2 XEQ B 07 "DAYS" 08 KEY 3 XEQ C 09 "W.D" 10 KEY 4 XEQ D 11 "→DOW" 12 KEY 5 XEQ E 13▸LBL 10 14 MENU 15 STOP 16 GTO 10 17▸LBL A 18 RCL 04 19 RCL 02 20 - 21 3 22 GTO 00 23▸LBL B 24 RCL 03 25 RCL 02 26 + 27 4 28▸LBL 00 29 STO 01 30 R↓ 31 365.25 32 STO 05 33 30.6001 34 STO 06 35 R↓ 36 R↓ 37 FS?C 22 38 GTO 01 39 STO IND 01 40 122.1 41 - 42 RCL 05 43 ÷ 44 IP 45 STO 09 46 RCL 05 47 × 48 IP 49 RCL IND 01 50 - 51 +/- 52 STO 00 53 RCL 06 54 ÷ 55 IP 56 STO 07 57 RCL 00 58 X<>Y 59 RCL 06 60 × 61 IP 62 - 63 STO 08 64 RCL 07 65 1 66 RCL 08 67 % 68 - 69 - 70 RCL 07 71 14 72 ÷ 73 XEQ 02 74 RCL 09 75 1ᴇ6 76 ÷ 77 + 78 RTN 79▸LBL 01 80 R↓ 81 ENTER 82 IP 83 STO 07 84 - 85 100 86 × 87 ENTER 88 IP 89 STO 08 90 - 91 1ᴇ4 92 × 93 STO 09 94 RCL 07 95 1 96 + 97 ENTER 98 1/X 99 0.7 100 + 101 +/- 102 XEQ 02 103 RCL 06 104 × 105 IP 106 RCL 09 107 RCL 05 108 × 109 IP 110 + 111 RCL 08 112 + 113 STO IND 01 114 1720982 115 + 116 RTN 117▸LBL 02 118 IP 119 STO+ 09 120 12 121 × 122 - 123 RTN 124▸LBL C 125 STO 02 126 FS?C 22 127 RTN 128 RCL 04 129 RCL 03 130 - 131 STO 02 132 RTN 133▸LBL D 134 FS?C 22 135 GTO 04 136 XEQ C 137 ENTER 138 ENTER 139 7 140 ÷ 141 IP 142 X<>Y 143 7 144 MOD 145 10 146 ÷ 147 + 148 RTN 149▸LBL 04 150 ENTER 151 IP 152 7 153 × 154 X<>Y 155 FP 156 10 157 × 158 + 159 STO 02 160 RTN 161▸LBL E 162 SF 22 163 RCL 05 164 5 165 XEQ 00 166 RCL IND 01 167 5 168 + 169 7 170 MOD 171 END