pro rectbin,cl,out,value
;
; This procedure creates a 1024x1024 array (out) from  the rectangular bin
; list (cl).  The array contains a value at each address in the address lists 
; if value is 0, the rest of the array is set to 255; otherwise the rest of
; the array is set to zero.

out = bytarr(1024,1024)
out(0:*) = 0
if (value eq 0) then out(0:*) = 255
l=n_elements(cl)
j = 0L
total_errs = 0
line_errs = 0
tent = 0
nal = cl(2)
print,nal
table_start = '11200'XL
for i=0,nal-1  do begin
  k = 0
  nextal = (i)*7+16
  ix = long(cl(nextal) and 65535) + long(cl(nextal+1) * 65536L)
  ixr = ix - table_start+512
  nent = cl(nextal + 2)
  ixre = ixr + nent*2 - 1
  tent = tent + nent
;  print,"New List"
  print, nextal,ix,ixr,ixre,nent,tent,format='(i6,5z10)'
  for j = ixr,ixre,2 do begin
    k = k + 1
    add = (long(cl(j)) and 65535) + ((long(cl(j+1)) and 65535) * 65535L)
     r = add / 1024
     c = add mod 1024
    ; print,r,c,format
    out(c,r) = value
  end
end
return
end
