.enabl lc .title watchdog .ident /01.00/ ; Program for Codar Technology's C-Timer Q-Bus board ; This program, when run under RT-11, will read the Codar ; board's calander and clock registers and update RT-11's ; date and time, and will also reset the watchdog timer. ; When run under TSX-Plus, the program will first attempt to ; map to the real I/O page, which will require operator ; privleges. Once the program is mapped to I/O page it does ; the same as it did in RT-11, except it never exits. It is ; intended to be run on a detached line so it can update the ; date/time of TSX-Plus, and reset the watchdog timer. This ; routine is set to sleep for 5 minutes and assumes the Codar ; watchdog has been set to a cycle time greater than 5 minutes. ; Program By Chuck Sadoian ; Based on routines supplied by Codar. ; Program requires CTSUBS.OBJ, for the RTIMW routine. Link as ; follows: ; LINK WATCH,CTSUBS ; Note: JTIME comes from SYSLIB.OBJ (RT-11) .mcall .exit,.sdttm,.print,.twait,.serr,.herr .globl jtime,rtimw start: .serr ; catch EMT error mov #tsxln,r0 ; check for TSX-Plus emt 375 ; do it bcs 1$ ; branch if RT-11 com tsxflg ; indicate TSX-Plus mov #map,r0 ; now try to map emt 375 bcc 1$ ; branch if success .print #errmsg ; no I/O page access! .exit 1$: .herr ; back to hard errors begin: mov #args,r5 ; R5 --> argument list jsr pc,rtimw ; Call RTIME routine w/ wait mov (r5)+,r2 ; Get year since 1972 in <04:00>, sub #72.,r2 ; mov (r5)+,r0 ; plus month of year in <13:10>, mov #2000,r1 ; jsr pc,$mul ; bis r1,r2 ; mov (r5)+,r0 ; plus day of month in <09:05> mov #40,r1 ; jsr pc,$mul ; bis r1,r2 ; mov r2,rtdtm ; Date is 1st word in RT list mov #jhr,r0 ; mov (r5)+,(r0)+ ; Copy hours for CALL JTIME mov (r5)+,(r0)+ ; Copy minutes mov (r5)+,(r0)+ ; Copy seconds clr (r0)+ ; No ticks for now mov #jargs,r5 ; jsr pc,jtime ; Convert to RT-style 32-bit integer .sdttm #area,#rtdtm ; mov #177340,r0 ; get address of watchdog timer mov (r0),r0 ; read it (thus resetting it) tst tsxflg ; TSX-Plus? bne 2$ ; yes, loop forever .exit ; else for RT-11 we exit 2$: .twait #tarea,#time ; now sleep br begin ; yes, loop forever $mul: mov r0,-(sp) ; Save the multiplicand mov #17.,-(sp) ; Load number of bit shifts clr r0 ; Init the product 5$: ror r0 ; Rotate product ror r1 ; Rotate multiplier bcc 10$ ; Add if bit is set add 2(sp),r0 ; 10$: dec (sp) ; Count bits bgt 5$ ; cmp (sp)+,(sp)+ ; Clean stack rts pc map: .byte 5,140 ; map to I/O page tsxflg: .word 0 ; used to indicate if running under TSX+ tsxln: .byte 0,110 ; arg to get tsx-plus line number errmsg: .asciz <7>/Real-time support not sysgened into TSX-Plus or user not privileged/ .even tarea: .blkw 2 time: .word 0,3600.*5. ; sleep for 5 minutes area: .blkw 2 args: .byte 1,0 .word datime datime: .blkw 9. jargs: .byte 5,0 .word jhr .word jmi .word jse .word jti .word rtdtm+2 jhr: .blkw 1 jmi: .blkw 1 jse: .blkw 1 jti: .blkw 1 rtdtm: .blkw 3 .end start