
                                                                20-Nov-1990 18:08:42	VAX FORTRAN V5.4-79                 Page   1
                                                                14-Jul-1988 19:36:57	LIB4:[ADDASYS.SOURCE]ADDA_CLOCK.FOR;15      

0001    	PROGRAM ADDA_CLOCK
0002    C
0003    C **************************************************************************
0004    C **  PROGRAM AUTHOR:       WILLIAM BAKER
0005    C 
0006    C **  PROGRAM DESCRIPTION:  PROGRAM FOR CONTROL OF THE KWV11 REAL TIME CLOCK.
0007    C **                        PROGRAM CONTROLS WHEN CLOCK IS RUNNING.
0008    C
0009    C **  ADDA_CLOCK.FOR
0010    C     -----------------------
0011    C
0012    C **  DECLARE VARIABLES NEEDED LOCALLY BY PROGRAM.
0013    C
0014    	INTEGER*4	STATUS_C, CEFN, STATUS_H, TIMER_EF
0015    	LOGICAL		CLK_SET
0016    C
0017    C **  INCLUDE PARAMETERS TO RUN CLOCK.
0018    C
0019    	INCLUDE 'SYS$SHARE:LIOSET.FOR'
0708    C
0709    C **  INCLUDE THE DEFINITION FOR THE DATABASE VARIABLES
0710    C
0711    	INCLUDE 'LIB4:[ADDASYS.SOURCE]ADDA_DATA_SHR.INC/LIST'
0712  1 C
0713  1 C **************************************************************************
0714  1 C **  PROGRAM AUTHOR:       WILLIAM BAKER
0715  1 C 
0716  1 C **  PROGRAM DESCRIPTION:  DEFINES AN AREA OF SHARED COMMON FOR USE BY
0717  1 C **                        A/D AND D/A DATA ACQUISITION PROGRAMS.
0718  1 C
0719  1 C **  ADDA_SHR.FOR DICTIONARY
0720  1 C     -----------------------
0721  1 C
0722  1 C **  DEFINE THE STRUCTURE OF THE A/D CHANNEL LIST INFORMATION RECORD.
0723  1 C
0724  1 	STRUCTURE /AD_LIST/
0725  1 		UNION
0726  1 			MAP
0727  1 				INTEGER*4	CHAN_NUM
0728  1 				INTEGER*4	CHAN_GAIN
0729  1 				CHARACTER*72	CHAN_DSCR
0730  1 			END MAP
0731  1 		END UNION
0732  1 	END STRUCTURE
0733  1 C
0734  1 C **  DEFINE THE STRUCTURE OF THE D/A CHANNEL LIST INFORMATION RECORD.
0735  1 C
0736  1 	STRUCTURE /DA_LIST/
0737  1 		UNION
0738  1 			MAP
0739  1 				INTEGER*4	CHAN_NUM
0740  1 				CHARACTER*72	CHAN_DSCR
0741  1 				INTEGER*4	CHAN_DEVICE
0742  1 				INTEGER*4	CHAN_FROM
0743  1 			END MAP
0744  1 		END UNION
0745  1 	END STRUCTURE

ADDA_CLOCK                                                      20-Nov-1990 18:08:42	VAX FORTRAN V5.4-79                 Page   2
                                                                14-Jul-1988 19:36:57	LIB4:[ADDASYS.SOURCE]ADDA_CLOCK.FOR;15      

