Google
 

Trailing-Edge - PDP-10 Archives - BB-FI82B-DD_1989 - 35,1414/sleepr.mac
There are 2 other files named sleepr.mac in the archive. Click here to see a list.
	TITLE SLEEPR
	SEARCH UUOSYM

;AC DEFINITIONS

F=0	;FLAG REGISTER
T1=1	;
T2=4	;
T3=6
CNT=10
FAC=12
DIG=14

CNTBUF: BLOCK ^D10


STRT:	SETZB CNT,T1
	SETZB T2,T3
	SETZB FAC,DIG

CNTINI:	SETZM 0,CNTBUF(CNT)
	ADDI CNT,1
	CAIGE CNT,^D9
	JRST CNTINI

CNTINX:	SETZM 0,CNT
	OUTSTR	[ASCIZ/Minutes to sleep: /]

GETCNT:	INCHRW	t2
	ANDI T2,777
	CAIN T2,15	;CR
	JRST GOTCNT
	CAIGE T2,"0"
	JRST INERR
	CAILE T2,"9"
	JRST INERR
	MOVEM T2,CNTBUF(CNT)
	ADDI CNT,1
	CAILE CNT,^D5
	JRST TOOBIG
	JRST GETCNT

GOTCNT:	JUMPE CNT,WAKE
	SUBI CNT,1
	SETZM 0,T2
	MOVEI FAC,1
GETMIN:	MOVE DIG,CNTBUF(CNT)
	SUBI DIG,60
	IMUL DIG,FAC
	ADD T2,DIG
	SOJL CNT,GOTMIN
	IMULI FAC,^D10
	JRST GETMIN

GOTMIN:	IMULI T2,^D60	;SECONDS
	MOVEI T3,0
	HLR T3,T2	;STORE EXCESS OF 18 BIT CNT
	TRNN T2,0	;IN CASE 0 MINUTES PLUG IN 1 SEC
	ADDI T2,1

HIBERN:	MOVSI	T1,(HB.SEC!HB.RWJ)	;SET UP HIBER BITS
	HRR T1,T2
	HIBER	T1,		;DO THE HIBER
	  JRST	HBRERR		;OH WELL

HIBNXT: SOJL T3,WAKE
	MOVSI	T1,(HB.SEC!HB.RWJ)	;SET UP HIBER BITS
	HRRI T1,777777
	HIBER	T1,		;DO THE HIBER
	  JRST	HBRERR		;OH WELL
	JRST HIBNXT

WAKE:	EXIT

TOOBIG::	OUTSTR	[ASCIZ/
% Must be five digits or less
/]
	jrst strt
INERR::	OUTSTR	[ASCIZ/
%Must be numeric vaule (minutes)
/]
	jrst strt

HBRERR:	OUTSTR	[ASCIZ/
? Hibernation error!!!
/]

	END	STRT


;HB.SWP==1B0	;ALLOW IMMEDIATE SWAP OUT
;HB.SEC==1B1	;TIME IS IN SECONDS
;HB.RWJ==1B15	;THIS JOB
;	OPDEF	INCHRW	[TTCALL 0,]	;INPUT CHAR AND WAIT
;	OPDEF	OUTSTR	[TTCALL 3,]	;OUTPUT STRING