{ VersionDicentra.mc, HGM,  4-Nov-84  3:02:21
No changes since 18-Aug-84 14:02:06

See MicrocodeVersion.mesa for the fine print.

Fancy macros by Don Charnley, 23-Sep-83 11:20:09}

Set[year, 84'd ];
Set[month,08'd ];
Set[day,  18'd] ;

Set[year, Sub[year, 80'd] ];
Set[month, Sub[month, 1] ];

{ly = 1 if leap year, else 0}
MacroDef[LY, IfAndZero[year, 3, Set[ly, 1], Set[ly, 0] ] ];
{nly = number of leap years gone by}
MacroDef[NLY, Set[nly, Rshift[Add[year, 3], 2] ] ];
{af = 0 if jan or feb, else 1}
MacroDef[AF, IfGreater[month, 1, Set[af, 1], Set[af, 0] ] ];
{af29 = 1 iff leap year and not jan or feb}
MacroDef[AF29, IfEqual[ly, 0, Set[af29, 0], Set[af29, af] ] ];
{msmall = num 31 day months passed if month <= july}
MacroDef[Msmall, Set[msmall, Rshift[Add[1, month],1] ] ];
{mlarge = num 31 day months passed if month > july}
MacroDef[Mlarge, Set[mlarge, Rshift[Add[2, month],1] ] ];
{n31 = number of 31 day months passed this year}
MacroDef[N31, IfGreater[month, 6, Set[n31, mlarge], Set[n31, msmall] ] ];


MacroDef[RD00, Set[rd00, Mul[365'd, year] ] ];
MacroDef[RD01, Set[rd01, Mul[30'd, month] ] ];
MacroDef[Eighty, Set[reldate, Add[reldate, 28853'd] ] ]; {Days from 1901 to 1980}

MacroDef[RelDate,
       Set[reldate, Add[
          rd00,
	  rd01,
	  day,
	  nly,
	  af29,
	  n31] ] ];
MacroDef[RD02, Set[reldate, Sub[reldate, af] ] ];

LY; NLY; AF; AF29; Msmall; Mlarge; N31; RD00; RD01; RelDate; Eighty; RD02; RD02;

MacroDef[HighHalf, Rshift[#1, 8] ];
MacroDef[LowHalf, And[0FF, #1] ];

Set[highDate, HighHalf[reldate]];
Set[lowDate, LowHalf[reldate]];

@VERSION:
	T ← 070, push, {Dicentra, first version (Klamath)}	c1, at[0F,10,ESC2n];
	T ← T LRot8, push,					c2;
	T ← T or 0, {No Float, No Cedar}			c3;
	
	TOS ← highDate,						c1;
	TOS ← TOS LRot8,					c2;
	TOS ← TOS or lowDate,					c3;
	
	STK ← T, GOTO[RRx], {in Misc.mc}			c1;