FAME + some random stuff added
[picodrive.git] / Pico / Draw_amips.s
CommitLineData
70357ce5 1# vim:filetype=mips
2
3# only CLUT for now..
4
5.set noreorder # don't reorder any instructions
6.set noat # don't use $at
7
8
9# void amips_clut(unsigned short *dst, unsigned char *src, unsigned short *pal, int count)
10
11.global amips_clut
12
13amips_clut:
14 srl $a3, 2
15amips_clut_loop:
16 lbu $t0, 0($a1) # tried lw here, no improvement noticed
17 lbu $t1, 1($a1)
18 lbu $t2, 2($a1)
19 lbu $t3, 3($a1)
20 sll $t0, 1
21 sll $t1, 1
22 sll $t2, 1
23 sll $t3, 1
24 addu $t0, $a2
25 addu $t1, $a2
26 addu $t2, $a2
27 addu $t3, $a2
28 lhu $t0, 0($t0)
29 lhu $t1, 0($t1)
30 lhu $t2, 0($t2)
31 lhu $t3, 0($t3)
32 ins $t0, $t1, 16, 16 # ins rt, rs, pos, size - Insert size bits starting
33 ins $t2, $t3, 16, 16 # from the LSB of rs into rt starting at position pos
34 sw $t0, 0($a0)
35 sw $t2, 4($a0)
36 addiu $a0, 8
37 addiu $a3, -1
38 bnez $a3, amips_clut_loop
39 addiu $a1, 4
40 jr $ra
41 nop
42