.TITLE CDATXX .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 module is called from various of the subroutines to dispatch ; various other subroutines and get/return parameters. ; ; Errors returned: ; ; R0 = 0 if the operation was successful ; = -1 if a parameter error was detected ; ; External references: ; ; This module calls the subroutines PRMCHK ; ; BUFF: .BLKB 10. ; Buffer for ASCII date ADDR: .WORD ; Word to hold address of next address ; ; ; Dispatcher - called with 4 subroutine addresses pointed to by SP as follows: ; ; (SP) - Get parameters from call ; (SP)+2 - First conversion ; (SP)+4 - Second conversion ; (SP)+6 - Store parameters ; DISP:: MOV #3,R0 ; Most require 3 parameters ; DISP1:: TST R5 ; Called from MACRO-11? BEQ 10$ ; If eq yes - omit first call MOV (SP)+,ADDR ; Store the magic address and clear stack CALL PRMCHK ; Check the number of parameters BCS END ; If error give up at once TST (R5)+ ; Remove number of parameters MOV ADDR,-(SP) ; Save the address on the stack MOV @(SP),R0 ; Get address of routine CALL (R0) ; Get the parameters ; 10$: MOV R5,-(SP) ; Save updated R5 CLR R5 ; Next two are MACRO-11 calls ADD #2,2(SP) ; Update address MOV @2(SP),R0 ; Get address of routine CALL (R0) ; and do first conversion TST R0 ; OK? BNE 30$ ; No - give up now MOV #BUFF,R4 ; Put in Buffer address just in case ADD #2,2(SP) ; Yes - get next address MOV @2(SP),R0 ; Get address of routine CALL (R0) ; and go again TST R0 ; OK? BNE 30$ ; No - give up ADD #2,2(SP) ; Yes - get last address MOV @2(SP),R0 ; Get address of routine MOV (SP),R5 ; Get R5 back BEQ 20$ ; If EQ called from MACRO - exit at once CALL (R0) ; Store parameters ; 20$: CLR R0 ; Clear error return ; 30$: TST (SP)+ ; Clear up the stack TST (SP)+ ; END: RETURN ; Back to original caller ; ; GETI - Get 3-parameter form of date ; GETI:: MOVB @(R5)+,R1 ; Get Day MOVB @(R5)+,R2 ; Get Month MOVB @(R5)+,R3 ; Get Year RETURN ; ; GETD - Get Day Number ; GETE - Get Encoded Date ; GETD:: GETE:: BIT #1,(R5) ; Word-aligned data? BNE 10$ ; If NE no - error MOV @(R5)+,R1 ; Yes - get it RETURN ; Return ; 10$: MOV #-1,R0 ; No - parameter error TST (SP)+ ; Throw away return address BR END ; And jump straight to end ; ; GETA - Get ASCII Date ; GETA:: MOV (R5)+,R1 ; Get the address RETURN ; ; PUTD - Put Day Number ; PUTE - Put Encoded Date ; PUTD:: PUTE:: BIT #1,(R5) ; Word-aligned data? BNE 10$ ; If NE no - error MOV R1,@(R5)+ ; Yes - stuff it in RETURN ; and return ; 10$: MOV #-1,R0 ; parameter error RETURN ; ; ; PUTW - Put Weekday Number ; PUTW:: MOVB R1,@(R5)+ ; Stuff it in RETURN ; and head back ; ; PUTA - Put ASCII date ; PUTA:: MOV (R5)+,R1 ; Get address of output MOV #BUFF,R2 ; and input MOV #9.,R3 ; and length ; 10$: MOVB (R2)+,(R1)+ ; Copy ASCII date over SOB R3,10$ ; Like so RETURN .END