subr trace_header_decode_old, x2
 ;pull out some basic stuff about the trace exposure
 ;are the names already defined? if $frame_names is, then we assume the
 ;others are as well
 #nl = smap(byte(10))
 #tab = smap(byte(9))
 if defined($frame_names) eq 0 then getallnames
 xx = wmap(x2)
 redim, xx, num_elem(xx)
 sq = trace_time_string(xx(3:5)) + #nl
 if xx(294) ne xx(204) then {
   sq += 'WARNING - frame ID''s from header and integrated fn''s inconsistent!'
   sq += #nl
   sq += ifstring(' %#6.4x', xx(294)) + ifstring(' vs %#6.4x', xx(204)) + #nl
  }
 seqid = lmap([xx(199), xx(198)])
 sq = sq + ifstring('sequence ID %#6.4x', seqid)
 sq = sq + ' ==> '+find_seq_name(seqid) + #nl
 sq = sq + ifstring('frame    ID %#6.4x', xx(294))
 sq = sq + ' ==> '+find_frame_name(xx(294)) + #nl
 targid = xx(205)
 sq = sq + ifstring('target   ID %#6.4x',targid)
 sq = sq + ' ==> '+find_tar_name(targid) + #nl
 sq = sq + ifstring('frame in sequence: %d', xx(201)) + #tab
 sq = sq + ifstring('total frame count: %d', xx(202)*65536+xx(203)) + #nl
 sq = sq + ifstring('# of sequences in list: %d', xx(208)) + #nl
 if extract_bits(xx(102),12,1) eq 1 then s2 ='amp: B' else s2 = 'amp: A'
 sq = sq + s2 + ifstring('  summed: %d', extract_bits(xx(102),0,8))
 sq = sq + ifstring(' by %d', extract_bits(xx(103),8,8)) + #tab
 sai = xx(413)
 sq = sq + ifstring('type: %d', xx(2))+ ifstring('  subarea: %d', sai)
 sq += ifstring('  event area: %d', extract_bits(xx(295),5,1)) + #nl
 ;size of this subarea
 ncase sai
  parea = xx(350:365)
  parea = xx(366:381)
  parea = xx(382:397)
  else: ty, 'illegal subarea, sai =', sai
 endcase
 nc = parea(5)  nr = parea(6)	bm = parea(8)>1
 nc = nc/bm	nr = nr/bm
 sq = sq + ifstring('image size %d x', nc)+ifstring('%d', nr)+ifstring(', bin = %d', bm)+#nl;
 ;events
 if total(xx(398:400)) eq 0 then s2 = ' none' else {
 	s2 =''
	if xx(398) then s2 += ' flare'
	if xx(399) then s2 += ' super flare'
	if xx(400) then s2 += ' transient'
	}
 sq = sq + 'events triggered:' + s2 + #tab
 ;I max/min from the IP block, this is a location, need to decode it
 sq = sq + 'I max: '
 if xx(402) eq 1 then {
 	s2 = '@'+string(lmap([xx(404),xx(403)]))
	s2 += '('+string(xx(220))+', '+string(xx(221))+')' }
 	else s2 = 'none'
 sq = sq + s2 + '   I min: '
 if xx(405) eq 1 then {
 	s2 = '@'+string(lmap([xx(407),xx(406)]))
 	s2 += '('+string(xx(223))+', '+string(xx(224))+')' }
 	else s2 = 'none'
 sq = sq + s2
 sq = sq + #nl
 ;also get Imax, min location from registers

 sq = sq + 'AEC adjustment: '
 adj = xx(401)
 if adj eq 0 then s2 = 'none' else {
 	if adj gt 0 then s2 = 'up  ' else
 	  s2 = 'down'
 }
 sq = sq + s2 + #tab
 ;coarse exposure time
 et = (xx(265) and 0xffff) * 0.004
 sq = sq + 'exposure time: '+ fstring('%8.3f', et)+' s'
 sq = sq + #nl
 sq = sq + ifstring('$FEF: %d', xx(214)) + ifstring(' $SEF: %d', xx(215))
 sq = sq + ifstring(' $TEF: %d', xx(216)) + ifstring(' $NBF: %d', xx(217))
 sq = sq + ifstring(' $CBF: %d', xx(218)) + ifstring(' $TRC: %d', xx(219))
 sq = sq + #nl
 switch, sq, $trace_frame_info

 endsubr
 ;=======================================================================
