#####################################################
#####		 	Extras			#####
#####################################################


# read r0 always return zero
R0004: _R0004 is _R0004 & _R0004=0	{ local x:4=0; 	export x;	}
R0004: _R0004 is _R0004			{		export _R0004;	}

R1115: _R1115 is _R1115 & _R1115=0	{ local	x:4=0; 	export x;	}
R1115: _R1115 is _R1115			{ 		export _R1115;	}

R2731: _R2731 is _R2731 & _R2731=0	{ local x:4=0; 	export x;	}
R2731: _R2731 is _R2731			{		export _R2731;	}


adr9: res is op0406 & s1115
[ res = ((s1115 << 4) | (op0406 << 1)) + inst_start; ] 
{ 
	export *:4 res; 
}

adr22: res is s0005; op1631 & op1616=0
[ res = ((s0005 << 16) | op1631) + inst_start; ] 
{ 
	export *:4 res;
}

adr32: res is op1631 & op1616=0; op3247
[ res = ((op3247 << 16) | op1631) + inst_start; ]
{
	export *:4 res;
}

adr32i: res is op1631 & op1616=0; op3247
[ res = ((op3247 << 16) | op1631); ]
{
	export *[const]:4 res;
}

reg4: op0_1720 is op2323=0 & op0_1720 { export op0_1720; }
reg4: op1_1720 is op2323=1 & op1_1720 { export op1_1720; }



##### Prep/Disp Loop #####

PrepList20: r20			is prep27=1 & r20					{ push(r20); }
PrepList20:			is prep27=0						{ }

PrepList21: r21			is prep26=1 & prep27=0 & r21				{ push(r21); }
PrepList21: PrepList20,r21	is prep26=1 & PrepList20 & r21				{ push(r21); }
PrepList21: PrepList20		is prep26=0 & PrepList20		 		{ }

PrepList22: r22			is prep25=1 & prep2627=0 & r22				{ push(r22); }
PrepList22: PrepList21,r22	is prep25=1 & PrepList21 & r22				{ push(r22); }
PrepList22: PrepList21		is prep25=0 & PrepList21		 		{ }

PrepList23: r23			is prep24=1 & prep2527=0 & r23				{ push(r23); }
PrepList23: PrepList22,r23	is prep24=1 & PrepList22 & r23				{ push(r23); }
PrepList23: PrepList22		is prep24=0 & PrepList22		 		{ }

PrepList24: r24			is prep31=1 & prep2427=0 & r24				{ push(r24); }
PrepList24: PrepList23,r24	is prep31=1 & PrepList23 & r24				{ push(r24); }
PrepList24: PrepList23		is prep31=0 & PrepList23		 		{ }

PrepList25: r25			is prep30=1 & prep2427=0 & prep31=0 & r25		{ push(r25); }
PrepList25: PrepList24,r25	is prep30=1 & PrepList24 & r25				{ push(r25); }
PrepList25: PrepList24		is prep30=0 & PrepList24				{ }

PrepList26: r26			is prep29=1 & prep2427=0 & prep3031=0 & r26		{ push(r26); }
PrepList26: PrepList25,r26	is prep29=1 & PrepList25 & r26				{ push(r26); }
PrepList26: PrepList25		is prep29=0 & PrepList25				{ }

PrepList27: r27			is prep28=1 & prep2427=0 & prep2931=0 & r27		{ push(r27); }
PrepList27: PrepList26,r27	is prep28=1 & PrepList26 & r27				{ push(r27); }
PrepList27: PrepList26		is prep28=0 & PrepList26				{ }

PrepList28: r28			is prep23=1 & prep2431=0 & r28				{ push(r28); }
PrepList28: PrepList27,r28	is prep23=1 & PrepList27 & r28				{ push(r28); }
PrepList28: PrepList27		is prep23=0 & PrepList27				{ }

PrepList29: r29			is prep22=1 & prep2431=0 & prep23=0 & r29		{ push(r29); }
PrepList29: PrepList28,r29	is prep22=1 & PrepList28 & r29				{ push(r29); }
PrepList29: PrepList28		is prep22=0 & PrepList28				{ }

PrepList30: ep			is prep00=1 & prep2431=0 & prep2223=0 & ep		{ push(ep); }
PrepList30: PrepList29,ep	is prep00=1 & PrepList29 & ep				{ push(ep); }
PrepList30: PrepList29		is prep00=0 & PrepList29		 		{ }

PrepList:   { lp }		is prep21=1 & prep2431=0 & prep2223=0 & prep00=0 & lp	{ push(lp); }
PrepList:   { PrepList30,lp }	is prep21=1 & PrepList30 & lp				{ push(lp); }
PrepList:   { PrepList30 }	is prep21=0 & PrepList30				{ }



DispList31: lp			is prep21=1 & lp					{ pop(lp); }
DispList31:			is prep21=0						{ }

DispList30: ep,DispList31	is DispList31 & prep00=1 & ep				{ pop(ep); }
DispList30: DispList31		is DispList31 & prep00=0				{ }

DispList29: r29,DispList30	is DispList30 & prep22=1 & r29				{ pop(r29); }
DispList29: DispList30		is DispList30 & prep22=0				{ }

DispList28: r28,DispList29	is DispList29 & prep23=1 & r28				{ pop(r28); }
DispList28: DispList29		is DispList29 & prep23=0				{ }

DispList27: r27,DispList28	is DispList28 & prep28=1 & r27				{ pop(r27); }
DispList27: DispList28		is DispList28 & prep28=0				{ }

DispList26: r26,DispList27	is DispList27 & prep29=1 & r26				{ pop(r26); }
DispList26: DispList27		is DispList27 & prep29=0				{ }

DispList25: r25,DispList26	is DispList26 & prep30=1 & r25				{ pop(r25); }
DispList25: DispList26		is DispList26 & prep30=0				{ }

DispList24: r24,DispList25	is DispList25 & prep31=1 & r24				{ pop(r24); }
DispList24: DispList25		is DispList25 & prep31=0				{ }

DispList23: r23,DispList24	is DispList24 & prep24=1 & r23				{ pop(r23); }
DispList23: DispList24		is DispList24 & prep24=0				{ }

DispList22: r22,DispList23	is DispList23 & prep25=1 & r22				{ pop(r22); }
DispList22: DispList23		is DispList23 & prep25=0				{ }

DispList21: r21,DispList22	is DispList22 & prep26=1 & r21				{ pop(r21); }
DispList21: DispList22		is DispList22 & prep26=0				{ }

DispList: { r20,DispList21 }	is DispList21 & prep27=1 & r20				{ pop(r20); }
DispList: { DispList21 }	is DispList21 & prep27=0				{ }
