Jump to content
Jagware
Sign in to follow this  
GT Turbo

Unpacking rout

Recommended Posts

SebRmv    2
You going to make it part of your Removers Lib?

 

Probably, yes :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoticons maximum are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×