C	CONTINUOUS SYSTEM MODELING PROGRAM
C
C	CSMP MAIN PROGRAM
C
C	CARNEGIE-MELLON UNIVERSITY
C	HYBRID COMPUTATION LABORATORY
C	JANUARY, 1969
C
	INTEGER TEST1,TEST2,TEST3,TEST4,TEST7
	LOGICAL RSAC
	COMMON REALS(395),INTS(547)
      EQUIVALENCE (INTS(380),KEY1),(INTS(381),KEY2),(INTS(382),KEY3)
      EQUIVALENCE (INTS(383),KEY4),(INTS(387),KEY8)
      EQUIVALENCE (INTS(525),TEST1),(INTS(526),TEST2)
      EQUIVALENCE (INTS(527),TEST3),(INTS(528),TEST4)
	EQUIVALENCE (INTS(531),TEST7)
C
C	INITIALIZATION SUBROUTINE
	CALL CSM0
C
C	GET NEW SENSE SWITCH SETTINGS
10	CALL CSM12
	IF (KEY8.EQ.2) GO TO 100
C
C	INTERROGATE BLOCK OUTPUTS
	TEST2=4
	CALL CSM13
	GO TO 10
C
C	CONFIGURATION SECTION
C	PROGRAM WILL NOT BRANCH BEYOND THE CONFIGURATION  SECTION
C	    UNTIL A SUCCESSFUL SORT TEST (TEST1=2) IS ACHIEVED
100	IF (TEST1.EQ.2.AND.KEY1.EQ.2) GO TO 200
C	GET CONFIGURATION SPECIFICATIONS
	TEST1=2
110	CALL CSM1
C	PREPARE FOR SORT
	CALL CSM2
	IF (TEST1.EQ.1) GO TO 110
C	SORT
	CALL CSM3
	IF (TEST1.EQ.1) GO TO 110
C
C	SET-UP SECTION
C
C	PARAMETERS AND INITIAL CONDITIONS
200	IF (TEST3.EQ.2.AND.KEY2.EQ.2) GO TO 300
	CALL CSM4
C
C	FUNCTION GENERATORS
300	IF (TEST4.EQ.1) GO TO 400
	IF (TEST3.EQ.2.AND.KEY3.EQ.2) GO TO 400
	CALL CSM5
C
C	INDICATE COMPLETION OF MODEL SPECIFICATIONS
400	TEST2=4
	TEST3=2
	IF (RSAC(0)) GO TO 10
C
C	OUTPUT OUTDATED MODEL
	IF (RSAC(11).OR.RSAC(12)) GO TO 410
	GO TO 500
410	CALL CSM6
	IF (RSAC(0)) GO TO 10
C
C	INTEGRATION SPECIFICATIONS
500	IF (TEST7.EQ.2.AND.KEY4.EQ.2) GO TO 600
	CALL CSM7
	IF (RSAC(0)) GO TO 10
C
C	OUTPUT SPECIFICATIONS
600	CALL CSM8A
	IF (RSAC(0)) GO TO 10
C
C	COMPUTE SECTION
	CALL CSM10
	GO TO 10
C
	END
