TITLE[D0Test1];	*Test of D0 microassembler

RV[RT0];
RV[RT1,3];
RV[RT2,3,33311];

MP[FOO,1]; MP[GARB,100000];
RV[RT3,,FOO,GARB];

START:	T←0C;
	T←1C;
	T←177C;
	T←200C;
	T←377C;
	T←400C;
	T←177400C;
	T←(RT1)+(177600C);
	RT0←T;
	T←RT0;
	BRANCH[START,R ODD], A←RT0;
	GOTO[.+2,R EVEN];
LOOP:	DBLBRANCH[G0,G1,ALU=0];
	DBLGOTO[G0,G1,ALU<0];
	DBLGOTO[G0,G1,CARRY];
	DBLBRANCH[G0,G1,IOATTEN];
	DBLBRANCH[G0,G1,R<0];
	DBLBRANCH[G0,G1,R ODD];
	DBLBRANCH[G0,G1,QUADOVF];
	DBLBRANCH[G0,G1,MPCARRY];
	DBLBRANCH[G0,G1,PSPENDING];
G0:	RETURN;
G1:	CORETURN;

LOOP1:	STACK←T;
	STACK&-1←T;
	STACK&+1←T;
	STACK&-2←T;
	STACK&+2←T;
	STACK&-3←T;
	T←STACK;
	T←STACK&-1;
	T←STACK&+1;
	T←STACK&-2;
	T←STACK&+2;
	T←STACK&-3;

LOOP2:	T←PCF[RT3];
	T←SB[RT3];
	T←DB[RT3];

LOOP3:	DATA[(LH[33] RH[44] AT[33])];
	DATA[(LH[22] RH[33] AT[34])];

LOOP4:	SET[J,0];
	REPEAT[11,ILC[(SET[J,ADD[J,1]], T←LDF[RT1,J,10])]];
	SET[J,0];
	REPEAT[12,ILC[(SET[J,ADD[J,1]], T←LDF[RT1,J,7])]];
	SET[J,0];
	REPEAT[13,ILC[(SET[J,ADD[J,1]], T←LDF[RT1,J,6])]];
	SET[J,0];
	REPEAT[14,ILC[(SET[J,ADD[J,1]], T←LDF[RT1,J,5])]];
	SET[J,0];
	REPEAT[15,ILC[(SET[J,ADD[J,1]], T←LDF[RT1,J,4])]];
	SET[J,0];
	REPEAT[16,ILC[(SET[J,ADD[J,1]], T←LDF[RT1,J,3])]];
	SET[J,0];
	REPEAT[17,ILC[(SET[J,ADD[J,1]], T←LDF[RT1,J,2])]];
	SET[J,0];
	REPEAT[20,ILC[(SET[J,ADD[J,1]], T←LDF[RT1,J,1])]];

LOOP5:	T←LDF[RT1,0,11];
	T←LDF[RT1,0,12];
	T←LDF[RT1,0,13];
	T←LDF[RT1,0,14];
	T←LDF[RT1,0,15];
	T←LDF[RT1,0,16];
	T←LDF[RT1,0,17];

LOOP6:	SET[J,0];
	REPEAT[11,ILC[(SET[J,ADD[J,1]], T←DISPATCH[RT1,J,10])]];
	SET[J,0];
	REPEAT[12,ILC[(SET[J,ADD[J,1]], T←DISPATCH[RT1,J,7])]];
	SET[J,0];
	REPEAT[13,ILC[(SET[J,ADD[J,1]], T←DISPATCH[RT1,J,6])]];
	SET[J,0];
	REPEAT[14,ILC[(SET[J,ADD[J,1]], T←DISPATCH[RT1,J,5])]];
	SET[J,0];
	REPEAT[15,ILC[(SET[J,ADD[J,1]], T←DISPATCH[RT1,J,4])]];
	SET[J,0];
	REPEAT[16,ILC[(SET[J,ADD[J,1]], T←DISPATCH[RT1,J,3])]];
	SET[J,0];
	REPEAT[17,ILC[(SET[J,ADD[J,1]], T←DISPATCH[RT1,J,2])]];
	SET[J,0];
	REPEAT[20,ILC[(SET[J,ADD[J,1]], T←DISPATCH[RT1,J,1])]];