0746  1 C
0747  1 C **  DECLARE THE A/D CHANNEL RECORD ARRAYS.
0748  1 C
0749  1 	RECORD /AD_LIST/ AD_CHNL(2,16)
0750  1 C
0751  1 C **  DECLARE THE D/A CHANNEL RECORD ARRAYS.
0752  1 C
0753  1 	RECORD /DA_LIST/ DA_CHNL(2,2)
0754  1 C
0755  1 C **  DECLARE PARAMETERS FOR EVENT FLAG STATUS.
0756  1 C
0757  1 	PARAMETER SS$_WASCLR = '00000001'X
0758  1 	PARAMETER SS$_WASSET = '00000009'X
0759  1 C
0760  1 C **  DELCARE LOGICALS USED FOR DETERMINING STATUS OF ACTIVITY.
0761  1 C
0762  1 	LOGICAL		START_STOP1, USE_LOGICAL1
0763  1 	LOGICAL		USE_LOGICAL8
0764  1 	LOGICAL		USE_LOGICAL9
0765  1 	LOGICAL		START_STOP2, USE_LOGICAL2, CLK_READY
0766  1 C
0767  1 C **  DECLARE SYSTEM SERVICE INTEGER FUNCTIONS.
0768  1 C
0769  1 	INTEGER*4	SYS$CREMBX, SYS$DELMBX, SYS$DASSGN
0770  1 	INTEGER*4	SYS$WAITFR, SYS$SETIMR, SYS$BINTIM, SYS$DLCEFC
0771  1 	INTEGER*4	SYS$CLREF,  SYS$ASCEFC, SYS$DACEFC, SYS$SETEF
0772  1 C
0773  1 C **  DECLARE ARRAYS WHICH CONTAIN COUNTS OF NUMBER OF CHANNELS IN USE.
0774  1 C
0775  1 	INTEGER*4	AD_NUMBR(2), DA_NUMBR(2)
0776  1 C
0777  1 C **  DECLARE THE CLOCK RATE FOR THIS TEST.
0778  1 C
0779  1 	REAL*4		CLK_RATE
0780  1 C
0781  1 C **  DECLARE THE POINTERS FOR THE ARRAYS ASSOCIATED WITH EACH DEVICE.
0782  1 C
0783  1 	INTEGER*4	PRV_PNTR1, CUR_PNTR1, AD1_PNTR
0784  1 	INTEGER*4	PRV_PNTR2, CUR_PNTR2, AD2_PNTR
0785  1 	INTEGER*4	AD8_PNTR, AD9_PNTR
0786  1 C
0787  1 C **  DECLARE VARIABLE FOR CURRENT TIME ON SYSTEM.
0788  1 C
0789  1 	INTEGER*4	CUR_TIME
0790  1 C
0791  1 C **  DECLARE VARIABLE FOR PLACEMENT OF NEW OPERATING INSTRUCTIONS CODE.
0792  1 C
0793  1 	INTEGER*4	NEWOPT
0794  1 C
0795  1 C **  STORAGE ARRAYS FOR AXA0 DEVICE.
0796  1 C
0797  1 	INTEGER*2	AD1_DATA1(120,16), AD1_DATA2(120,16)
0798  1 	INTEGER*4	AD1_TIME1(120),    AD1_TIME2(120)
0799  1 C
0800  1 C **  BUFFERS FOR AXA0 I/O
0801  1 C
0802  1 	INTEGER*2	AD1_BUFFER(16), DA1_BUFFER(2)

ADDA_CLOCK                                                      20-Nov-1990 18:08:42	VAX FORTRAN V5.4-79                 Page   3
                                                                14-Jul-1988 19:36:57	LIB4:[ADDASYS.SOURCE]ADDA_CLOCK.FOR;15      

