libretro: satisfy vita's dynarec needs in a cleaner way
[picodrive.git] / platform / pandora / asm_utils.s
... / ...
CommitLineData
1@ vim:filetype=armasm
2
3
4@ FIXME: handle dual issue
5.global clut_line2x2 @ void *dest, void *src, unsigned short *pal, int pixels_mask
6
7clut_line2x2:
8 stmfd sp!, {r4-r11,lr}
9
10 and lr, r3, #0xff0000
11 mov lr, lr, lsr #15 @ mask
12 mov r3, r3, lsr #3
13 and r3, r3, #0xff @ counter
14 add r11,r0, #800*2
15
16clut_line_2x2_loop:
17 ldmia r1!, {r10,r12}
18
19 and r4, lr, r10, lsl #1
20 ldrh r4, [r2, r4]
21 and r5, lr, r10, lsr #7
22 ldrh r5, [r2, r5]
23 orr r4, r4, r4, lsl #16
24
25 and r6, lr, r10, lsr #15
26 ldrh r6, [r2, r6]
27 orr r5, r5, r5, lsl #16
28
29 and r7, lr, r10, lsr #23
30 ldrh r7, [r2, r7]
31 orr r6, r6, r6, lsl #16
32
33 and r8, lr, r12, lsl #1
34 ldrh r8, [r2, r8]
35 orr r7, r7, r7, lsl #16
36
37 and r9, lr, r12, lsr #7
38 ldrh r9, [r2, r9]
39 orr r8, r8, r8, lsl #16
40
41 and r10,lr, r12, lsr #15
42 ldrh r10,[r2, r10]
43 orr r9, r9, r9, lsl #16
44
45 and r12,lr, r12, lsr #23
46 ldrh r12,[r2, r12]
47 orr r10,r10,r10, lsl #16
48
49 subs r3, r3, #1
50 orr r12,r12,r12, lsl #16
51
52 stmia r0!, {r4-r10,r12}
53 stmia r11!,{r4-r10,r12}
54 bne clut_line_2x2_loop
55
56 ldmfd sp!, {r4-r11,pc}
57
58
59@ 00 01 11 22 23 33
60@ r4 r5 r6 r7 r8 r9
61
62.macro do_4_to_12 rs
63 and r4, lr, \rs, lsl #1
64 and r6, lr, \rs, lsr #7
65 and r7, lr, \rs, lsr #15
66 and r9, lr, \rs, lsr #23
67 ldrh r4, [r2, r4]
68 ldrh r6, [r2, r6]
69 ldrh r7, [r2, r7]
70 ldrh r9, [r2, r9]
71
72 orr r5, r4, r6, lsl #16
73 orr r4, r4, r4, lsl #16
74 orr r6, r6, r6, lsl #16
75
76 orr r8, r7, r9, lsl #16
77 orr r7, r7, r7, lsl #16
78 orr r9, r9, r9, lsl #16
79.endm
80
81
82.global clut_line3x2 @ void *dest, void *src, unsigned short *pal, int pixels_mask
83
84clut_line3x2:
85 stmfd sp!, {r4-r11,lr}
86
87 and lr, r3, #0xff0000
88 mov lr, lr, lsr #15 @ mask
89 mov r3, r3, lsr #3
90 and r3, r3, #0xff @ counter
91 add r11,r0, #800*2
92
93clut_line3x2_loop:
94 ldmia r1!, {r10,r12}
95
96 do_4_to_12 r10
97 stmia r0!, {r4-r9}
98 stmia r11!,{r4-r9}
99
100 do_4_to_12 r12
101 subs r3, r3, #1
102 stmia r0!, {r4-r9}
103 stmia r11!,{r4-r9}
104
105 bne clut_line3x2_loop
106
107 ldmfd sp!, {r4-r11,pc}
108