	lea	screen,a0
	move.l	a0,a3
	lea	buff1,a1
	move.l	a1,a4
	lea	buff2,a2
	moveq	#1,d0
	moveq	#0,d1
	moveq	#1,d2

	move.l	(a0),d3
	move.l	#$FFFFFFFF,(a0)
boucle:
	lea	160(a0),a0
	move.l	(a0),d4
	move.l	#$FFFFFFFF,(a0)
	cmp.l	d3,d4
	bne.s	non_egaux
	addq.l	#1,d0
	bra.s	fin_test_1
non_egaux:
	move.b	d0,(a1)+
	move.l	d3,(a2)+
	moveq	#1,d0
fin_test_1:
	cmpi.l	#255,d0
	bne.s	fin_test_2
	move.b	d0,(a1)+
	move.l	d3,(a2)+
	moveq	#0,d0
fin_test_2:
	move.l	d4,d3
	addq.l	#1,d2
	cmpi.l	#200,d2
	bne.s	fin_test_3
	sub.l	d2,d2
	addq.l	#1,d1
	cmpi.l	#40,d1
	bne.s	fin_test_4
	bra.s	fin_compactage
fin_test_4:
	lea	4(a3),a3
	move.l	a3,a0
	lea	-160(a0),a0
fin_test_3:
	bra	boucle
Fin_compactage:
	move.b	d0,(a1)+
	move.b	#0,(a1)+	;insert flag byte
	move.l	d3,(a2)
	suba.l	a4,a1
	move.l	a1,d0

	subq.l	#1,d0
	move.l	d0,d1
	lea	buff3,a3
	move.l	a3,a4
	lea	buff1,a1
	lea	buff2,a2
putfinloop:
	move.b	(a1)+,(a3)+
	dbf	d0,putfinloop
	lea	buff2,a2
putfinloop2:
	move.b	(a2)+,(a3)+
	move.b	(a2)+,(a3)+
	move.b	(a2)+,(a3)+
	move.b	(a2)+,(a3)+
	dbf	d1,putfinloop2
	sub.l	a4,a3
	move.l	a3,d0			;amount to write out
illegal
       rts

screena:
	blk.b	128,0
screen:
	blk.b	32000,0
screen1:

buff1:
	blk.b	10000,0
buff2:	blk.b	10000,0
buff3:
	blk.b	20000,0

