	program r11sp53

	byte i1,i2,i3

	open(unit=1,file='11sp53.dsk',status='old',
     1		form='unformatted',access='direct',recl=128)
	open(unit=2,file='11sp53.fix',status='new',
     1		form='unformatted',access='direct',recl=128)


c always copy through 512 bytes
10	do j=1,512
	  call bytein(i1)
	  call byteout(i1)
	end do

c if the last of those 512 was a LF, then there is no extra

	if (i1.eq.10) go to 10

c now we ought to have hit a line feed

	call bytein(i1)
	if (i1.ne.10) stop ' didn''t hit LF'

	go to 10
	end


	subroutine byteout(i)
	byte i
	byte buffer(512)

	data iptr,irec/0,1/

c	type *,iptr,irec

	iptr=iptr+1
	buffer(iptr)=i
	if (iptr.eq.512) then
	  write(2,rec=irec) buffer
	  iptr=0
	  irec=irec+1
	end if
	return
	end


	subroutine bytein(i)
	byte i
	byte buffer(512)

	data iptr,irec/512,0/

c	type *,iptr,irec

	iptr=iptr+1
	if (iptr.eq.513) then
	  irec=irec+1
	  read(1,rec=irec) buffer
	  iptr=1
	end if
	i=buffer(iptr)
	return
	end
