.TITLE CDATIA .IDENT /V01/ .ENABLE LC ; ; This module forms part of the suite of Date Routines returning the ; current date in one of the following forms, or converting one form to ; another. ; Form I - Day, Month & Year since 1950 as 3 byte values ; Form A - ASCII DD-MMM-YY ; Form D - Integer*2 days since 1st January 1950 ; Form E - Integer*2 encoded date ; Form W - Weekday Number (0 = Sunday) ; ; Author: V01 30-Jun-80 Phil Stephensen-Payne ; ; Calling Sequence: ; ; This subroutine is called via the standard FORTRAN calling sequence as: ; ; CALL CDATIA (DAY,MONTH,YEAR,DATE [,STATUS]) ; or ; STATUS = CDATIA (DAY,MONTH,YEAR,DATE) ; ; or ; CALL CDATIA from MACRO-11 with ; R5 = 0 ; R1 = DAY ; R2 = MONTH ; R3 = YEAR ; R4 = Address of DATE ; R0 = STATUS on output ; ; Where: ; DAY = Number of day (1-31) ; MONTH = Number of month (1-12) ; YEAR = Year since 1950 (1950=0) ; DATE = ASCII Date in form DD-MMM-YY ; STATUS = Optional error return ; ; Errors returned: ; ; STATUS = 0 if the operation was successful ; = -1 if a parameter error was detected ; = -2 if an invalid input date was specified ; ; External references: ; ; This module calls the subroutines PRMCHK ; ; BUF: .BLKW 3 ; To hold date ; ; CDATIA:: TST R5 ; Called directly from MACRO-11? BEQ 20$ ; If eq yes - omit PRMCHK ; ; Specify number of parameters including error return. R5 not affected. ; MOV #5,R0 ; Check Number of Parameters CALL PRMCHK ; BCC 10$ ; If CC parameters OK - carry on JMP END ; Else error - exit immediately ; 10$: TST (R5)+ ; Ignore Number of parameters MOVB @(R5)+,R1 ; Get the parameters MOVB @(R5)+,R2 ; MOVB @(R5)+,R3 ; MOV (R5)+,R4 ; And address of output ; 20$: CALL CDCHKI ; Check the date is OK BCS ERR ; If CS it wasn't - error MOVB R3,BUF ; Put date in buffer MOVB R2,BUF+2 ; MOVB R1,BUF+4 ; MOV R4,R0 ; Get output address MOVB #' ,8.(R0) ; Initialise ninth byte, just in case MOV #BUF,R1 ; Get address of date CALL $DAT ; Convert it CLR R0 ; END: RETURN ; ERR: MOV #-2,R0 ; Invalid date RETURN ; .END