	SUBROUTINE OSCAN3(ID,IOUT,IS,ANS,BNS,CNS,IM)
C	ROUTINE TO DISPLAY DOORWAYS OUTSIDE CUBE
C	ID:	CRAWLER ID
C	IS:	0-CLEAR SCREEN AND DISPLAY
C		1-OVERPRINT DISPLAY
C	IOUT:	DOORWAY SCAN
C 
C----------------------standard common block----------------------------
C 
	COMMON ICR(8,12),IPARM(10),IS1,IS2,NT,ICU(10,10,10,2),CLEAR(8)
	COMMON MARKER(4,3,3)
	LOGICAL*1 ICU,CLEAR
C 
C-----------------------------------------------------------------------
	LOGICAL*1 IOUT(61,5),ANS,BNS,CNS
	DIMENSION IDIFF(3)
	LUN=ICR(ID,8)
	IF(IS.EQ.0) WRITE(LUN,1) "33,"33,CLEAR(ID)
1	FORMAT(X,A1,'Y  ',2A1)
	WRITE(LUN,2) "33,ID,ICR(ID,9),((IOUT(I,J),I=1,61),J=1,5)
2	FORMAT(X,A1,'Y  '/
     C' |  OUTSIDE SCANNER  |     CRAWLER ',I1,'     | ENERGY ',I3,' UNI
     CTS  |'/
     C' |>>>>>>>>>|>>>>>>>>>|>>>>>>>>>|<<<<<<<<<|<<<<<<<<<|<<<<<<<<<|'/
     C' |         |         |         |         |         |         |'/
     CX,61A1,'23-30  ( barely'/X,61A1,'17-22     visible'/X,61A1,'11-17
     C  {  hazy'/X,61A1,' 5-11'/X,61A1,' 1-5   [  clear'/' |',6(
     C'.........|')/
     C' |::::::: 20 :::::: 10 :::::::-0-::::::: 10 :::::: 20 :::::::|')
	IF(IPARM(9).EQ.1) WRITE(LUN,300) (ICR(ID,I),I=2,12)
300	FORMAT(' status:',11I5)
	IF(IM.EQ.0) GOTO 49
C 
C	ON DOORWAY; DETERMINE DIRECTION:
	I=0
	IF(ICR(ID,10).EQ.10) I=3
	IF(ICR(ID,10).EQ.1) I=1
	IF(ICR(ID,11).EQ.10) I=4
	IF(ICR(ID,11).EQ.1) I=2
	IF(ICR(ID,12).EQ.10) I=6
	IF(ICR(ID,12).EQ.1) I=5
C 
C	FIND DIRECTION RELATIVE TO CRAWLER:
	D='****'
	IF(ICR(ID,2).EQ.I) D='FWD.'
	IF(ICR(ID,3).EQ.I) D='LEFT'
	IF(ICR(ID,4).EQ.I) D='BACK'
	IF(ICR(ID,5).EQ.I) D='RT. '
	IF(ICR(ID,7).EQ.I) D='DOWN'
	WRITE(LUN,50) D
50	FORMAT(
     C' |   <<on doorway>>  |  direction: ',A4,'  |',
     C' type IN to enter  |')
49	I0=ICR(ID,10)
	J0=ICR(ID,11)
	K0=ICR(ID,12)
	IN=0
	DO 201 M=1,3
	IDIFF(M)=0
	I1=MARKER(ID,1,M)
	IF(I1.LE.0) GOTO 201
	IN=1
	J1=MARKER(ID,2,M)
	K1=MARKER(ID,3,M)
	X=(I0-I1)**2+(J0-J1)**2+(K0-K1)**2
	IDIFF(M)=SQRT(X)
201	CONTINUE
	IF(IN.EQ.0) GOTO 100
	WRITE(LUN,204) IDIFF
204	FORMAT(
     C' |   TRANSMITTER DISTANCES     |  A  ',I2,'  |  B  ',I2,'  |  C
     C  ',I2,'  |')
C 
100	WRITE(LUN,110) "33,CLEAR(ID)
110	FORMAT(X,2A1)
	IF(IS.LT.0) RETURN
	WRITE(LUN,101)
101	FORMAT(' COMMAND(A,R,E,D): ',$)
	READ(LUN,102) ANS,BNS,CNS
102	FORMAT(3A1)
	IF(ANS.EQ.'A'.OR.ANS.EQ.'R'.OR.ANS.EQ.'E'.OR.ANS.EQ.'D') RETURN
	IF(ANS.EQ.'I'.AND.IM.EQ.1) RETURN
	GOTO 100
	END
