.Title LBreak Detect Keyboard Break Request .Psect Aleda,Gbl,Con .Ident /LVL51 / .Globl LDevice,AlvUpdate .Mcall $Alv51 $Alv51 ;+ ;;********************************************************************** ;; LBreak ;; IBREAK ;; Subroutine to detect whether a break request has been entered ;; at the console. The value returned is compatible with a ;; Fortran Function Subroutine typed as LOGICAL. IBREAK will ;; return a TRUE value (R0 not zero = -1) if a break has been ;; entered. IBREAK will return a FALSE value (R0 = zero) if no ;; break has been entered. ;; ;; Expects calls of the form: JSR PC,IBREAK ;Value returned in R0 ;; ;; or in Fortran: If (LBREAK) Goto ;- LBreak:: IBREAK:: Mov R2,-(SP) ;Stack work register. Clr R0 ;Default to FALSE = No break detected. Mov @LDEVICE,R2 ;Get address of unit 0 control block ; assuming that console input is using ; standard Alvin device convention. Beq IBREXIT ;If it is zero, it does not exist - ; return FALSE = no break detected. Bis #Asynch,(R2) ;Request asynchronous detection of break. Jsr PC,AlvUpdate ;Let AlvUpdate invoke the device activity. Bic #Asynch,(R2) ;Clear out the asynchronous status. Bit #Brkreq,(R2) ;Was a break request detected? Beq IBREXIT ;No, branch - return FALSE, R0 = 0. Com R0 ;Yes, return TRUE, R0 = -1. IBREXIT: Mov (SP)+,R2 ;Restore work register Rts PC ;Return ;;************************************************************************ .end