PRO PMODE,MODE=MODE,RESULT=RESULT

;+
; NAME:
;	PMODE
; PURPOSE:
;	Change the timing parameters of the Peritek VCT graphics
;	interface to output NTSC, high-res-interlaced,
;	or high-res-non-interlaced signals
; CATEGORY:
;	Image display through the Peritek VCT graphics interface.
; CALLING SEQUENCE:
;	PMODE,RESULT=RESULT
; INPUTS:
;	MODE:	Video signal mode (0,1,2 = NTSC, high-res-interlaced,
;		high-res-non-interlaced
; KEYWORD PARAMETERS:
;	RESULT = error message
; PROCEDURE:
;	Spawns calls to two C routines which perform the necessary tasks.
; MODIFICATION HISTORY:
;	10-Jul-1991 - Written by GLS
;       15-nov-1991 - Updated, JRL -- Added DIR_PERITEK environment
;                                     variable to reference C routines.
;        5-may-1991 - Updated, GLS -- Use !version to determine which
;                                     C routine (V bus version or Q bus
;                                     version) to call.
;-

case strlowcase(!version.os) of
   'ultix': busname = 'q'               ; Q bus interface to Peritek board
   'irix' : busname = 'v'               ; V bus interface to Peritek board
   else   : busname = 'v'               ; V bus assumed
endcase

if n_elements(mode) eq 0 then mode = 0
command = '$DIR_PERITEK/vct' + busname + 'mode -quiet'
case mode of
  0: spawn, command + ' -port 0',result
  1: spawn, command + ' -port 1',result
  2: spawn, command + ' -port 2',result
  else: result = ' ILLEGAL MODE!'
endcase
command = '$DIR_PERITEK/vct' + busname + 'ld -quiet -task' + $
	  '/usr/34020/board/progs/ctp' + busname + '.ram'
spawn,command,result

return
end

