 incdir  work:programmieren/include
 include lvo.i
 include dos/dos.i
 
 clr.b   (-1,a0,d0.w)
 move.l  a0,d7
 lea     dosname,a1
 moveq   #37,d0
 move.l  4,a6
 jsr     (_LVOOpenLibrary,a6)
 tst.l   d0
 beq     nodos
 move.l  d0,a6
 move.l  d7,d1
 move.l  #MODE_OLDFILE,d2
 jsr     (_LVOOpen,a6)
 move.l  d0,d7
 beq     nofile
 lea     (-1000,sp),sp   ; eigener speicherbereich 1
 lea     (sp),a5         ; dito 
 lea     (-1000,sp),sp   ; eigener speicherbereich 2
 lea     (sp),a4         ; dito
 move.l  d7,d1           ; altes file
 move.l  a5,d2           ; bufferone einlesen
 move.l  #1000,d3        ; max. länge
 jsr     (_LVOFGets,a6)
 tst.l   d0              ; schon zu ende
 beq     end
 bra     labeltwo
loop
 exg     a5,a4
labeltwo
 move.l  a5,a3           ; bufferone neu
 move.l  a4,a2           ; buffertwo neu
 move.l  d7,d1           ; nochmal altes file einlesen
 move.l  a4,d2           ; buffertwo einlesen
 move.l  #1000,d3        ; max. länge
 jsr     (_LVOFGets,a6)
 tst.l   d0
 beq     writelast       ; war's zu ende, bufferone ausschreiben
subloop
 move.b  (a3)+,d0
 move.b  (a2)+,d1
 cmp.b   #10,d0
 beq     maybediff
 cmp.b   d0,d1
 beq     subloop
write
 move.l  a5,d1
 jsr     (_LVOPutStr,a6)
 bra     loop
maybediff
 cmp.b   #10,d1
 beq     loop
 bra     write
end
 move.l  d7,d1
 jsr     (_LVOClose,a6)
 move.l  a6,a1
 move.l  4,a6
 jsr     (_LVOCloseLibrary,a6)
 lea     2000(sp),sp
 moveq   #0,d0
 rts
nofile
 lea     nofstr,a0
 move.l  a0,d1
 jsr     (_LVOPutStr,a6)
nodos
 moveq   #20,d0
 rts
writelast
 move.l  a5,d1           ; neues file
 jsr     (_LVOPutStr,a6)
 bra     end

dosname  dc.b "dos.library",0
	 even
nofstr   dc.b "File not found",10,0

 end
