	SUBROUTINE SAOSTART
C
C  Note:  This is the UNIX version
C
C       This subroutine opens the input and output pipes, imt1i and imt1o,
C  for communication with SAOimage.  If IFB, the frame buffer key, is set 
C  to zero, then the user is prompted for its value
C			Donald H. Gudehus, August, 1993
C			Version 1U, D. Gudehus, September, 1994
C			Converted code to UNIX
C			Version 2, D. Gudehus, July 25, 2006
C			Incorporated new saofacts.for
C
	INCLUDE 'saofacts.for'
C
	BYTE BIMTOOLNAME(10)
	CHARACTER IMTOOLNAME*10
	EQUIVALENCE (BIMTOOLNAME,IMTOOLNAME)
C
	IF (IFB_SAO.EQ.0) THEN
	  IFB_SAO=1
	  CALL MESSAGE('Select a frame buffer size:')
	  CALL MESSAGE('                1 =  512 X 512 (default)')
	  CALL MESSAGE('                2 =  800 X 800')
	  CALL MESSAGE('                3 = 1024 X 1024')
	  CALL MESSAGE('                4 = 1600 X 1600')
	  CALL MESSAGE('                5 = 2048 X 2048')
	  CALL MESSAGE('                6 = 4096 X 4096')
	  CALL MESSAGE('                7 = 4096 X 1024')
	  CALL MESSAGE('                8 = 1024 X 4096')
	  CALL MESSAGE('                9 = 1144 X  880')
	  CALL MESSAGE('               10 = 1144 X  764')
	  CALL MESSAGE('               11 =  128 X  128')
	  CALL MESSAGE('               12 =  256 X  256')
	  CALL MESSAGE('               13 =   90 X   90')
	  CALL USRINP(IFB_SAO,1,'I',4,1,'FRAME_BUFFER=',' ')
	END IF
	IF (IFB_SAO.EQ.1) THEN
	  MAXFB_COLS_SAO=512
	  MAXFB_ROWS_SAO=512
	ELSE IF (IFB_SAO.EQ.2) THEN
	  MAXFB_COLS_SAO=800
	  MAXFB_ROWS_SAO=800
	ELSE IF (IFB_SAO.EQ.3) THEN
	  MAXFB_COLS_SAO=1024
	  MAXFB_ROWS_SAO=1024
	ELSE IF (IFB_SAO.EQ.4) THEN
	  MAXFB_COLS_SAO=1600
	  MAXFB_ROWS_SAO=1600
	ELSE IF (IFB_SAO.EQ.5) THEN
	  MAXFB_COLS_SAO=2048
	  MAXFB_ROWS_SAO=2048
	ELSE IF (IFB_SAO.EQ.6) THEN
	  MAXFB_COLS_SAO=4096
	  MAXFB_ROWS_SAO=4096
	ELSE IF (IFB_SAO.EQ.7) THEN
	  MAXFB_COLS_SAO=4096
	  MAXFB_ROWS_SAO=1024
	ELSE IF (IFB_SAO.EQ.8) THEN
	  MAXFB_COLS_SAO=1024
	  MAXFB_ROWS_SAO=4096
	ELSE IF (IFB_SAO.EQ.9) THEN
	  MAXFB_COLS_SAO=1144
	  MAXFB_ROWS_SAO=880
	ELSE IF (IFB_SAO.EQ.10) THEN
	  MAXFB_COLS_SAO=1144
	  MAXFB_ROWS_SAO=764
	ELSE IF (IFB_SAO.EQ.11) THEN
	  MAXFB_COLS_SAO=128
	  MAXFB_ROWS_SAO=128
	ELSE IF (IFB_SAO.EQ.12) THEN
	  MAXFB_COLS_SAO=256
	  MAXFB_ROWS_SAO=256
	ELSE IF (IFB_SAO.EQ.13) THEN
	  MAXFB_COLS_SAO=90
	  MAXFB_ROWS_SAO=90
	END IF
C  Open up some pipes for communication with SAOimage.
	CALL SI_OPEN_NAMEDPIPE()
	RETURN
	END
