	.TITLE	REST
/
/  9 MAR 72 - MODIFIED FOR WATRAN USE
/  7 JUN 71 - PAUL HENDERSON
/
.SCOM=100
/
	.GLOBL	REST,WAIT,.ARG
/
REST	XX
	JMS*	.ARG
	JMP	.+2
VALUE
	LAW	-1
	DAC	STAY	/SET FLAG TO BE CLEARED BY TIMOUT
	TAD*	VALUE	/FETCH TIME VALUE OF NOTE
	CMA
	DAC	TIME	/INSERT INTO .TIMER MACRO
TIME=.+3
	.TIMER	15,TIMOUT
P1	LAC*	(.SCOM+4  /IF BIT 14 OF .SCOM+4 IS 1,
	AND	(10	/THE MONITOR IS BACKGROUND/FOREGROUND
	SZA
	JMP	.+4
	LAC	(NOP	/IF NOT B/F, P2 & P3 MUST BE NOP'ED
	DAC	P2
	DAC	P3
	LAC	.+2	/DO SETUP ONCE ONLY
	DAC	P1
	JMP*	REST
/
WAIT	XX
	JMP	TESTIT	/CHECK IMMEDIATELY FOR TIMER EXPIRY
P2	SKP
	JMP	TESTIT	/BYPASS .IDLEC IF NOT B/F
	CAL	1000	/ .IDLEC  WHEN B/F
	17
TESTIT	LAC	STAY	/WAIT UNTIL FLAG IS CLEARED
	SZA
	JMP	P2
	JMP*	WAIT
/
STAY
/
TIMOUT	0
	DZM	STAY	/CLEAR FLAG
P3	SKP
	JMP*	TIMOUT
	CAL	TIMOUT	/ .RLXIT TIMOUT  IF B/F
	20
	.END
