Fast Degas PC1 decompressor code: Difference between revisions

From Atari Wiki
Jump to navigation Jump to search
(Created page with "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: ---- ...")
 
No edit summary
 
Line 72: Line 72:
   
   
[[Category:Programming]][[Category:Assembly Language]]
+
[[Category:Assembly Language]]

Latest revision as of 16:44, 12 October 2011

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

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

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

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

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

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

		dbra d0,Copy

		bra.s End_line

Repete_code:
		neg.b d0

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

		move.b (a0)+,d2

Recopy_code:
		move.b d2,(a2)

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

		dbra d0,Recopy_code

End_line:
		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
		rts