!!-----------------------------------------------------------------------------
!!
	subroutine SYS_GET_KEY(KEY, TMO) !!
!!
!! read for keyboard with timeout, without echo
!!
	character KEY*1 !!
	integer TMO !! timeout in seconds (<100)

	character esc*1, csi*1, ss3*1

        esc=char(27)
        csi=char(155)
        ss3=char(143)
	
	call sys_get_raw_key(key, tmo)
1	if (key .eq. esc) then
	  call sys_get_raw_key(key, tmo)
	  if (key .eq. 'O') then
	    key=ss3
	    goto 1
	  elseif (key .eq. '[') then
	    key=csi
	    goto 1
	  endif
	elseif (key .eq. csi) then
	  call sys_get_raw_key(key, tmo)
	  do while (key .ge. '0' .and. key .le. '9') 
	    call sys_get_raw_key(key, tmo)
	  enddo
	  key=' '
	elseif (key .eq. ss3) then
	  call sys_get_raw_key(key, tmo)
	  if (key .eq. 'm') then
	    key='-'
	  elseif (key .eq. 'l') then
	    key='+'
	  elseif (key .eq. 'n') then
	    key='.'
	  elseif (key .eq. 'M') then
	    key=char(13)
	  elseif (key .eq. 'S') then
	    key='*'
	  elseif (key .eq. 'R') then
	    key='/'
	  elseif (key .eq. 'Q') then
	    key='='
	  else
	    key=' '
	  endif
	endif
	end