0803  1 C
0804  1 C **  STORAGE ARRAYS FOR AXB0 DEVICE.
0805  1 C
0806  1 	INTEGER*2	AD2_DATA1(120,16), AD2_DATA2(120,16)
0807  1 	INTEGER*4	AD2_TIME1(120),    AD2_TIME2(120)
0808  1 C
0809  1 C **  BUFFERS FOR AXB0 I/O
0810  1 C
0811  1 	INTEGER*2	AD2_BUFFER(16), DA2_BUFFER(2)
0812  1 C
0813  1 C **  STORAGE ARRAYS FOR POST TEST DATA ANALYSIS OF DATA.
0814  1 C
0815  1 	INTEGER*2	AD8_DATA1(120,16), AD9_DATA1(120,16)
0816  1 	INTEGER*4	AD8_TIME1(120), AD9_TIME1(120)
0817  1 C
0818  1 C***************************************************************************
0819  1 C 
0820  1 C **  DECLARES THE SHARED COMMON.
0821  1 C
0822  1 	COMMON /ADDA_DATA/	AD1_DATA1, AD1_DATA2, AD1_BUFFER, DA1_BUFFER,
0823  1      &				AD1_TIME1, AD1_TIME2,
0824  1      &				AD2_DATA1, AD2_DATA2, AD2_BUFFER, DA2_BUFFER,
0825  1      &				AD2_TIME1, AD2_TIME2
0826  1 C
0827  1 	COMMON /ADDA_STORE/	AD8_DATA1, AD8_TIME1, AD8_PNTR, USE_LOGICAL8,
0828  1      &				AD9_DATA1, AD9_TIME1, AD9_PNTR, USE_LOGICAL9
0829  1 C
0830  1 	COMMON /ADDA_PNTRS/	PRV_PNTR1, CUR_PNTR1, AD1_PNTR,
0831  1      &				PRV_PNTR2, CUR_PNTR2, AD2_PNTR
0832  1 C
0833  1 	COMMON /ADDA_LOGIC/	START_STOP1, USE_LOGICAL1, START_STOP2, 
0834  1      &				USE_LOGICAL2, CLK_READY
0835  1 C
0836  1 	COMMON /ADDA_NMBR/	CLK_RATE, AD_NUMBR, DA_NUMBR, NEWOPT, CUR_TIME,
0837  1      &				AD_CHNL, DA_CHNL
0838  1 C
0839  1 C************************************************
0840  1 C
0841  1 C **  DECLARE FOLLOWING ROUTINES AS EXTERNAL TO NORMAL PROGRAM.
0842  1 C
0843  1 	EXTERNAL	SYS$CREMBX
0844  1 	EXTERNAL	SYS$DELMBX
0845  1 	EXTERNAL	SYS$DASSGN
0846  1 	EXTERNAL	SYS$WAITFR
0847  1 	EXTERNAL	SYS$SETEF
0848  1 	EXTERNAL	SYS$DACEFC
0849  1 	EXTERNAL	SYS$DLCEFC
0850  1 	EXTERNAL	SYS$ASCEFC
0851  1 	EXTERNAL	SYS$CLREF
0852  1 C
0853    C
0854    C **  DEFINE WHICH EVENT FLAG CLUSTER WE ARE USING.
0855    C
0856    	CEFN = 64
0857    C
0858    C **  ASSOCIATE PROGRAM WITH EVENT FLAG CLUSTER.
0859    C

ADDA_CLOCK                                                      20-Nov-1990 18:08:42	VAX FORTRAN V5.4-79                 Page   4
                                                                14-Jul-1988 19:36:57	LIB4:[ADDASYS.SOURCE]ADDA_CLOCK.FOR;15      

