How to resolve the algorithm Holidays related to Easter step by step in the 360 Assembly programming language
How to resolve the algorithm Holidays related to Easter step by step in the 360 Assembly programming language
Table of Contents
Problem Statement
Calculate the dates of:
As an example, calculate for the first year of each century from; From the year 325 CE on, Easter Sunday has been defined as the first Sunday after the first full moon on or after the day of the March equinox. However, the actual astronomical values for the moments of the full moon and equinox are not used. Instead, approximations are used, the first one being that the equinox is assumed to fall on March 21st every year. The tracking of the moon phases is similarly done with relatively straightforward arithmetic (compared to the sort required for astronomical accuracy) which amounts to maintaining a lunisolar calendar in parallel to our standard purely-solar one. When Pope Gregory reformed the Catholic calendar in 1582 CE, the drifting of Easter with respect to the seasons was the driving motivation, and the rules for determining it (called the computus) were altered to correct that drift. Catholic nations adopted both the new calendar and the new computus right away, while Western Protestant nations adopted them more gradually over the next 350 years or so. Eventually, even nations dominated by the Eastern Orthodox church adopted a similar calendar reform (the Revised Julian calendar), so pretty much the whole world agrees on what day it is for civil purposes. But the Eastern churches never adopted the corresponding Easter rule changes; they still use the original Julian calendar and computus to determine the date of what is known in the West as "Orthodox Easter". Therefore, your output should indicate which computus was used to calculate the dates and, at least for historical dates where the calendar can't be assumed or is location-dependent, which calendar those dates are given in. You may find algorithms on the Computus Wikipedia page. Some of the results: In the year 400 CE, Easter Sunday was April 1st (in the contemporary Julian calendar), making Ascension Thursday May 10th and Pentecost May 20th. It is ahistorical to give a date so far back for either Trinity Sunday or Corpus Christi, neither of which were observed until centuries later, but they would have been May 27th and 31st. If you extend the modern civil calendar back that far, those days are instead assigned the subsequent dates: Easter on April 2nd, Ascension on May 11th, Pentecost on May 21st. Skipping forward to the year 2100 CE, assuming the rules don't change between now and then, the Western churches will observe Easter on March 28, Ascension Thursday May 6th, Pentecost May 16th, Trinity Sunday May 23rd and Corpus Christi May 27th. Heading East, the Orthodox rules place Easter on April 18 in the original Julian calendar; the corresponding civil date is May 2nd. That puts the Ascension on June 10th and Pentecost June 20th. Orthodox Trinity Sunday is the same day as Pentecost, but they observe All Saints' Sunday the following week, June 27th. Corpus Christi is a purely Catholic date that has no Orthodox version.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Holidays related to Easter step by step in the 360 Assembly programming language
Source code in the 360 programming language
* Holidays related to Easter 29/05/2016
HOLIDAYS CSECT
USING HOLIDAYS,R13 base register
B 72(R15) skip savearea
DC 17F'0' savearea
STM R14,R12,12(R13) prolog
ST R13,4(R15) "
ST R15,8(R13) "
LR R13,R15 "
LA R9,2 nn=2
LOOPNN C R9,=F'2' if nn=2
BNE NN2
NN1 MVC I1,=F'400' i1=400
MVC I2,=F'2100' i2=2100
MVC I3,=F'100' i3=100
B NN3
NN2 MVC I1,=F'2010' i1=2010
MVC I2,=F'2020' i2=2020
MVC I3,=F'1' i3=1
NN3 MVC PG(L'PGT),PGT pg=pgt
L R1,I1 i1
XDECO R1,XDEC edit i1
MVC PG+24(4),XDEC+8 output i1
L R1,I2 i2
XDECO R1,XDEC edit i2
MVC PG+32(4),XDEC+8 output i2
L R1,I3 i3
XDECO R1,XDEC edit i3
MVC PG+42(3),XDEC+9 output i3
XPRNT PG,L'PGT print buffer
L R6,I1 y=i1
LOOPY C R6,I2 do y=i1 to i2 by i3
BH ELOOPY leave y
LR R4,R6 y
SRDA R4,32 ~
D R4,=F'19' /19
ST R4,A a=y//19
LR R4,R6 y
SRDA R4,32 ~
D R4,=F'100' /100
ST R5,B b=y/100
ST R4,C c=y//100
L R4,B b
SRDA R4,32 ~
D R4,=F'4' /4
ST R5,D d=b/4
ST R4,E e=b//4
L R4,B b
LA R4,8(R4) +8
SRDA R4,32 ~
D R4,=F'25' /25
ST R5,F f=(b+8)/25
L R4,B b
S R4,F -f
LA R4,1(R4) +1
SRDA R4,32 ~
D R4,=F'3' /3
ST R5,G g=(b-f+1)/3
L R5,A a
M R4,=F'19' *19
LR R4,R5 .
A R4,B +b
S R4,D -d
S R4,G -g
LA R4,15(R4) +15
SRDA R4,32 ~
D R4,=F'30' /30
ST R4,H h=(19*a+b-d-g+15)//30
L R4,C c
SRDA R4,32 ~
D R4,=F'4' /4
ST R5,I i=c/4
ST R4,K k=c//4
L R4,E e
SLA R4,1 <<1 <=> *2
LA R4,32(R4) +32
L R2,I i
SLA R2,1 <<1 <=> *2
AR R2,R4 32+2*e+2*i
S R2,H -h
S R2,K -k
SRDA R2,32 ~
D R2,=F'7' /7
ST R2,L l=(32+2*e+2*i-h-k)//7
L R5,H h
M R4,=F'11' *11
A R5,A +a
L R3,L l
M R2,=F'22' *22
AR R3,R5 a+11*h+22*l
LR R4,R3 .
SRDA R4,32 ~
D R4,=F'451' /451
ST R5,M m=(a+11*h+22*l)/451
L R2,H h
A R2,L +l
L R5,M m
M R4,=F'7' *7
SR R2,R5 (h+l)-(7*m)
LA R2,114(R2) +114
ST R2,N n=h+l-7*m+114
L R4,N n
SRDA R4,32 ~
D R4,=F'31' /31
ST R5,XM xm=n/31
LA R4,1(R4) +1
ST R4,XD xd=n//31+1
LA R10,PG pgi=0
MVC PG,=CL84' ' pg=' '
XDECO R6,XDEC edit y
MVC 0(4,R10),XDEC+8 output y
LA R10,4(R10) pgi=pgi+3
LA R8,5 loop counter for loopi
LA R7,1 i=1
LOOPI LR R1,R7 do i=1 to 5; r1=i
SLA R1,1 *2
LH R2,OFFSET-2(R1) offset(i)
L R4,XD xd
AR R4,R2 wd=xd+offset(i)
WHILE L R1,XM xm
SLA R1,1 *2
LH R2,DAYS-2(R1) days(xm)
CR R4,R2 while wd>days(xm)
BNH WEND leave while
SR R4,R2 wd=wd-days(xm)
L R2,XM xm
LA R2,1(R2) xm+1
ST R2,XM xm=xm+1
B WHILE loop while
WEND ST R4,XD xd=wd
LA R10,1(R10) pgi=pgi+1
LR R1,R7 i
MH R1,=AL2(L'HOLIDAY) *9
LA R14,HOLIDAY-9(R1) @holiday(i)
MVC 0(L'HOLIDAY,R10),0(R14) output holiday(i)
LA R10,9(R10) pgi=pgi+9
L R1,XD xd
XDECO R1,XDEC edit xd
MVC 0(3,R10),XDEC+9 output xd
LA R10,3(R10) pgi=pgi+3
L R1,XM xm
MH R1,=AL2(L'MONTH) *3
LA R14,MONTH-3(R1) @month(xm)
MVC 0(L'MONTH,R10),0(R14) output month(xm)
LA R10,3(R10) pgi=pgi+3
LA R7,1(R7) i+1
BCT R8,LOOPI next i
XPRNT PG,L'PG print buffer
A R6,I3 y=y+i3
B LOOPY next y
ELOOPY BCT R9,LOOPNN next nn
L R13,4(0,R13) epilog
LM R14,R12,12(R13) "
XR R15,R15 "
BR R14 exit
A DS F a=y//19
B DS F b=y/100
C DS F c=y//100
D DS F d=b/4
E DS F e=b//4
F DS F f=(b+8)/25
G DS F g=(b-f+1)/3
H DS F h=(19*a+b-d-g+15)//30
I DS F i=c/4
K DS F k=c//4
L DS F l=(32+2*e+2*i-h-k)//7
M DS F m=(a+11*h+22*l)/451
N DS F n=h+l-7*m+114
XM DS F month
XD DS F day
I1 DS F from year i1
I2 DS F to year i2
I3 DS F step year i3
MONTH DC CL3'jan',CL3'feb',CL3'mar',CL3'apr',CL3'may',CL3'jun'
DAYS DC H'31',H'28',H'31',H'30',H'31',H'30'
HOLIDAY DC CL9'Easter',CL9'Ascension',CL9'Pentecost'
DC CL9'Trinity',CL9'Corpus'
OFFSET DC H'0',H'39',H'10',H'7',H'4'
PGT DC CL45'Christian holidays from .... to .... step ...'
PG DC CL84' ' buffer
XDEC DS CL12 temp for edit
YREGS
END HOLIDAYS
You may also check:How to resolve the algorithm Password generator step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Minimal steps down to 1 step by step in the Mathematica/Wolfram Language programming language
You may also check:How to resolve the algorithm Averages/Root mean square step by step in the REXX programming language
You may also check:How to resolve the algorithm Successive prime differences step by step in the Wren programming language
You may also check:How to resolve the algorithm Rosetta Code/Count examples step by step in the Mathematica/Wolfram Language programming language