Post Reply 
(15C) MM.DDYYYY or DD.MMYYYY to Julian Day [Stack-Only]
08-26-2016, 04:08 AM (This post was last modified: 08-27-2016 08:19 PM by Nick.)
Post: #1
(15C) MM.DDYYYY or DD.MMYYYY to Julian Day [Stack-Only]
Formula: http://www.cs.utsa.edu/~cs1063/projects/...ation.html

Input: X = MM.DDYYYY (Date)
Output: X = JD (Julian Day)

Size: 87 Bytes

Related to: (15C) Julian Day to Day of Week
Related to: (15C) Delta Days

Note: This design requires no temp registers and does not preserve the stack.

Enjoy,
Nick

Code:
01 LBL 0
02 INT
03 LSTx
04 FRAC
05 EEX
06 2
07 *
08 X<->Y
09 ENTER
10 CHS
11 1
12 4
13 +
14 1
15 2
16 /
17 INT
18 1
19 2
20 X<->Y
21 *
22 LSTx
23 Rdn
24 +
25 3
26 -
27 1
28 5
29 3
30 *
31 2
32 +
33 5
34 /
35 INT
36 X<->Y
37 INT
38 LSTx
39 FRAC
40 Rdn
41 +
42 X<->Y
43 Rup
44 EEX
45 4
46 *
47 X<->Y
48 -
49 4
50 8
51 0
52 0
53 +
54 ENTER
55 ENTER
56 Rdn
57 Rdn
58 3
59 6
60 5
61 *
62 +
63 X<->Y
64 4
65 /
66 INT
67 +
68 X<->Y
69 EEX
70 2
71 /
72 INT
73 -
74 X<->Y
75 4
76 0
77 0
78 /
79 INT
80 +
81 3
82 2
83 0
84 4
85 5
86 -
87 RTN

For DD.MMYYYY, insert the following between steps 7 and 8:

Code:
7.1 INT
7.2 X<->Y
7.3 LSTx
7.4 FRAC
7.5 +

Comments:

08 M; DD.YYYY ' Month (Day and Year stored together)
17 a; M; D.Y ' Expression: a
26 m; D.Y; a; a ' Expression: m
35 JD; D.Y; a; a ' Accumulator: JD
40 D; JD; a; .Y ' Day
46 Y; a; JD ' Year
53 y; JD ' Expression: y
57 j; JD; j; j ' Expression: j positioned for constant operation
72 EEX 2 / instead of 1% per accumulator operation
86 JD ' Result
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)