slidec.s
1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/******************************
* Data Decompress Ver1.10 *
* Programmed By Melody-Yoshi *
******************************/
/* How to use this function.
void slidstart(unsigned char *,unsigned char *);
first argument is top address of compress data.(align 4)
next argument is top address of decompress.
*/
.align 4
.text
.globl slidstart
.ent slidstart
.set reorder
/* ===== START! ===== */
slidstart: lw $24,4($4) ## R24=Output size
lw $7,8($4)
lw $25,12($4)
move $6,$0 ## flags=0
add $24,$5
add $7,$4
add $25,$4
add $4,16
/* ===== MAIN LOOP ===== */
slidemain2: bne $6,$0,codecheck2
lw $8,($4)
li $6,32
add $4,4
codecheck2: slt $9,$8,$0 ## Check MSB
beq $9,$0,pressdata2
lb $10,($25)
add $25,1
sb $10,($5)
add $5,1
b loopend2
pressdata2: lhu $10,($7)
add $7,2
srl $11,$10,12
and $10,0xfff
sub $9,$5,$10 ## R9=DIST
beq $11,$0,pressloop3
add $11,2
pressloop2: lb $10,-1($9)
sub $11,1
add $9,1
sb $10,($5)
add $5,1
bne $11,$0,pressloop2
loopend2: sll $8,1
sub $6,1
bne $5,$24,slidemain2
jr $31
pressloop3: lbu $11,($25)
add $25,1
add $11,18
b pressloop2
.end