Trailing-Edge
-
PDP-10 Archives
-
decuslib20-03
-
decus/20-0078/libsim/ttyche.mac
There is 1 other file named ttyche.mac in the archive. Click here to see a list.
COMMENT * SIMULA specification;
OPTIONS(/E:QUICK,ttycheck);
BOOLEAN PROCEDURE ttycheck(timelimit); REAL timelimit;
COMMENT Returns TRUE if at least one character has been typed on the tty,
FALSE if the time limit (seconds) has elapsed without tty input.
If 0<timelimit<0.001, TTYCHECK does not wait. If timelimit <=0, it waits
indefinitely for a character.
;
!*;! MACRO-10 code !*;!
TITLE ttycheck
ENTRY ttycheck
SUBTTL SIMULA utility, Lars Enderin August 1977
;!*** Copyright 1977 by the Swedish Defence Research Institute. ***
;!*** Copying is allowed. ***
sall
search simmac,simmcr,simrpa
macinit
;! Local definitions ;!
qw==(HB.RWJ+HB.RWT+HB.RWP+HB.RTC+HB.RTL+HB.RPT) ;! Wake bits for HIBER
ttycheck:PROC
SKIPG X1,(XTAC)
SETZB X1,(XTAC)
IF ;! small positive limit
JUMPLE X1,FALSE
CAML [1.0E-3]
GOTO FALSE
THEN ;! Do not wait, check for input directly
GOTO L7
FI
SETO
WAKE
MOVSI X1,qw
HIBER X1, ;! Clear wake conditions
GOTO L2 ;! Error
SKPINC
SKIPA
GOTO L8 ;! There was a character waiting
L (XTAC)
FMPRI (1.0E3) ;! Convert to millisecs
FIXR X1,
HRLI X1,qw
HIBER X1,
L2():! TDZA X1,X1 ;! Error
L7():! SKPINC
TDZA X1,X1 ;! No input waiting
L8():! SETO X1, ;! Found a character
L9():! ST X1,(XTAC)
RETURN
EPROC
LIT
END;