TITLE[FTEST-MODEL1.MC];*MODIFIED December 21, 1978

RMREGION[REGS];

RV[FIRSTADDR, 0];
RV[WAIT, 100];
RV[SECONDADDR, 2000];
RV[FIRSTPATRN, 0];
RV[SECONDPATRN, 0];
RV[XORPAT, 177777];
RV[FIRSTMCR, 601];
RV[SECONDMCR, 77601];
RV[RSCR, 0];
RV[RSCR2, 0];

*DEFINE NOOP
m[
noop, ilc[(branch[.+1])]]
TOPLEVEL;

BEGIN:
RBASE ← RBASE[REGS];

CALL[SETMCR], T ← FIRSTMCR;
T ← FIRSTPATRN;
CALL[LOADMUNCH], RSCR ← FIRSTADDR;
CALL[SETMCR], T ← SECONDMCR;
noop;

FETCH1:
FETCH← SECONDADDR; *throw out the first munch

CALL[LONGWAIT], T ← WAIT;
CALL[SETMCR], T ← FIRSTMCR;
T ← SECONDPATRN;
CALL[LOADMUNCH], RSCR← SECONDADDR;
CALL[SETMCR], T ← SECONDMCR;
noop;

FETCH2:
FETCH← FIRSTADDR; *throw out second, get back first

CALL[LONGWAIT], T ← WAIT;

noop;
noop;
noop;
noop;

BRANCH[BEGIN];

SUBROUTINE;

SETMCR:
noop;
noop;
noop;
noop;
noop;
noop;
noop;
noop;
noop;
noop;
LOADMCR[T,T];
noop;
RETURN;

LOADMUNCH:

noop;

LM1:
noop;
RSCR ← (STORE ← RSCR) + 1, DBUF ← T;
T ← (T) # (XORPAT);
PD ← (RSCR) AND (17C);
GOTO[LM1, ALU #0];
noop;
RETURN;

LONGWAIT:

CNT ← T;
BRANCH[., CNT#0&-1];
RETURN;