; AltoIIMRT4K.mu
;
; last modified December 1, 1977  1:14 AM
;
; This is the part of the Memory Refresh Task which
; is specific to Alto IIs WITHOUT Extended memory.
;
; Copyright Xerox Corporation 1979
$EngNumber	$20000;		ALTO 2 WITHOUT EXTENDED MEMORY

MRT:	SINK← MOUSE, BUS;	MOUSE DATA IS ANDED WITH 17B
MRTA:	L← T← -2, :TX0;		DISPATCH ON MOUSE CHANGE
TX0:	L← T← R37 AND NOT T;	UPDATE REFRESH ADDRESS
	T← 3+T+1, SH=0;
	L← REFIIMSK ANDT, :DOTIMER;
NOTIMER:R37← L; 		STORE UPDATED REFRESH ADDRESS
TIMERTN:L← REFZERO AND T;
	SH=0;			TEST FOR CLOCK TICK
	:NOCLK;
NOCLK:	MAR← R37;		FIRST FEFRESH CYCLE
	L← CURX;
	T← 2, SH=0;
	MAR← R37 XORT, :DOCUR;  SECOND REFRESH CYCLE
NOCUR:	CURDATA← L, TASK;
MRTLAST:CURDATA← L, :MRT;

DOTIMER:R37← L;			SAVE REFRESH ADDRESS
	MAR←EIALOC;		INTERVAL TIMER/EIA INTERFACE
	L←2 AND T;
	SH=0, L←T←REFZERO.T;	***V3 CHANGE (USED TO BE BIAS)
	CURDATA←L, :SPCHK;	CURDATA←CURRENT TIME WITHOUT CONTROL BITS

SPCHK:	SINK←MD, BUS=0, TASK;	CHECK FOR EIA LINE SPACING
SPIA:	:NOTIMERINT, CLOCKTEMP←L;

NOSPCHK:L←MD;			CHECK FOR TIME=NOW
	MAR←TRAPDISP-1;		CONTAINS TIME AT WHICH INTERRUPT SHOULD HAPPEN
	MTEMP←L;		IF INTERRUPT IS CAUSED,
	L← MD-T;		LINE STATE WILL BE STORED
	SH=0, TASK, L←MTEMP, :SPIA;

TIMERINT:MAR← ITQUAN;		STORE THE THING IN CLOCKTEMP AT ITQUAN
	L← CURDATA;
	R37← L;
	T←NWW;			AND CAUSE AN INTERRUPT ON THE CHANNELS 
	MD←CLOCKTEMP;		SPECIFIED BY ITQUAN+1
	L←MD OR T, TASK;
	NWW←L;

NOTIMERINT: T←R37, :TIMERTN;

;The rest of MRT, starting at the label CLOCK is unchanged