LOOP7:	SET[J,1];
	REPEAT[17,ILC[(SET[J,ADD[J,1]],RT1←RSH[RT1,J])]];
LOOP8:	SET[J,1];
	REPEAT[17,ILC[(SET[J,ADD[J,1]],RT1←LSH[RT1,J])]];
LOOP9:	SET[J,1];
	REPEAT[17,ILC[(SET[J,ADD[J,1]],RT1←RCY[RT1,J])]];
LOOP10:	SET[J,1];
	REPEAT[17,ILC[(SET[J,ADD[J,1]],RT1←LCY[RT1,J])]];
LOOP11:	T←RHMASK[RT1];
	T←LHMASK[RT1];

LOOP12:	STKP←RT1;
	CYCLECONTROL←RT1;
	SB←RT1;
	DB←RT1;
	-NBR←RT1;
	PCF←RT1;
	SALUF←T;
	CSIN←RT1;
	DISMISSFAULT;
	CTD←T;
LOOP13:	TPC←RT1;
	WRITELOWCS;
	WRITEHIGHCS;
	READCS;
	LOADCTD&TPC[T,RT1];
	RESETPE;
	INCMPANEL;
	CLEARMPANEL;
	GENSRCLOCK;
	RESETTIMER;
	BOOT;
	SETFAULT;
LOOP14:	OUTPUT[RT1,T];
	A←BBFA[RT1];
	A←BBFB[RT1];
	A←WFA[RT1];
	A←WFB[RT1];
	A←RF[RT1];
	A←NEXTINST[RT0];
	A←NEXTOP[RT0];
	A←NEXTDATA[RT0];
	TASK;
	IORESET;
	TASKRESET;
	FREEZEBC;

LOOP15:	T←RT1;
	T←LSH[RT1,3];
	T←T;
	T←LOADCTD&TPC[T,RT1];
	T←(RT1) AND T;
	T←(RT1) OR T;
	T←(RT1) XOR T;
	T←(RT1) # T;
	T←(RT1) AND NOT T;
	T←(RT1) OR NOT T;
	T←(RT1) XNOR T;
	T←(STACK) = T;
	T←(RT1)+1;
	T←(RT1)+T;
	T←(RT1)+T, USEALUCARRY;
	T←(RT1)+T+1;
	T←(RT1)-T;
	T←(RT1)-T-1;
	T←(RT1)-T-1, USEALUCARRY;
	T←SALUFOP[RT1,T];

LOOP16:	PFETCH1[RT1,RT0];
	PFETCH2[RT1,RT0];
	PFETCH4[RT1,RT0];
	PSTORE1[RT1,RT0];
	PSTORE2[RT1,RT0];
	PSTORE4[RT1,RT0];
	WRITEMAP[RT1,RT0];
	READMAP[RT1,RT0];

LOOP17:	PFETCH1[RT1,RT0,0];
	PFETCH2[RT1,RT0,17];
	PFETCH4[RT1,RT0,1];
	PSTORE1[RT1,RT0,2];
	PSTORE2[RT1,RT0,10];
	PSTORE4[RT1,RT0,17];
	WRITEMAP[RT1,RT0,0];
	READMAP[RT1,RT0,17];

LOOP18:	IOFETCH4[RT1,0];
	IOFETCH20[RT1,17];
	IOSTORE4[RT1,20];
	IOSTORE20[RT1,377];
	IOFETCH4[RT1,0,0];
	IOFETCH20[RT1,17,17];
	IOSTORE4[RT1,200,0];
	IOSTORE20[RT1,377,17];

LOOP19:	INPUT[RT1];
	INPUT[RT1,4];

END;