Jump to content

Unpacking rout


GT Turbo

Recommended Posts

You going to make it part of your Removers Lib?

 

Probably, yes :)

Link to comment
Share on other sites

  • 6 years later...

10 years later....

 

I just had a need to use this, nice port by GT, but here's a faster version based on his code:

A_zero	.equr	r0
A_one	.equr	r1
A_two	.equr	r2

D_zero	.equr	r3
D_one	.equr	r4
D_two	.equr	r5
D_three	.equr	r6
D_four	.equr	r7
Reg_temp	.equr	r8

LT	.ccdef	%11000

LZ_GPU:

; *****************************************************************

Modif:
	movei	#loadtag,r20
	movei	#literal,r21
	movei	#search,r22
	movei	#break,r23
	movei	#$ff0f,r24		; And masque 
	movei	#Params,r25

	movei	#$f02114,r26		; Gpu Control reg

	movei	#$f03fff,r27
	
; *****************************************************************

	load	(r25),A_zero
	addq	#4,r25
	load	(r25),A_one

; *****************************************************************

	addq	#4,A_zero
	jump	(r20)	; loadtag=r20
	loadb	(A_zero),D_zero

; *****************************************************************

literal:
	REPT	8
	loadb	(A_zero),Reg_temp
	addq	#1,A_zero
	storeb	Reg_temp,(A_one)
	addq	#1,A_one
	ENDR

; *****************************************************************
	loadb	(A_zero),D_zero
loadtag:
	cmpq	#0,D_zero
	jump	EQ,(r21)	; literal=r21
	addq	#1,A_zero
	
; *****************************************************************

	moveq	#8-1,D_one

search:
	shlq	#1,D_zero
	btst	#8,D_zero	
	jr		NE,compressed

	loadb	(A_zero),Reg_temp
	storeb	Reg_temp,(A_one)

	subq	#1,D_one
	addqt	#1,A_zero

	jr		PL,search
	addqt	#1,A_one

	jump	(r20)	; loadtag=r20
	loadb	(A_zero),D_zero


; *****************************************************************

compressed:
	loadb	(A_zero),D_two

	cmpq	#0,D_two
	jump	EQ,(r23)	; break=r23

	moveq	#$f,D_three	
	addq	#1,A_zero
	and		D_two,D_three

	shlq	#4,D_two	
	loadb	(A_zero),D_four
	and		r24,D_two
	addq	#1,A_zero
	or		D_four,D_two

	move	A_one,A_two	
	subq	#1,D_three
	sub		D_two,A_two

	loadb	(A_two),Reg_temp
Boucle_main:
	storeb	Reg_temp,(A_one)
	addq	#1,A_two
	addq	#1,A_one

	subq	#1,D_three
	jr		PL,Boucle_main		
	loadb	(A_two),Reg_temp

	loadb	(A_two),Reg_temp
	addq	#1,A_two
	storeb	Reg_temp,(A_one)
	addq	#1,A_one

	loadb	(A_two),Reg_temp
	addq	#1,A_two
	storeb	Reg_temp,(A_one)

	subq	#1,D_one
	jump	PL,(r22)	; search=r22
	addq	#1,A_one
	
	jump	(r20)	; loadtag=r20		
	loadb	(A_zero),D_zero

; *****************************************************************
;

break:

	moveq	#0,r0	; pour stopper le gpu
	nop
	store	r0,(r26)	; stop le gpu
	nop
	nop
	nop
	.phrase
Params:
GPU_a0:	dc.l	0
GPU_a1:	dc.l	0
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...