1 @ vim:filetype=armasm
\r
2 @ some color conversion and blitting routines
\r
4 @ (c) Copyright 2006, 2007 notaz
\r
5 @ All Rights Reserved
\r
7 @ vim:filetype=armasm
\r
12 @ Convert 0000bbb0 ggg0rrr0 0000bbb0 ggg0rrr0
\r
13 @ to 00000000 rrr00000 ggg00000 bbb00000 ...
\r
15 @ lr = 0x00e000e0, out: r3=lower_pix, r2=higher_pix; trashes rin
\r
16 @ if sh==2, r8=0x00404040 (sh!=0 destroys flags!)
\r
17 .macro convRGB32_2 rin sh=0
\r
18 and r2, lr, \rin, lsr #4 @ blue
\r
20 orr r2, r2, r3, lsl #8 @ g0b0g0b0
\r
22 mov r3, r2, lsl #16 @ g0b00000
\r
23 and \rin,lr, \rin, ror #12 @ 00r000r0 (reversed)
\r
24 orr r3, r3, \rin, lsr #16 @ g0b000r0
\r
26 mov r3, r3, ror #17 @ shadow mode
\r
28 adds r3, r3, #0x40000000 @ green
\r
29 orrcs r3, r3, #0xe0000000
\r
31 adds r3, r3, #0x40000000
\r
32 orrcs r3, r3, #0xe0000000
\r
34 adds r3, r3, #0x40000000
\r
35 orrcs r3, r3, #0xe0000000
\r
38 mov r3, r3, ror #16 @ r3=low
\r
41 orr r3, r3, r3, lsr #3
\r
45 orr r2, r2, \rin, lsl #16
\r
50 adds r2, r2, #0x40000000 @ blue
\r
51 orrcs r2, r2, #0xe0000000
\r
53 adds r2, r2, #0x40000000
\r
54 orrcs r2, r2, #0xe0000000
\r
56 adds r2, r2, #0x40000000
\r
57 orrcs r2, r2, #0xe0000000
\r
61 orr r2, r2, r2, lsr #3
\r
66 .global vidConvCpyRGB32 @ void *to, void *from, int pixels
\r
69 stmfd sp!, {r4-r7,lr}
\r
71 mov r12, r2, lsr #3 @ repeats
\r
86 ldmfd sp!, {r4-r7,lr}
\r
90 .global vidConvCpyRGB32sh @ void *to, void *from, int pixels
\r
93 stmfd sp!, {r4-r7,lr}
\r
95 mov r12, r2, lsr #3 @ repeats
\r
110 ldmfd sp!, {r4-r7,lr}
\r
114 .global vidConvCpyRGB32hi @ void *to, void *from, int pixels
\r
117 stmfd sp!, {r4-r7,lr}
\r
119 mov r12, r2, lsr #3 @ repeats
\r
120 mov lr, #0x00e00000
\r
121 orr lr, lr, #0x00e0
\r
133 ldmfd sp!, {r4-r7,lr}
\r
137 @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
\r
140 @ mode2 blitter for 40 cols
\r
141 .global vidCpyM2_40col @ void *dest, void *src
\r
144 stmfd sp!, {r4-r6,lr}
\r
146 mov r12, #224 @ lines
\r
149 vidCpyM2_40_loop_out:
\r
157 bne vidCpyM2_40_loop
\r
160 bne vidCpyM2_40_loop_out
\r
162 ldmfd sp!, {r4-r6,lr}
\r
166 @ mode2 blitter for 32 cols
\r
167 .global vidCpyM2_32col @ void *dest, void *src
\r
170 stmfd sp!, {r4-r6,lr}
\r
172 mov r12, #224 @ lines
\r
176 vidCpyM2_32_loop_out:
\r
184 bne vidCpyM2_32_loop
\r
188 bne vidCpyM2_32_loop_out
\r
190 ldmfd sp!, {r4-r6,lr}
\r
194 @ mode2 blitter for 32 cols with no borders
\r
195 .global vidCpyM2_32col_nobord @ void *dest, void *src
\r
197 vidCpyM2_32col_nobord:
\r
198 stmfd sp!, {r4-r6,lr}
\r
200 mov r12, #224 @ lines
\r
202 b vidCpyM2_32_loop_out
\r
205 .global spend_cycles @ c
\r
208 mov r0, r0, lsr #2 @ 4 cycles/iteration
\r
209 sub r0, r0, #2 @ entry/exit/init
\r