0860    	STATUS_H = SYS$ASCEFC( %VAL(CEFN), 'ADDA_DATA_GET', , )
0861    		IF (.NOT. STATUS_H) CALL LIB$SIGNAL(%VAL(STATUS_H))
0862    C
0863    C **  SET CLOCK LOGICALS TO FALSE.
0864    C
0865    	CLK_SET = .FALSE.
0866    	CLK_READY = .FALSE.
0867    C***
0868    C	ATTACH THE CLOCK MODULE.
0869    C***
0870    C
0871    3300	TYPE *, 'Attach Clock.'
0872    C
0873    	STATUS_C = LIO$ATTACH( CLK_ID, 'KZA0', LIO$K_QIO )
0874    		IF (.NOT. (STATUS_C)) CALL LIB$SIGNAL(%VAL(STATUS_C))
0875    C
0876    C***
0877    C	SET UP THE CLOCK MODULE.  (OR RESET DEPENDING UPON SITUATION.)
0878    C***
0879    C
0880    	TYPE *, 'Set up the Clock.'
0881    C
0882    C **  DEFINE THE CLOCK AS USING THE ASYNCHRONOUS INTERFACE.
0883    C
0884    	STATUS_C = LIO$SET_I( CLK_ID, LIO$K_ASYNCH, 0 )
0885    		IF (.NOT. (STATUS_C)) CALL LIB$SIGNAL(%VAL(STATUS_C))
0886    C
0887    C **  START CLOCK ON FIRST DEVICE ENQUEUE.
0888    C
0889    	STATUS_C = LIO$SET_I( CLK_ID, LIO$K_TRIG, 1, LIO$K_IMMEDIATE )
0890    		IF (.NOT. (STATUS_C)) CALL LIB$SIGNAL(%VAL(STATUS_C))
0891    C
0892    C **  SET THE CLOCK RATE.
0893    C
0894    	TYPE *, 'Setting the Clock Rate...'
0895    	STATUS_C = LIO$SET_R( CLK_ID, LIO$K_CLK_RATE, 1, CLK_RATE)
0896    		IF (.NOT. (STATUS_C)) CALL LIB$SIGNAL(%VAL(STATUS_C))
0897    C
0898    C **  TELL CLOCK TO CONTINUE INDEFINITELY.
0899    C
0900    	STATUS_C = LIO$SET_I( CLK_ID, LIO$K_FUNCTION, 1, LIO$K_REP_COUNT)
0901    		IF (.NOT. (STATUS_C)) CALL LIB$SIGNAL(%VAL(STATUS_C))
0902    C
0903    C **  INITIALIZE PARAMETER FOR DETECTING SETTING OF EVENT FLAG.
0904    C
0905    	ISETEFN = SS$_WASCLR
0906    C
0907    C **  TELL ADDA ENVIRONMENT THAT CLOCK IS NOW READY.
0908    C
0909    	CLK_READY = .TRUE.
0910    C
0911    C **  REPEAT LOOP, LOOKING FOR EVENT FLAGS.
0912    C
0913    	DO WHILE ( ISETEFN .NE. SS$_WASSET )
0914    C
0915    C **  CLOCK SLEEPS UNTIL AN EVENT FLAG IS SET.
0916    C

ADDA_CLOCK                                                      20-Nov-1990 18:08:42	VAX FORTRAN V5.4-79                 Page   5
                                                                14-Jul-1988 19:36:57	LIB4:[ADDASYS.SOURCE]ADDA_CLOCK.FOR;15      

0917    		CALL CLOCK_SLEEP( ISETEFN, IEFN )
0918    C
0919    C **  IF EVENT FLAG WAS SET THEN FIND WHICH ONE.
0920    C
0921    		IF (ISETEFN .EQ. SS$_WASSET ) THEN
0922    C
0923    C **  TURN CLOCK READY STATUS TO FALSE.
0924    C
0925    			CLK_READY = .FALSE.
0926    			IF (IEFN .EQ. 90) THEN
0927    				TYPE *,'Starting for Event Flag = ',IEFN
0928    C
0929    C **  EVENT FLAG 90 IS FOR STARTING THE CLOCK
0930    C
0931    				IF (CLK_SET) GOTO 3600
0932    C
0933    C **  DECLARE CLOCK RUNNING.
0934    C
0935    				CLK_SET = .TRUE.
0936    C
0937    C **  START THE CLOCK.
0938    C
0939    			        STATUS_C = LIO$SET_I( CLK_ID, LIO$K_START, 0)
0940    		                IF(.NOT.STATUS_C)         CALL LIB$SIGNAL(%VAL(STATUS_C))
0941    C
0942    C **  CLEAR THE EVENT FLAG.
0943    C
0944    3600				STATUS_C = SYS$CLREF( %VAL(IEFN) )
0945    C
0946    C **  TELL SYSTEM CLOCK IS READY FOR USE.
0947    C
0948    				CLK_READY = .TRUE.
0949    			ELSE IF (IEFN .EQ. 91) THEN
0950    C
0951    C **  EVENT FLAG 91 IS FOR DEVICE AXA0 STARTING DATA GATHERING.
0952    C
0953    				CLK_SET = .FALSE.
0954    C***
0955    C	DETACH THE CLOCK FROM THE PROGRAM.
0956    C***
0957    C
0958    				TYPE *,'Stopping for Event Flag = ',IEFN
0959    				STATUS_C = LIO$DETACH( CLK_ID, )
0960    				IF (.NOT. (STATUS_C)) CALL LIB$SIGNAL(%VAL(STATUS_C))
0961    C
0962    C **  CLEAR THE EVENT FLAG.
0963    C
0964    				STATUS_C = SYS$CLREF( %VAL(IEFN) )
0965    				GOTO 3300
0966    			ELSE IF (IEFN .EQ. 92) THEN
0967    C
0968    C **  EVENT FLAG 92 IS FOR DEVICE AXB0 STARTING DATA GATHERING.
0969    C
0970    				CLK_SET = .FALSE.
0971    C***
0972    C	DETACH THE DEVICES FROM THE PROGRAM.
0973    C***

