{ VersionDaybreak.mc, JPM,  9-Aug-85 17:21:04
   copied from VersionDicentra.mc, HGM, 18-Dec-83 9:12:56
   Last Revised:	
   7-Aug-86 16:53:08,	SCJ, removed uFactoruCode, FPTEnabled is sufficient to indicate whether or not Floating point uCode is present
   14-May-86 10:24:54,	SCJ,  using EIS version, which is the most recent ersion and includes changes  to implement floating point
   DEG added code to set floating point appropriately, 24-Jan-86  2:03:37
   DEG cleanup floating point test, 25-Jan-86 16:40:51

See MicrocodeVersion.mesa for the fine print.

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

{	Copyright (C) 1985, 1986 by Xerox Corporation.  All rights reserved.}

Set[year, 86'd ];
Set[month, 1'd ];
Set[day, 25'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 ← 080, push, {Daybreak, first version (Nova)}		c1, at[0F,10,ESC2n];
	T ← T LRot8,						c2;
	STK ← TOS, push, T ← T or 0, {No Cedar}			c3;
	
{	TT ← uFactoruCode,					c1;
	TT ← TT and FPTEnabled, {check to see if floating point enabled} c2;}
	
	Noop,							c1;
	TT ← FPTEnabled, {check to see if floating point enabled} c2;
	T ← T or TT,						c3;
	
	TOS ← highDate,						c1;
	TOS ← TOS LRot8,					c2;
	TOS ← TOS or lowDate,					c3;
	
	STK ← T, GOTO[RRx], {in Misc.mc}			c1;