b3db9409 |
1 | /* |
2 | * (C) GraÅžvydas "notaz" Ignotas, 2011 |
3 | * |
4 | * This work is licensed under the terms of GNU GPL, version 2 or later. |
5 | * See the COPYING file in the top-level directory. |
6 | */ |
7 | |
b26afb99 |
8 | #include "arm_features.h" |
b3db9409 |
9 | |
10 | .text |
11 | .align 2 |
12 | |
13 | @ in: r0=dst, r2=pal, r12=0x1e |
14 | @ trashes r6-r8,lr,flags |
15 | .macro do_4_pixels rs ibase obase |
16 | .if \ibase - 1 < 0 |
17 | and r6, r12, \rs, lsl #1 |
18 | .else |
19 | and r6, r12, \rs, lsr #\ibase-1 |
20 | .endif |
21 | and r7, r12, \rs, lsr #\ibase+3 |
22 | and r8, r12, \rs, lsr #\ibase+7 |
23 | and lr, r12, \rs, lsr #\ibase+11 |
24 | ldrh r6, [r2, r6] |
25 | ldrh r7, [r2, r7] |
26 | ldrh r8, [r2, r8] |
27 | ldrh lr, [r2, lr] |
28 | tst r6, r6 |
29 | strneh r6, [r0, #\obase+0] |
30 | tst r7, r7 |
31 | strneh r7, [r0, #\obase+2] |
32 | tst r8, r8 |
33 | strneh r8, [r0, #\obase+4] |
34 | tst lr, lr |
35 | strneh lr, [r0, #\obase+6] |
36 | .endm |
37 | |
38 | .global draw_spr16_full @ (u16 *d, void *s, u16 *pal, int lines) |
39 | draw_spr16_full: |
40 | stmfd sp!, {r4-r8,lr} |
41 | mov r12, #0x1e @ empty pixel |
42 | |
43 | 0: |
44 | ldmia r1, {r4,r5} |
45 | do_4_pixels r4, 0, 0 |
46 | do_4_pixels r4, 16, 8 |
47 | do_4_pixels r5, 0, 16 |
48 | do_4_pixels r5, 16, 24 |
3609c474 |
49 | subs r3, r3, #1 |
50 | add r0, r0, #2048 |
51 | add r1, r1, #2048 |
b3db9409 |
52 | bgt 0b |
53 | |
54 | ldmfd sp!, {r4-r8,pc} |
55 | |
56 | @ vim:filetype=armasm |