ADDA_CLOCK                                                      20-Nov-1990 18:08:42	VAX FORTRAN V5.4-79                 Page   6
                                                                14-Jul-1988 19:36:57	LIB4:[ADDASYS.SOURCE]ADDA_CLOCK.FOR;15      

0974    C
0975    				TYPE *,'Stopping for Event Flag = ',IEFN
0976    				STATUS_C = LIO$DETACH( CLK_ID, )
0977    				IF (.NOT. (STATUS_C)) CALL LIB$SIGNAL(%VAL(STATUS_C))
0978    C
0979    C **  CLEAR THE EVENT FLAG.
0980    C
0981    				STATUS_C = SYS$CLREF( %VAL(IEFN) )
0982    				GOTO 3300
0983    			ELSE IF (IEFN .EQ. 95) THEN
0984    C
0985    C **  EVENT FLAG 95 IS FOR STOPPING THE PROGRAM ENTIRELY.
0986    C
0987    				CLK_SET = .FALSE.
0988    C***
0989    C	DETACH THE DEVICES FROM THE PROGRAM.
0990    C***
0991    C
0992    				TYPE *,'Stopping for Event Flag = ',IEFN
0993    C
0994    C **  CLEAR THE EVENT FLAG.
0995    C
0996    				STATUS_C = SYS$CLREF( %VAL(IEFN) )
0997    				GOTO 3900
0998    			ENDIF
0999    C
1000    C **  DEFINE THE PARAMETER FOR THE EVENT FLAG FIND AS BEING CLEAR.
1001    C
1002    			ISETEFN = SS$_WASCLR
1003    		ELSE IF ( ISETEFN .NE. SS$_WASSET ) THEN
1004    C
1005    C **  CHECK IF THE DATA GATHERING PROGRAMS ARE EVEN RESIDENT?
1006    C
1007    			IF ((START_STOP1) .AND. (START_STOP2)) THEN
1008    				ISETEFN = SS$_WASSET
1009    C
1010    C **  DEFINE PARAMETER FOR EVENT FLAG FIND AS SET, AND CLOCK LOGICALS AS FALSE.
1011    C
1012    				CLK_READY = .FALSE.
1013    				CLK_SET = .FALSE.
1014    C***
1015    C	DETACH THE DEVICES FROM THE PROGRAM.
1016    C***
1017    C
1018    				STATUS_C = LIO$DETACH( CLK_ID, )
1019    				IF (.NOT. (STATUS_C)) CALL LIB$SIGNAL(%VAL(STATUS_C))
1020    			ENDIF
1021    C
1022    C **   SET THE WAIT FLAG TO WAIT A SECOND THEN CONTINUE THE LOOP.
1023    C
1024    			CALL WAITABIT( 1.0 )
1025    		ENDIF
1026    C
1027    	ENDDO
1028    C
1029    3900	TYPE *,'		BYE-BYE'
1030    C

ADDA_CLOCK                                                      20-Nov-1990 18:08:42	VAX FORTRAN V5.4-79                 Page   7
                                                                14-Jul-1988 19:36:57	LIB4:[ADDASYS.SOURCE]ADDA_CLOCK.FOR;15      

