Google
 

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

;This program works ONLY on Telerays or VT52's.

;It displays, every second :
;the date in the upper left corner of the screen,
;the time in the middle of the screen.
;it can be stopped by typing <ESC>,
;any other character will give a help message.

	a1=	1
	a2=	2
	a3=	3
	wait=	=1000
	look=   =500

chntab:	1,,help
	2,,stop
levtab:	0,,pclev1
	0,,pclev2
pclev1:	block	1
pclev2:	block	1

start:	reset

	move	a1,[0,-1]
	gttyp			;get terminal type,
	caie	a2,.tttel	;test if it is a Teleray 1601
	cain	a2,.ttv52	;or a VT52.
	jrst	right
	hrroi	a1,[asciz/		This program works only on Telerays or VT52's.
	If you are on a Hazeltine, try HCLOCK, CROCK or DCROCK instead./]
	psout			;output help message
	haltf

right:	movei	a1,.fhslf
	move	a2,[levtab,,chntab]
	sir			;set up software interrupt tables.
	eir			;enable software interrupts.
	move	a2,[1b0]
	aic			;activate channel 0.
	move	a2,[1b1]
	aic			;activate channel 1.
	move	a1,[.ticti,,0]
	ati			;assign any typein to channel 0.
	move	a1,[.tices,,1]
	ati			;assign <ESC> to channel 1.

	movei	a1,.priou
	rfmod
	and	a2,[-1,,777477]	;put terminal
	sfmod			;in binary mode.

again:	hrroi	a1,[asciz/jm/];clear screen
	psout			;and put display in wide (40 columns) mode.

	hrroi	a1,[asciz\Y*:R@Y*.RH\];set underline.
	psout
	hrroi	a1,[asciz\Y+:R@Y+.RH\];set underline.
	psout

time:	hrroi	a1,[asciz/H/]	;move cursor home.
	psout

	hrroi	a1,[asciz/	/]	;send a tab.
	psout

	movei	a1,.priou	
	move	a2,[-1]		;output date.
	move	a3,[ot%day+ot%fdy+ot%fmn+ot%4yr+ot%spa+ot%ntm]
	odtim

	hrroi	a1,[asciz\Y+/\];move cursor to the
	psout			;middle of the screen.

	movei	a1,.priou	
	move	a2,[-1]		;output time.
	move	a3,[ot%nda+ot%12h]
	odtim

	hrroi	a1,[asciz/Y7o/];move cursor to the
	psout			;lower right corner of the screen.

	movei	a1,wait		;go to sleep
	disms			;for one second.

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

	;when interrupt occurs (any character typed) :
help:	movei	a1,.priin
	cfibf			;clear terminal input buffer.
  
	hrroi	a1,[asciz/j/]	;clear screen
	psout			

	hrroi	a1,[asciz\Y+ \];move cursor to
	psout			;line 12, column 1.

	hrroi	a1,[asciz/     type <ESC> to kill the clock.../]
	psout			;output help message

	hrroi	a1,[asciz/Y7o/];move cursor to the
	psout			;lower right corner of the screen.

	cis			;clear software interrupt system.

	movei	a1,look		;go to sleep
	disms			;for 1/2 second.

	jrst	again		;and start again...

	;when interrupt occurs (<ESC> typed) :
stop:	movei	a1,.priin
	cfibf			;clear terminal input buffer.
  
	hrroi	a1,[asciz/jl/];clear screen
	psout			;and put display in normal (80 columns) mode.

	haltf			;and halt...

	end	start