Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_3_19910112 - utilities/timer.fai
There are no other files named timer.fai in the archive.
	title timer
	search monsym

;This program asks the user for a time.
;It then runs in background and outputs a message to the terminal
;each time that time has elapsed.

	a1=	1
	a2=	2
	a3=	3
	a4=	4
	a5=	5
	mil=	=1000

time:	block	1
delay:	block	1

start:	reset

when:	hrroi	a1,[asciz/
How often do you want to be waken up?(m or h:m or h:m:s): /]
	psout			;ask for a time
	move	a1,[.priin]	;IDTNC gives it back
	move	a2,[it%nda]	;in seconds in 
	idtnc			;the right half of a4.
	erjmp	error	   ;error if bad input format.

	hlli	a4,		;keep only the time in a4.
	jumpe	a4,error   ;don't accept a time=0.
	movem	a4,time		;store time in sec. in time.
	imuli	a4,mil
	movem	a4,delay	;store time in millisec. in delay.

	hrroi	a1,[asciz/OK, I will wake you up every /]
	psout			;output message,
	move	a1,[.priou]
	setz	a2,
	setz	a3,
	move	a4,time
	move	a5,[ot%nda+ot%scl]
	odtnc			;confirming the time.

	hrroi	a1,[asciz/c,b
/]
	rscan			;place the command "cONTINUE,bACKGROUND"
	haltf			;in the job's rescan buffer before halting
	move	a1,[.rsini]	;so that the EXEC will immediately
	rscan			;continue us in background.
	haltf

	haltf			;stop our normal foreground life.

sleep:	move	a1,delay	;when continued, go to sleep
	disms			;for the specified time.

	hrroi	a1,[asciz/
		[ /]
 	psout			;when waken up, output message to the terminal

	move	a1,[.priou]	;specifying
	setz	a2,
	setz	a3,
	move	a4,time		;the elapsed
	move	a5,[ot%nda+ot%scl]
	odtnc			;time,

	hrroi	a1,[asciz/ have passed, it is now /]
	psout

	move	a1,[.priou]	;and
	move	a2,[-1]		;the current
	move	a3,[ot%nda+ot%scl]
	odtim			;time.

	hrroi	a1,[asciz/ ]
/]
	psout

	jrst	sleep		;and start again (forever)...

	haltf

error:	hrroi	a1,[asciz/
? invalid time format/]
	psout		;error routine: output error message
	jrst	when	;and go to prompt for time again.
	end	start