1031    	TYPE *, 'EXIT OF CLOCK PROGRAM...'
1032    C
1033    C **  DIS ASSOCIATE PROGRAM FROM THE EVENT FLAG CLUSTER.
1034    C
1035    	STATUS_H = SYS$DACEFC( %VAL(CEFN) )
1036    		IF (.NOT. STATUS_H) CALL LIB$SIGNAL(%VAL(STATUS_H))
1037    C
1038    	END




PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  836   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  1 $PDATA                                 203   PIC CON REL LCL   SHR NOEXE   RD NOWRT LONG
  2 $LOCAL                                 412   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG
  3 ADDA_DATA                            17352   PIC OVR REL GBL   SHR NOEXE   RD   WRT LONG
  4 ADDA_STORE                            8656   PIC OVR REL GBL   SHR NOEXE   RD   WRT LONG
  5 ADDA_PNTRS                              24   PIC OVR REL GBL   SHR NOEXE   RD   WRT LONG
  6 ADDA_LOGIC                              20   PIC OVR REL GBL   SHR NOEXE   RD   WRT LONG
  7 ADDA_NMBR                             2924   PIC OVR REL GBL   SHR NOEXE   RD   WRT LONG

    Total Space Allocated                30427


ENTRY POINTS

    Address  Type  Name          

  0-00000000       ADDA_CLOCK    


VARIABLES

    Address  Type  Name              Address  Type  Name              Address  Type  Name              Address  Type  Name          

  5-00000008  I*4  AD1_PNTR        5-00000014  I*4  AD2_PNTR        4-000010E0  I*4  AD8_PNTR        4-000021C8  I*4  AD9_PNTR      
      **      I*4  CEFN            2-00000000  R*4  CLK_ID          7-00000000  R*4  CLK_RATE        6-00000010  L*4  CLK_READY     
      **      L*4  CLK_SET         5-00000004  I*4  CUR_PNTR1       5-00000010  I*4  CUR_PNTR2       7-00000018  I*4  CUR_TIME      
  2-00000008  I*4  IEFN            2-00000004  I*4  ISETEFN         7-00000014  I*4  NEWOPT          5-00000000  I*4  PRV_PNTR1     
  5-0000000C  I*4  PRV_PNTR2       6-00000000  L*4  START_STOP1     6-00000008  L*4  START_STOP2         **      I*4  STATUS_C      
      **      I*4  STATUS_H            **      I*4  SYS$BINTIM          **      I*4  SYS$SETIMR          **      I*4  TIMER_EF      
  6-00000004  L*4  USE_LOGICAL1    6-0000000C  L*4  USE_LOGICAL2    4-000010E4  L*4  USE_LOGICAL8    4-000021CC  L*4  USE_LOGICAL9  


ARRAYS

    Address  Type  Name                Bytes  Dimensions

  3-00001E00  I*2  AD1_BUFFER             32  (16)
  3-00000000  I*2  AD1_DATA1            3840  (120, 16)
  3-00000F00  I*2  AD1_DATA2            3840  (120, 16)
  3-00001E24  I*4  AD1_TIME1             480  (120)
  3-00002004  I*4  AD1_TIME2             480  (120)

ADDA_CLOCK                                                      20-Nov-1990 18:08:42	VAX FORTRAN V5.4-79                 Page   8
01                                                              14-Jul-1988 19:36:57	LIB4:[ADDASYS.SOURCE]ADDA_CLOCK.FOR;15      

  3-00003FE4  I*2  AD2_BUFFER             32  (16)
  3-000021E4  I*2  AD2_DATA1            3840  (120, 16)
  3-000030E4  I*2  AD2_DATA2            3840  (120, 16)
  3-00004008  I*4  AD2_TIME1             480  (120)
  3-000041E8  I*4  AD2_TIME2             480  (120)
  4-00000000  I*2  AD8_DATA1            3840  (120, 16)
  4-00000F00  I*4  AD8_TIME1             480  (120)
  4-000010E8  I*2  AD9_DATA1            3840  (120, 16)
  4-00001FE8  I*4  AD9_TIME1             480  (120)
  7-00000004  I*4  AD_NUMBR                8  (2)
  3-00001E20  I*2  DA1_BUFFER              4  (2)
  3-00004004  I*2  DA2_BUFFER              4  (2)
  7-0000000C  I*4  DA_NUMBR                8  (2)


