(* ************************************************************ *
 *								*	
 *	      	    Find the date of EASTER			*
 *								*
 *	Knuth, Fundamental Algorithms, Exercise 1.3.2.14 	*
 *								*
 * ************************************************************ *)


		MIXAL

		FWD 	eastx
		FWD	Y
		FWD	G
		FWD	N
		FWD	Xplus12
		FWD	Dplus3
		
		ORIG 	1000

| march		ALF MARCH
| april		ALF APRIL
| ans		ALF      
| day		ALF DD   		\ Note the invisible 3 spaces here!
| month		ALF MMMMM
		ALF      		\ Note the invisible 3 spaces here!
| year		ALF YYYYY
		ORIG	* 20 +
| C		CON	0		\ C times byte size

| easter	STJ	eastx
		STX	Y
| G		ENTA	0		\ _E1._
		DIV	=19=
		INCX	1
		STX	G(0:2)
		LDA	Y		\ _E2._
		MUL	=1 100 // 1+=	\ see
		INCA	1		\  below
		STA	C(1:4)
		MUL	=3 4 // 1+=	\ _E3._	
		STA	Xplus12(0:2)
					\ MIXAL:  LDA =8(1:1)=
		LDA	=8 /bits 4 ** LSHIFT=
		MUL	C		\ rA=8C
		INCA	680		\ 680=5+27*25
		MUL	=1 25 // 1+=	\ rA=Z+32
| Xplus12	DECA	0
		STA	1F(0:2)		\ Z+20-X
		LDA	Y		\ _E4._
		MUL	=1 4 // 1+=
		ADD	Y
		SUB	Xplus12(0:2)
		INCA	5
		STA	Dplus3
		ENTA	0		\ _E5._
		MUL	=11=
| 1H		INCX	0
		DIV	=30=
		JXNN	* 2+		\ See exercise 15
		INCX	30
		CMPX	=24=
		JE	1F
		CMPX	=25=
		JNE	2F
		LDA	G(0:2)
		DECA	11
		JANP	2F
| 1H		INCX	1
| 2H		DECX	20		\ _E6._ (24-N)
		CMPX	=3=
		JLE	* 2+
		DECX	30
		STX	N(0:2)
		LDAN	N(0:2)		\ _E7._
		ADD	Dplus3
		SRAX	5
		DIV	=7=
		SLAX	5
| N		INCA	0		\ 31-N
		JANN	1F
		CHAR
		LDA	april
		JMP	2F
| 1H		DECA	31
		CHAR	
		LDA	march
| 2H		JBUS	*(18)
		STA	month
		STX	day(1:2)
		LDA	Y
		CHAR
		STX	year
		OUT	ans(18)		\ print
| eastx		JMP	*		\ Return to main program

| start		LDX	=1950=
		JMP	easter
		LDX	Y
		INCX	1
		CMPX	=2000=
		JLE	easter 1+	\ we already linked once :-)
		HLT
		END	start		\ wrap up assembly

			        (* End of File *)