.TITLE TIME_PROMPT - Set DCL prompt to current time .IDENT /X01-00/ ;++ ; Copyright © 1990 James F. Duff ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 1, or (at your option) ; any later version. ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ; ; The author can be contacted on the Internet at DUFF@DECUS.COM.AU. ;-- ;++ ; ; FACILITY: ; ; Silly buggers ; ; ABSTRACT: ; ; This program loads code into P1 space that sets the DCL ; prompt to the current time, and executes it as an AST. The code ; in P1 space resets the AST to execute every minute. ; ; ENVIRONMENT: ; ; User, executive and kernal modes ; ; AUTHOR: ; ; James F. Duff, 31-Oct-1990 ; ; MODIFIED BY: ; ; X01-00 Jim Duff 31-Oct-1990 ; Original version of module ; ;-- .LINK "SYS$SYSTEM:SYS.STB"/SELECTIVE_SEARCH .PSECT DATA ARGS: .BLKL 1 .PSECT CODE NOWRT,EXE,SHR .ENTRY TP,^M<> $CMKRNL_S - ; Get to kernal to load our code ROUTIN=LOAD_EXEC BLBC R0,10$ ; Error ? $CMEXEC_S - ; Declare an executive mode ast ROUTIN=FIRST_TIME BLBC R0,10$ ; Error ? MOVZWL #SS$_NORMAL,R0 ; Indicate normal completion 10$: RET ; Return to caller .ENTRY LOAD_EXEC,^M TSTL CTL$GL_SITESPEC ; Test site specific longword. ; Used to hold addr of code if ; it has already been loaded BEQL 10$ ; Branch if zero MOVL CTL$GL_SITESPEC,ARGS ; Just get addr of code $CANTIM_S - ; Cancel outstanding timer REQIDT=#1777 ; using this timer id BRB 20$ ; Branch to exit 10$: MOVL #TP_EXEC_LEN,R1 ; Come here to load code for ; 1st time. Length of code to R1 JSB G^EXE$ALOP1IMAG ; Get a block of P1 space MOVL R2,ARGS ; Addr of block to args MOVL R2,CTL$GL_SITESPEC ; Addr to site spec longword MOVAB TP_EXEC,R6 ; Addr of our code to R6 MOVC3 #TP_EXEC_LEN,(R6),(R2) ; Copy our code to P1 space 20$: MOVZWL #SS$_NORMAL,R0 ; Indicate success RET ; Return to user mode .ENTRY FIRST_TIME,^M<> MOVL ARGS,R2 ; Addr of our code to R2 $DCLAST_S - ; Execute our code as an AST ASTADR=(R2) MOVZWL #SS$_NORMAL,R0 ; Indicate normal completion RET ; Return to user mode .PSECT LD$CODE NOWRT,EXE,REL,PIC,LCL .ENTRY TP_EXEC,^M TIME = 0 ATIME_D = 8 FAOSTR_D = 16 PROMPT_D = 24 ATIME = 32 FAOSTR = 36 PROMPT = 46 SUBL #60,SP ; Reserve space on stack MOVL SP,R7 ; Point to stack with R7 MOVL #7,PROMPT_D(R7) ; Length of prompt to desc MOVAB PROMPT(R7),PROMPT_D+4(R7) ; Address of string to desc MOVL #10,FAOSTR_D(R7) ; Length of CTRSTR to desc MOVAB FAOSTR(R7),FAOSTR_D+4(R7) ; Addr fix MOVL #^A/!5/,FAOSTR+4(R7) ; Next bit MOVW #^A/» /,FAOSTR+8(R7) ; Last bit $FAO_S CTRSTR=FAOSTR_D(R7), - ; Format the prompt OUTLEN=PROMPT_D(R7), - OUTBUF=PROMPT_D(R7), - P1=#0 ; Current time MOVAL @#CTL$AG_CLIDATA,R6 ; CLI data area addr to R6 MOVC3 #7,PROMPT(R7),628(R6) ; Move our prompt to CLI area MOVB #10,624(R6) ; Indicate prompt length MOVL #4,ATIME_D(R7) ; Length of delta time to desc MOVAB ATIME(R7),ATIME_D+4(R7) ; Addr fix MOVL #^A/0 :1/,ATIME(R7) ; 1 minute delta time $BINTIM_S - ; Convert to binary time TIMBUF=ATIME_D(R7), - TIMADR=TIME(R7) MOVAB TP_EXEC,R6 ; Point to our code $SETIMR_S - ; Set a 1 minute timer DAYTIM=TIME(R7), - ASTADR=(R6), - ; To execute us again REQIDT=#1777 ; Use a timer id so we can ; cancel it if they execute this ; again. RET ; Return to caller TP_EXEC_LEN = .-TP_EXEC .END TP