RECORD ARRAYS

    Address   Name          Structure                             Bytes  Dimensions

  7-0000001C  AD_CHNL       AD_LIST                                2560  (2, 16)
  7-00000A1C  DA_CHNL       DA_LIST                                 336  (2, 2)


LABELS

    Address   Label       Address   Label       Address   Label   

  0-00000030  3300      0-00000179  3600      0-000002E8  3900    


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name            Type  Name            Type  Name            Type  Name            Type  Name            Type  Name          

        CLOCK_SLEEP           LIB$SIGNAL       I*4  LIO$ATTACH       I*4  LIO$DETACH       I*4  LIO$SET_I        I*4  LIO$SET_R     
   I*4  SYS$ASCEFC       I*4  SYS$CLREF        I*4  SYS$DACEFC            WAITABIT      

                                                                20-Nov-1990 18:08:42	VAX FORTRAN V5.4-79                 Page   9
                                                                14-Jul-1988 19:36:57	LIB4:[ADDASYS.SOURCE]ADDA_CLOCK.FOR;15      

0002    	SUBROUTINE CLOCK_SLEEP( ISETEFN, IEFN )
0003    C
0004    C **************************************************************************
0005    C **  PROGRAM AUTHOR:       WILLIAM BAKER
0006    C 
0007    C **  PROGRAM DESCRIPTION:  PLACES PROGRAM IN WAIT STATE TILL READY TO START.
0008    C **                        
0009    C
0010    C **  SLEEP
0011    C     -----------------------
0012    C
0013    C **  DECLARE LOCAL VARIABLES NEEDED BY PROGRAM.
0014    C
0015    	INTEGER*4	STATUS, ISETEFN, EFN_MASK
0016    	INTEGER*4	SYS$READEF, SYS$CLREF
0017    C
0018    C **  DECLARE PARAMETERS NEEDED BY SUBROUTINE.
0019    C
0020    	PARAMETER SS$_WASCLR = '00000001'X
0021    	PARAMETER SS$_WASSET = '00000009'X
0022    C
0023    C **  SET FIRST EVENT FLAG.
0024    C
0025    	IEFN = 90 
0026    C
0027    C **  READ STATUS OF EVENT FLAG.
0028    C
0029    	STATUS = SYS$READEF( %VAL(IEFN), EFN_MASK )
0030    	ISETEFN = STATUS
0031    C
0032    C **  CHECK STATUS OF EVENT FLAG READ.  IF IT WAS SET, THEN RETURN TO MAIN.
0033    C
0034    	IF (STATUS .EQ. SS$_WASSET) RETURN
0035    C
0036    C **  INSURE EVENT FLAG IS CLEAR THEN CONTINUE.
0037    C
0038    	STATUS = SYS$CLREF( %VAL(IEFN) )
0039    C
0040    C **  SET SECOND EVENT FLAG.
0041    C
0042    	IEFN = 91
0043    C
0044    C **  READ STATUS OF EVENT FLAG.
0045    C
0046    	STATUS = SYS$READEF( %VAL(IEFN), EFN_MASK )
0047    	ISETEFN = STATUS
0048    C
0049    C **  CHECK STATUS OF EVENT FLAG READ.  IF IT WAS SET, THEN RETURN TO MAIN.
0050    C
0051    	IF (STATUS .EQ. SS$_WASSET) RETURN
0052    C
0053    C **  INSURE EVENT FLAG IS CLEAR THEN CONTINUE.
0054    C
0055    	STATUS = SYS$CLREF( %VAL(IEFN) )
0056    C
0057    C **  SET THIRD EVENT FLAG.

CLOCK_SLEEP                                                     20-Nov-1990 18:08:42	VAX FORTRAN V5.4-79                 Page  10
                                                                14-Jul-1988 19:36:57	LIB4:[ADDASYS.SOURCE]ADDA_CLOCK.FOR;15      

