.TITLE CDCHKI .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 14-Jul-80 Phil Stephensen-Payne ; ; Calling Sequence: ; ; This module is only called from MACRO-11 to check a type-I date ; ; CALL CDCHKI from MACRO-11 with ; R5 = 0 ; R1 = DAY ; R2 = MONTH ; R3 = YEAR ; R0 = Leap Year Status on output (0 => Leap Year) ; ; Where: ; DAY = Number of day (1-31) ; MONTH = Number of month (1-12) ; YEAR = Year since 1950 (1950=0) ; ; Errors returned: ; ; C-bit Clear if the date was valid ; Set if an invalid input date was specified ; ; External references: ; ; None ; ; DAY1: .BYTE 31.,28.,31.,30.,31.,30.,31.,31.,30.,31.,30.,31. ; ; CDCHKI:: CMP R3,#100. ; Outside range? BHIS ERR ; If HI yes - error TST R2 ; Month legal? BEQ ERR ; No - error CMP R2,#12. ; Sure? BHI ERR ; If HI no - error MOV R3,R0 ; Get Leap Year Value BIC #177774,R0 ; BNE 10$ ; If NE not a leap year CMP R2,#2 ; February? BNE 10$ ; If NE no - do ordinary check CMP R1,#29. ; 29th? BEQ 20$ ; If EQ Yes - Date OK ; 10$: TST R1 ; Day zero? BEQ ERR ; If EQ yes - error CMPB R1,DAY1-1(R2) ; No - legal? BHI ERR ; If HI no - error ; 20$: CLC ; Date OK RETURN ; ERR: SEC ; Date Bad RETURN ; .END