.TITLE CTIMAI .IDENT /V01/ .ENABLE LC .MCALL GTIM$S ; ; This module forms part of the suite of Time Routines returning the ; current date in one of the following forms, or converting one form to ; another. ; Form I - Hours, Minutes, Seconds & Tenths of a Second ; Form A - ASCII HH:MM:SS.S ; Form D - Integer*4 seconds since midnight ; ; Author: V01 15-Jul-80 Phil Stephensen-Payne ; ; Calling Sequence: ; ; This subroutine is called via the standard FORTRAN calling sequence as: ; ; CALL CTIMAI (ZTIME,TIMTBL [,STATUS]) ; or ; STATUS = CTIMAI (ZTIME,TIMTBL) ; ; or ; CALL CTIMAI from MACRO-11 with ; R5 = 0 ; R1 = Address of ZTIME for output ; R2 = Address of TIMTBL ; R0 = STATUS on output ; ; Where: ; ZDATE = 10-byte array for ASCII Time ; TIMTBL = 4-byte array for Hour, Minute, Second etc. ; STATUS = Optional error return ; ; Errors returned: ; ; STATUS = 0 if the operation was successful ; = -1 if a parameter error was detected ; = -2 if the time was invalid ; ; External references: ; ; This module calls the subroutines PRMCHK ; ; CTIMAI:: TST R5 ; Called directly from MACRO-11? BEQ 10$ ; If eq yes - omit PRMCHK ; ; Specify number of parameters including error return. R5 not affected. ; MOV #3,R0 ; Check Number of Parameters CALL PRMCHK ; BCS END ; If CS parameter error - exit at once TST (R5)+ ; Ignore number of parameters MOV (R5)+,R1 ; Get Address of Input MOV (R5)+,R2 ; Get Address for Output ; 10$: MOV R1,R0 ; Propagate address MOV R2,R3 ; Save the other one MOV #4,R2 ; Four bytes to initialise ADD R2,R3 ; Set to the end ; 20$: CLRB -(R3) ; Initialise the buffer SOB R2,20$ ; MOV R3,R4 ; Save address of start of buffer CALL $CDTB ; Get the hours MOVB R1,(R3)+ ; Store them CMPB R2,#': ; Normal termination? BNE 30$ ; If NE no - we've finished CALL $CDTB ; Get the minutes MOVB R1,(R3)+ ; Store them CMPB R2,#': ; Normal termination? BNE 30$ ; If NE no - we've finished CALL $CDTB ; Get the seconds MOVB R1,(R3)+ ; Store them CMPB R2,#'. ; Normal termination? BNE 30$ ; If NE no - we've finished CALL $CDTB ; Get the tenths MOVB R1,(R3)+ ; Store them ; 30$: MOV R4,R1 ; Get address of new time CALL CTCHKI ; Check the time BCS ERR ; If CS error - log it CLR R0 ; Show success ; END: RETURN ; ERR: MOV #-2,R0 ; Invalid time RETURN ; ; ERR2: MOV #-1,R0 ; Invalid parameters RETURN ; .END