	character*80 f1,f2,head(72)
        real a(2048,2048),b(2048,2048)
	if(iargc().lt.2)then
	  write(*,*)
	  write(*,*)'         ******** mirror 2048*2048 Pic. ********'
	  write(*,*)
	  write(*,*)'    mirror file out_file'
	  write(*,*)
          write(*,*)'                                      2000.7'
	  stop
	endif
	call getarg(1,f1)         ! file
	call getarg(2,f2)         ! outfile
	n1=2048
	n2=2048
	call gethead(f1,head)
	call readfits(f1,a,n1,n2)
	do 10 i=1,2048
	do 10 j=1,2048
10	b(2049-i,j)=a(i,j)
	call swap4(b,n1*n2*4)

        i=lnblnk(f2)+1
	f2(i:i)=char(0)
	call writefits(f2,head,80*72,1)
	call writefits(f2,b,n1*n2*4,0)
	
	f1="coord0 "//f2(1:lnblnk(f2))
	write(*,*)f1
	call system(f1)
	end

	subroutine gethead(f1,head)
	character*80 f1,head(72)
	open(52,file=f1,status='old',access='direct',recl=5760)
	read(52,rec=1)head
	close (52)
	end