0058    C
0059    	IEFN = 92 
0060    C
0061    C **  READ STATUS OF EVENT FLAG.
0062    C
0063    	STATUS = SYS$READEF( %VAL(IEFN), EFN_MASK )
0064    	ISETEFN = STATUS
0065    C
0066    C **  CHECK STATUS OF EVENT FLAG READ.  IF IT WAS SET, THEN RETURN TO MAIN.
0067    C
0068    	IF (STATUS .EQ. SS$_WASSET) RETURN
0069    C
0070    C **  INSURE EVENT FLAG IS CLEAR THEN CONTINUE.
0071    C
0072    	STATUS = SYS$CLREF( %VAL(IEFN) )
0073    C
0074    C **  SET FOURTH EVENT FLAG
0075    C
0076    	IEFN = 95
0077    C
0078    C **  READ STATUS OF EVENT FLAG.
0079    C
0080    	STATUS = SYS$READEF( %VAL(IEFN), EFN_MASK )
0081    	ISETEFN = STATUS
0082    C
0083    C **  CHECK STATUS OF EVENT FLAG READ.  IF IT WAS SET, THEN RETURN TO MAIN.
0084    C
0085    	IF (STATUS .EQ. SS$_WASSET) RETURN
0086    C
0087    C **  INSURE EVENT FLAG IS CLEAR THEN CONTINUE.
0088    C
0089    	STATUS = SYS$CLREF( %VAL(IEFN) )
0090    C
0091    	RETURN
0092    	END

CLOCK_SLEEP                                                     20-Nov-1990 18:08:42	VAX FORTRAN V5.4-79                 Page  11
01                                                              14-Jul-1988 19:36:57	LIB4:[ADDASYS.SOURCE]ADDA_CLOCK.FOR;15      

PROGRAM SECTIONS

    Name				 Bytes   Attributes

  0 $CODE                                  186   PIC CON REL LCL   SHR   EXE   RD NOWRT LONG
  2 $LOCAL                                  84   PIC CON REL LCL NOSHR NOEXE   RD   WRT LONG

    Total Space Allocated                  270


ENTRY POINTS

    Address  Type  Name          

  0-00000000       CLOCK_SLEEP   


VARIABLES

    Address  Type  Name              Address  Type  Name              Address  Type  Name              Address  Type  Name          

  2-00000000  I*4  EFN_MASK       AP-00000008@ I*4  IEFN           AP-00000004@ I*4  ISETEFN             **      I*4  STATUS        


FUNCTIONS AND SUBROUTINES REFERENCED

  Type  Name            Type  Name          

   I*4  SYS$CLREF        I*4  SYS$READEF    


COMMAND QUALIFIERS

  FOR/LIS/EXTEND ADDA_CLOCK

  /CHECK=(NOBOUNDS,OVERFLOW,NOUNDERFLOW)
  /DEBUG=(NOSYMBOLS,TRACEBACK)
  /DESIGN=(NOCOMMENTS,NOPLACEHOLDERS)
  /SHOW=(NODICTIONARY,NOINCLUDE,MAP,NOPREPROCESSOR,SINGLE)
  /STANDARD=(NOSEMANTIC,NOSOURCE_FORM,NOSYNTAX)
  /WARNINGS=(NODECLARATIONS,GENERAL,NOULTRIX,NOVAXELN)
  /CONTINUATIONS=19  /NOCROSS_REFERENCE  /NOD_LINES  /EXTEND_SOURCE
  /F77  /NOG_FLOATING  /I4  /NOMACHINE_CODE  /OPTIMIZE  /NOPARALLEL
  /NOANALYSIS_DATA
  /NODIAGNOSTICS
  /LIST=LIB4:[ADDASYS.SOURCE]ADDA_CLOCK.LIS;22                                                              
  /OBJECT=LIB4:[ADDASYS.SOURCE]ADDA_CLOCK.OBJ;1                                                               


COMPILATION STATISTICS

  Run Time:           8.60 seconds
  Elapsed Time:       10.96 seconds
  Page Faults:        854
  Dynamic Memory:     620 pages
