-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathp19.exa
174 lines (142 loc) · 1.62 KB
/
p19.exa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
; ==== PROJECT EULER 19 ====
; ==== Y (MODE: L) ====
LINK 800
COPY 1901 X
NOTE F: YYYY ISLEAP
MARK LOOP
VOID M
MAKE
COPY X F
MODI X 400 T
FJMP ISLEAP
MODI X 4 T
FJMP DIV4
JUMP NOTLEAP
MARK DIV4
MODI X 100 T
FJMP NOTLEAP
JUMP ISLEAP
MARK NOTLEAP
COPY 0 F
JUMP OUTPUT
MARK ISLEAP
COPY 1 F
JUMP OUTPUT
MARK OUTPUT
FILE T
DROP
COPY T M
ADDI X 1 X
JUMP LOOP
; ==== MD (MODE: L) ====
LINK 800
MARK LOOP
COPY -1 M
GRAB M
LINK -1
TEST F > 2000
TJMP DONE
NOTE CREATE CALENDAR
COPY F T
WIPE
MAKE
COPY 31 F
TJMP ISLEAP
COPY 28 F
MARK MARCH
COPY 31 F
COPY 30 F
COPY 31 F
COPY 30 F
COPY 31 F
COPY 31 F
COPY 30 F
COPY 31 F
COPY 30 F
COPY 31 F
SEEK -9999
NOTE WALK CALENDAR
MARK NEXTMONTH
COPY 1 X
MARK NEXTDAY
TEST EOF
TJMP NEXTYEAR
COPY 0 M ; NOT DONE
COPY X M ; DAY OF MONTH
ADDI X 1 X
TEST X > F
TJMP NEXTMONTH
SEEK -1
JUMP NEXTDAY
MARK NEXTYEAR
WIPE
LINK 800
JUMP LOOP
MARK ISLEAP
COPY 29 F
JUMP MARCH
MARK DONE
COPY 1 M
HALT
; ==== S1 (MODE: L) ====
NOTE 1/1/1901 IS TUESDAY
COPY 2 X
MAKE
COPY 0 F
MARK LOOP
NOTE M: DONE? DAY
TEST M = 1
TJMP DISPLAY
TEST X = 0
TJMP SUNDAY
VOID M
MARK NEXTDAY
ADDI X 1 X
TEST X > 6
TJMP CLAMP
JUMP LOOP
MARK CLAMP
COPY 0 X
JUMP LOOP
MARK SUNDAY
TEST M = 1
TJMP INCREMENT
JUMP NEXTDAY
MARK INCREMENT
SEEK -1
ADDI F 1 T
SEEK -1
COPY T F
JUMP NEXTDAY
MARK DISPLAY
LINK 801
SEEK -1
COPY F X
COPY X M
COPY X M
COPY X M
HALT
; ==== D0 (MODE: L) ====
LINK 801
COPY 110 GX
SWIZ M 1 T
ADDI T 327 GP
MARK LOOP
NOOP
JUMP LOOP
; ==== D1 (MODE: L) ====
LINK 801
COPY 100 GX
SWIZ M 2 T
ADDI T 327 GP
MARK LOOP
NOOP
JUMP LOOP
; ==== D2 (MODE: L) ====
LINK 801
COPY 90 GX
SWIZ M 3 T
ADDI T 327 GP
MARK LOOP
NOOP
JUMP LOOP