Fast Degas PC1 decompressor code

From Atari Wiki
Jump to navigation Jump to search

GT Turbo posted this source a while ago on the forum. As it works beautifully and is rather fast, here is his Degas PC1 file decompressor routine in 68000 assembler:

a0 points to the PC1 file, a1 to the intended destination screen. The palette is not extracted with this code but follows the Deags standard, e.q. simply move from 2(a0) 32 bytes into the Shifter color registers.

		; code by GT Turbo / Cerebral Vortex
Depack_PC1:	movem.l d0-d7/a0-a6,-(a7)		

		lea 34(a0),a0 ; Debut du pic

		move.w #199,d4 ; 199

		move.l a1,a2 ; Destination
		moveq #3,d1  ; 4 Bit planes

		move.l a2,a3
		moveq #0,d3
		moveq #1,d5

		moveq #0,d0
		move.b (a0)+,d0
		bmi.s Repete_code

		add.b d0,d3
		addq.b #1,d3

		move.b (a0)+,(a2)
		add.w d5,a2
		eor.w #6,d5

		dbra d0,Copy

		bra.s End_line

		neg.b d0

		; nop
		addq.b #1,d3
		add.b d0,d3

		move.b (a0)+,d2

		move.b d2,(a2)

		add.w d5,a2
		eor.w #6,d5

		dbra d0,Recopy_code

		cmp.b #40,d3

		bne.s Recup_code
		move.l a3,a2

		addq.w #2,a2 ; Plan suivant

		dbra d1,Debut_line

		lea 160(a1),a1 ; Ligne suivante
		dbra d4,All_lines

		movem.l (a7)+,d0-d7/a0-a6