rm unused file
[picodrive.git] / platform / uiq3 / engine / blit.s
CommitLineData
ca482e5d 1@ vim:filetype=armasm\r
cc68a136 2@ some color conversion and blitting routines\r
3\r
4@ (c) Copyright 2006, notaz\r
5@ All Rights Reserved\r
6\r
3823d229 7.include "port_config.s"\r
8\r
cc68a136 9\r
10@ Convert 0000bbb0 ggg0rrr0 0000bbb0 ggg0rrr0\r
11@ to 00000000 rrr00000 ggg00000 bbb00000 ...\r
12\r
13@ lr = 0x00e000e0, out: r3=lower_pix, r2=higher_pix; trashes rin\r
14@ if sh==2, r8=0x00404040 (sh!=0 destroys flags!)\r
15.macro convRGB32_2 rin sh=0\r
16 and r2, lr, \rin, lsr #4 @ blue\r
17 and r3, \rin, lr\r
18 orr r2, r2, r3, lsl #8 @ g0b0g0b0\r
19\r
20 mov r3, r2, lsl #16 @ g0b00000\r
21 and \rin,lr, \rin, ror #12 @ 00r000r0 (reversed)\r
22 orr r3, r3, \rin, lsr #16 @ g0b000r0\r
23.if \sh == 1\r
24 mov r3, r3, ror #17 @ shadow mode\r
25.elseif \sh == 2\r
26 adds r3, r3, #0x40000000 @ green\r
27 orrcs r3, r3, #0xe0000000\r
28 mov r3, r3, ror #8\r
29 adds r3, r3, #0x40000000\r
30 orrcs r3, r3, #0xe0000000\r
31 mov r3, r3, ror #16\r
32 adds r3, r3, #0x40000000\r
33 orrcs r3, r3, #0xe0000000\r
34 mov r3, r3, ror #24\r
35 orr r3, r3, r3, lsr #3\r
36.else\r
37 mov r3, r3, ror #16 @ r3=low\r
38 orr r3, r3, r3, lsr #3\r
39.endif\r
40\r
41 str r3, [r0], #4\r
42\r
43 mov r2, r2, lsr #16\r
44 orr r2, r2, \rin, lsl #16\r
45.if \sh == 1\r
46 mov r2, r2, lsr #1\r
47.elseif \sh == 2\r
48 mov r2, r2, ror #8\r
49 adds r2, r2, #0x40000000 @ blue\r
50 orrcs r2, r2, #0xe0000000\r
51 mov r2, r2, ror #8\r
52 adds r2, r2, #0x40000000\r
53 orrcs r2, r2, #0xe0000000\r
54 mov r2, r2, ror #8\r
55 adds r2, r2, #0x40000000\r
56 orrcs r2, r2, #0xe0000000\r
57 mov r2, r2, ror #8\r
58 orr r2, r2, r2, lsr #3\r
59.else\r
60 orr r2, r2, r2, lsr #3\r
61.endif\r
62\r
63 str r2, [r0], #4\r
64.endm\r
65\r
66\r
67.global vidConvCpyRGB32 @ void *to, void *from, int pixels\r
68\r
69vidConvCpyRGB32:\r
70 stmfd sp!, {r4-r7,lr}\r
71\r
72 mov r12, r2, lsr #3 @ repeats\r
73 mov lr, #0x00e00000\r
74 orr lr, lr, #0x00e0\r
75\r
76.loopRGB32:\r
77 subs r12, r12, #1\r
78\r
79 ldmia r1!, {r4-r7}\r
80 convRGB32_2 r4\r
81 convRGB32_2 r5\r
82 convRGB32_2 r6\r
83 convRGB32_2 r7\r
84\r
85 bgt .loopRGB32\r
86\r
87 ldmfd sp!, {r4-r7,lr}\r
88 bx lr\r
89\r
90\r
91.global vidConvCpyRGB32sh @ void *to, void *from, int pixels\r
92\r
93vidConvCpyRGB32sh:\r
94 stmfd sp!, {r4-r7,lr}\r
95\r
96 mov r12, r2, lsr #3 @ repeats\r
97 mov lr, #0x00e00000\r
98 orr lr, lr, #0x00e0\r
99\r
100.loopRGB32sh:\r
101 subs r12, r12, #1\r
102\r
103 ldmia r1!, {r4-r7}\r
104 convRGB32_2 r4, 1\r
105 convRGB32_2 r5, 1\r
106 convRGB32_2 r6, 1\r
107 convRGB32_2 r7, 1\r
108\r
109 bgt .loopRGB32sh\r
110\r
111 ldmfd sp!, {r4-r7,lr}\r
112 bx lr\r
113\r
114\r
115.global vidConvCpyRGB32hi @ void *to, void *from, int pixels\r
116\r
117vidConvCpyRGB32hi:\r
118 stmfd sp!, {r4-r7,lr}\r
119\r
120 mov r12, r2, lsr #3 @ repeats\r
121 mov lr, #0x00e00000\r
122 orr lr, lr, #0x00e0\r
123\r
124.loopRGB32hi:\r
125 ldmia r1!, {r4-r7}\r
126 convRGB32_2 r4, 2\r
127 convRGB32_2 r5, 2\r
128 convRGB32_2 r6, 2\r
129 convRGB32_2 r7, 2\r
130\r
131 subs r12, r12, #1\r
132 bgt .loopRGB32hi\r
133\r
134 ldmfd sp!, {r4-r7,lr}\r
135 bx lr\r
136\r
137\r
138@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
139\r
140@ -------- M2 stuff ---------\r
141/*\r
142.global vidConvCpy_90 @ void *to, void *from, int width\r
143\r
144vidConvCpy_90:\r
145 stmfd sp!, {r4-r10,lr}\r
146\r
147 mov lr, #0x00F00000\r
148 orr lr, lr, #0x00F0\r
149\r
150 mov r12, #224/4 @ row counter\r
151 mov r10, r2, lsl #2 @ we do 2 pixel wide copies\r
152\r
153 add r8, r0, #256*4 @ parallel line\r
154 add r1, r1, #0x23000\r
155 add r1, r1, #0x00B80 @ r1+=328*223*2+8*2\r
156 mov r9, r1\r
157\r
158 mov r4, #0 @ fill bottom border\r
159 mov r5, #0\r
160 mov r6, #0\r
161 mov r7, #0\r
162 stmia r0!, {r4-r7}\r
163 stmia r0!, {r4-r7}\r
164 stmia r8!, {r4-r7}\r
165 stmia r8!, {r4-r7}\r
166\r
167.loopM2RGB32_90:\r
168 subs r12, r12, #1\r
169\r
170 @ at first this loop was written differently: src pixels were fetched with ldm's and\r
171 @ dest was not sequential. It ran nearly 2 times slower. It seems it is very important\r
172 @ to do sequential memory access on those items, which we have more (to offload addressing bus?).\r
173\r
174 ldr r4, [r1], #-328*2\r
175 ldr r5, [r1], #-328*2\r
176 ldr r6, [r1], #-328*2\r
177 ldr r7, [r1], #-328*2\r
178\r
179 convRGB32_2 r4, 1\r
180 convRGB32_2 r5, 1\r
181 convRGB32_2 r6, 1\r
182 convRGB32_2 r7, 1\r
183\r
184 str r4, [r8], #4\r
185 str r5, [r8], #4\r
186 str r6, [r8], #4\r
187 str r7, [r8], #4\r
188\r
189 bne .loopM2RGB32_90\r
190\r
191 mov r4, #0 @ top border\r
192 mov r5, #0\r
193 mov r6, #0\r
194 stmia r0!, {r4-r6,r12}\r
195 stmia r0!, {r4-r6,r12}\r
196 stmia r8!, {r4-r6,r12}\r
197 stmia r8!, {r4-r6,r12}\r
198\r
199 subs r10, r10, #1\r
200 ldmeqfd sp!, {r4-r10,pc} @ return\r
201\r
202 add r0, r8, #16*4 @ set new dst pointer\r
203 add r8, r0, #256*4\r
204 add r9, r9, #2*2 @ fix src pointer\r
205 mov r1, r9\r
206\r
207 stmia r0!, {r4-r6,r12} @ bottom border\r
208 stmia r0!, {r4-r6,r12}\r
209 stmia r8!, {r4-r6,r12}\r
210 stmia r8!, {r4-r6,r12}\r
211\r
212 mov r12, #224/4 @ restore row counter\r
213 b .loopM2RGB32_90\r
214\r
215\r
216\r
217@ converter for vidConvCpy_270\r
218@ lr = 0x00F000F0, out: r3=lower_pix, r2=higher_pix; trashes rin\r
219.macro convRGB32_3 rin\r
220 and r2, lr, \rin, lsr #4 @ blue\r
221 and r3, \rin, lr\r
222 orr r2, r2, r3, lsl #8 @ g0b0g0b0\r
223\r
224 mov r3, r2, lsl #16 @ g0b00000\r
225 and \rin,lr, \rin, ror #12 @ 00r000r0 (reversed)\r
226 orr r3, r3, \rin, lsr #16 @ g0b000r0\r
227\r
228 mov r2, r2, lsr #16\r
229 orr r2, r2, \rin, lsl #16\r
230 str r2, [r0], #4\r
231\r
232 mov \rin,r3, ror #16 @ r3=low\r
233.endm\r
234*/\r
235@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
236\r
237\r
238@ takes byte-sized pixels from r3-r6, fetches from pal and stores to r7,r8,r10,lr\r
239@ r2=pal\r
240.macro mode2_4pix shift\r
241 and r7, r11, r3, lsr #\shift\r
242 ldr r7, [r2, r7, lsl #2]\r
243\r
244 and r8, r11, r4, lsr #\shift\r
245 ldr r8, [r2, r8, lsl #2]\r
246\r
247 and r10,r11, r5, lsr #\shift\r
248 ldr r10,[r2, r10,lsl #2]\r
249\r
250 and lr, r11, r6, lsr #\shift\r
251 ldr lr, [r2, lr, lsl #2]\r
252.endm\r
253\r
254@ r2=pal, r11=0xff\r
255.macro mode2_4pix_getpix0 dreg sreg\r
256 and \dreg, r11, \sreg\r
257 ldr \dreg, [r2, \dreg, lsl #2]\r
258.endm\r
259\r
260.macro mode2_4pix_getpix1 dreg sreg\r
261 and \dreg, r11, \sreg, lsr #8\r
262 ldr \dreg, [r2, \dreg, lsl #2]\r
263.endm\r
264\r
265.macro mode2_4pix_getpix2 dreg sreg\r
266 and \dreg, r11, \sreg, lsr #16\r
267 ldr \dreg, [r2, \dreg, lsl #2]\r
268.endm\r
269\r
270.macro mode2_4pix_getpix3 dreg sreg\r
271 and \dreg, r11, \sreg, lsr #24\r
272 ldr \dreg, [r2, \dreg, lsl #2]\r
273.endm\r
274\r
275@ takes byte-sized pixels from reg, fetches from pal and stores to r3-r6\r
276@ r11=0xFF, r2=pal\r
277.macro mode2_4pix2_0 reg\r
278 mode2_4pix_getpix0 r3, \reg\r
279 mode2_4pix_getpix1 r4, \reg\r
280 mode2_4pix_getpix2 r5, \reg\r
281 mode2_4pix_getpix3 r6, \reg\r
282.endm\r
283\r
284@ ...\r
285.macro mode2_4pix2_180 reg\r
286 mode2_4pix_getpix3 r3, \reg\r
287 mode2_4pix_getpix2 r4, \reg\r
288 mode2_4pix_getpix1 r5, \reg\r
289 mode2_4pix_getpix0 r6, \reg\r
290.endm\r
291\r
292@ takes byte-sized pixels from reg, fetches from pal and stores to r3-r5\r
293@ r11=0xFF, r2=pal, r10=0xfcfcfc, r6=tmp\r
294.macro mode2_4pix_to3 reg is180\r
295.if \is180\r
296 mode2_4pix_getpix3 r3, \reg\r
297 mode2_4pix_getpix2 r4, \reg\r
298.else\r
299 mode2_4pix_getpix0 r3, \reg @ gathering loads cause a weird-hang\r
300 mode2_4pix_getpix1 r4, \reg\r
301.endif\r
302\r
303 sub r3, r3, r3, lsr #2 @ r3 *= 0.75\r
304 add r3, r3, r4, lsr #2 @ r3 += r4 * 0.25\r
305 and r3, r3, r10\r
306\r
307.if \is180\r
308 mode2_4pix_getpix1 r5, \reg\r
309 mode2_4pix_getpix0 r6, \reg\r
310.else\r
311 mode2_4pix_getpix2 r5, \reg\r
312 mode2_4pix_getpix3 r6, \reg\r
313.endif\r
314\r
315 mov r4, r4, lsr #1\r
316 add r4, r4, r5, lsr #1 @ r4 = (r4 + r5) / 2;\r
317@ and r4, r4, r10\r
318 sub r6, r6, r6, lsr #2 @ r6 *= 0.75\r
319 add r5, r6, r5, lsr #2 @ r5 = r6 + r5 * 0.25\r
320 and r5, r5, r10\r
321.endm\r
322\r
323\r
324@ void *to, void *from, void *pal, int width\r
325.macro vidConvCpyM2_landscape is270\r
326 stmfd sp!, {r4-r11,lr}\r
327\r
328 mov r11, #0xff\r
329\r
330 mov r12, #(224/4-1)<<16 @ row counter\r
331 orr r12, r12, r3, lsl #1 @ we do 4 pixel wide copies (right to left)\r
332\r
333.if \is270\r
334 add r1, r1, #324\r
335.else\r
336 add r1, r1, #0x11c00\r
337 add r1, r1, #0x00308 @ 328*224+8\r
338.endif\r
339 mov r9, r1\r
340\r
341 mov r3, #0 @ fill top border\r
342 mov r4, #0\r
343 mov r5, #0\r
344 mov r6, #0\r
345 stmia r0!, {r3-r6}\r
346 stmia r0!, {r3-r6}\r
3823d229 347 add r7, r0, #(240+BORDER_R)*4-8*4\r
cc68a136 348 stmia r7!, {r3-r6}\r
349 stmia r7!, {r3-r6}\r
3823d229 350 add r7, r7, #(240+BORDER_R)*4-8*4\r
cc68a136 351 stmia r7!, {r3-r6}\r
352 stmia r7!, {r3-r6}\r
3823d229 353 add r7, r7, #(240+BORDER_R)*4-8*4\r
cc68a136 354 stmia r7!, {r3-r6}\r
355 stmia r7!, {r3-r6}\r
356\r
3570: @ .loopM2RGB32_270:\r
358 subs r12, r12, #1<<16\r
359\r
360.if \is270\r
361 ldr r3, [r1], #328\r
362 ldr r4, [r1], #328\r
363 ldr r5, [r1], #328\r
364 ldr r6, [r1], #328\r
365.else\r
366 ldr r3, [r1, #-328]!\r
367 ldr r4, [r1, #-328]!\r
368 ldr r5, [r1, #-328]!\r
369 ldr r6, [r1, #-328]!\r
370.endif\r
371\r
372.if \is270\r
373 mode2_4pix 24\r
374.else\r
375 mode2_4pix 0\r
376.endif\r
377 stmia r0, {r7,r8,r10,lr}\r
3823d229 378 add r0, r0, #(240+BORDER_R)*4\r
cc68a136 379\r
380.if \is270\r
381 mode2_4pix 16\r
382.else\r
383 mode2_4pix 8\r
384.endif\r
385 stmia r0, {r7,r8,r10,lr}\r
3823d229 386 add r0, r0, #(240+BORDER_R)*4\r
cc68a136 387\r
388.if \is270\r
389 mode2_4pix 8\r
390.else\r
391 mode2_4pix 16\r
392.endif\r
393 stmia r0, {r7,r8,r10,lr}\r
3823d229 394 add r0, r0, #(240+BORDER_R)*4\r
cc68a136 395\r
396.if \is270\r
397 mode2_4pix 0\r
398.else\r
399 mode2_4pix 24\r
400.endif\r
401 stmia r0!,{r7,r8,r10,lr}\r
3823d229 402 sub r0, r0, #(240+BORDER_R)*4*3\r
cc68a136 403\r
404 bpl 0b @ .loopM2RGB32_270\r
405\r
406 mov r3, #0 @ bottom border\r
407 mov r4, #0\r
408 mov r5, #0\r
409 mov r6, #0\r
410 stmia r0!, {r3-r6}\r
411 stmia r0!, {r3-r6}\r
3823d229 412 add r0, r0, #(240+BORDER_R)*4-8*4\r
cc68a136 413 stmia r0!, {r3-r6}\r
414 stmia r0!, {r3-r6}\r
3823d229 415 add r0, r0, #(240+BORDER_R)*4-8*4\r
cc68a136 416 stmia r0!, {r3-r6}\r
417 stmia r0!, {r3-r6}\r
3823d229 418 add r0, r0, #(240+BORDER_R)*4-8*4\r
cc68a136 419 stmia r0!, {r3-r6}\r
420 nop @ phone crashes if this is commented out. Do I stress it too much?\r
421 stmia r0!, {r3-r6}\r
422\r
423 add r12, r12, #1<<16\r
424 subs r12, r12, #1\r
425 ldmeqfd sp!, {r4-r11,pc} @ return\r
426\r
3823d229 427.if BORDER_R\r
428 add r0, r0, #BORDER_R*4\r
429.endif\r
cc68a136 430.if \is270\r
431 sub r9, r9, #4 @ fix src pointer\r
432.else\r
433 add r9, r9, #4\r
434.endif\r
435 mov r1, r9\r
436\r
437 stmia r0!, {r3-r6} @ top border\r
438 stmia r0!, {r3-r6}\r
3823d229 439 add r7, r0, #(240+BORDER_R)*4-8*4\r
cc68a136 440 stmia r7!, {r3-r6}\r
441 stmia r7!, {r3-r6}\r
3823d229 442 add r7, r7, #(240+BORDER_R)*4-8*4\r
cc68a136 443 stmia r7!, {r3-r6}\r
444 stmia r7!, {r3-r6}\r
3823d229 445 add r7, r7, #(240+BORDER_R)*4-8*4\r
cc68a136 446 stmia r7!, {r3-r6}\r
447 stmia r7!, {r3-r6}\r
448\r
449 orr r12, r12, #(224/4-1)<<16 @ restore row counter\r
450 b 0b @ .loopM2RGB32_270\r
451.endm\r
452\r
453\r
454.global vidConvCpy_90 @ void *to, void *from, void *pal, int width\r
455\r
456vidConvCpy_90:\r
457 vidConvCpyM2_landscape 0\r
458\r
459\r
460.global vidConvCpy_270 @ void *to, void *from, void *pal, int width\r
461\r
462vidConvCpy_270:\r
463 vidConvCpyM2_landscape 1\r
464\r
465\r
466.global vidConvCpy_center_0 @ void *to, void *from, void *pal\r
467\r
468vidConvCpy_center_0:\r
469 stmfd sp!, {r4-r6,r11,lr}\r
470\r
471 mov r11, #0xff\r
472 add r1, r1, #8 @ not border (centering 32col here)\r
473\r
474 mov r12, #(240/4-1)<<16\r
475 orr r12, r12, #224\r
476\r
477.loopRGB32_c0:\r
478 ldr lr, [r1], #4\r
479 subs r12, r12, #1<<16\r
480\r
481 mode2_4pix2_0 lr\r
482 stmia r0!, {r3-r6}\r
483 bpl .loopRGB32_c0\r
484\r
485 sub r12, r12, #1\r
486 adds r12, r12, #1<<16\r
487 ldmeqfd sp!, {r4-r6,r11,pc} @ return\r
3823d229 488.if BORDER_R\r
489 add r0, r0, #BORDER_R*4\r
490.endif\r
cc68a136 491 add r1, r1, #88\r
492 orr r12, #(240/4-1)<<16\r
493 b .loopRGB32_c0\r
494\r
495\r
496.global vidConvCpy_center_180 @ void *to, void *from, void *pal\r
497\r
498vidConvCpy_center_180:\r
499 stmfd sp!, {r4-r6,r11,lr}\r
500\r
501 mov r11, #0xff\r
502 add r1, r1, #0x11c00\r
503 add r1, r1, #0x002B8 @ #328*224-72\r
504\r
505 mov r12, #(240/4-1)<<16\r
506 orr r12, r12, #224\r
507\r
508.loopRGB32_c180:\r
509 ldr lr, [r1, #-4]!\r
510 subs r12, r12, #1<<16\r
511\r
512 mode2_4pix2_180 lr\r
513 stmia r0!, {r3-r6}\r
514 bpl .loopRGB32_c180\r
515\r
516 sub r12, r12, #1\r
517 adds r12, r12, #1<<16\r
518 ldmeqfd sp!, {r4-r6,r11,pc} @ return\r
3823d229 519.if BORDER_R\r
520 add r0, r0, #BORDER_R*4\r
521.endif\r
cc68a136 522 sub r1, r1, #88\r
523 orr r12, #(240/4-1)<<16\r
524 b .loopRGB32_c180\r
525\r
526\r
527@ note: the following code assumes that (pal[x] & 0x030303) == 0\r
528\r
529.global vidConvCpy_center2_40c_0 @ void *to, void *from, void *pal, int lines\r
530\r
531vidConvCpy_center2_40c_0:\r
532 stmfd sp!, {r4-r6,r10,r11,lr}\r
533\r
534 mov r11, #0xff\r
535 mov r10, #0xfc\r
536 orr r10, r10, lsl #8\r
537 orr r10, r10, lsl #8\r
538 add r1, r1, #8 @ border\r
539\r
540 mov r12, #(240/3-1)<<16\r
541 orr r12, r12, r3\r
542\r
543.loopRGB32_c2_40c_0:\r
544 ldr lr, [r1], #4\r
545 subs r12, r12, #1<<16\r
546\r
547 mode2_4pix_to3 lr, 0\r
548\r
549 stmia r0!, {r3-r5}\r
550 bpl .loopRGB32_c2_40c_0\r
551\r
552 sub r12, r12, #1\r
553 adds r12, r12, #1<<16\r
554 ldmeqfd sp!, {r4-r6,r10,r11,pc} @ return\r
3823d229 555.if BORDER_R\r
556 add r0, r0, #BORDER_R*4\r
557.endif\r
cc68a136 558 add r1, r1, #8\r
559 orr r12, #(240/3-1)<<16\r
560 b .loopRGB32_c2_40c_0\r
561\r
562\r
563.global vidConvCpy_center2_40c_180 @ void *to, void *from, void *pal, int lines\r
564\r
565vidConvCpy_center2_40c_180:\r
566 stmfd sp!, {r4-r6,r10,r11,lr}\r
567\r
568 mov r11, #0xff\r
569 mov r10, #0xfc\r
570 orr r10, r10, lsl #8\r
571 orr r10, r10, lsl #8\r
572\r
573 mov r4, #328\r
574 mla r1, r3, r4, r1\r
575@ add r1, r1, #0x11000\r
576@ add r1, r1, #0x00f00 @ #328*224\r
577\r
578 mov r12, #(240/3-1)<<16\r
579 orr r12, r12, r3\r
580\r
581.loop_c2_40c_180:\r
582 ldr lr, [r1, #-4]!\r
583 subs r12, r12, #1<<16\r
584\r
585 mode2_4pix_to3 lr, 1\r
586\r
587 stmia r0!, {r3-r5}\r
588 bpl .loop_c2_40c_180\r
589\r
590 sub r12, r12, #1\r
591 adds r12, r12, #1<<16\r
592 ldmeqfd sp!, {r4-r6,r10,r11,pc} @ return\r
3823d229 593.if BORDER_R\r
594 add r0, r0, #BORDER_R*4\r
595.endif\r
cc68a136 596 sub r1, r1, #8\r
597 orr r12, #(240/3-1)<<16\r
598 b .loop_c2_40c_180\r
599\r
600\r
601.global vidConvCpy_center2_32c_0 @ void *to, void *from, void *pal, int lines\r
602\r
603vidConvCpy_center2_32c_0:\r
604 stmfd sp!, {r4-r11,lr}\r
605\r
606 mov r10, #0xfc\r
607 orr r10, r10, lsl #8\r
608 orr r10, r10, lsl #8\r
609 mov r11, #0xff\r
610 add r1, r1, #8 @ border\r
611\r
612 mov r12, #(240/15-1)<<16\r
613 orr r12, r12, r3\r
614\r
615.loop_c2_32c_0:\r
616 ldmia r1!, {r7-r9,lr}\r
617 subs r12, r12, #1<<16\r
618\r
619 mode2_4pix2_0 r7\r
620 stmia r0!, {r3-r6}\r
621 mode2_4pix2_0 r8\r
622 stmia r0!, {r3-r6}\r
623 mode2_4pix2_0 r9\r
624 stmia r0!, {r3-r6}\r
625 mode2_4pix_to3 lr, 0\r
626 stmia r0!, {r3-r5}\r
627 bpl .loop_c2_32c_0\r
628\r
629 sub r12, r12, #1\r
630 adds r12, r12, #1<<16\r
631 ldmeqfd sp!, {r4-r11,pc} @ return\r
3823d229 632.if BORDER_R\r
633 add r0, r0, #BORDER_R*4\r
634.endif\r
cc68a136 635 add r1, r1, #64+8\r
636 orr r12, #(240/15-1)<<16\r
637 b .loop_c2_32c_0\r
638\r
639\r
640.global vidConvCpy_center2_32c_180 @ void *to, void *from, void *pal, int lines\r
641\r
642vidConvCpy_center2_32c_180:\r
643 stmfd sp!, {r4-r11,lr}\r
644\r
645 mov r10, #0xfc\r
646 orr r10, r10, lsl #8\r
647 orr r10, r10, lsl #8\r
648 mov r11, #0xff\r
649\r
650 mov r4, #328\r
651 mla r1, r3, r4, r1\r
652@ add r1, r1, #0x11000\r
653@ add r1, r1, #0x00f00 @ #328*224\r
654\r
655 mov r12, #(240/15-1)<<16\r
656 orr r12, r12, r3\r
657\r
658.loop_c2_32c_180:\r
659 ldmdb r1!, {r7-r9,lr}\r
660 subs r12, r12, #1<<16\r
661\r
662 mode2_4pix2_180 lr\r
663 stmia r0!, {r3-r6}\r
664 mode2_4pix2_180 r9\r
665 stmia r0!, {r3-r6}\r
666 mode2_4pix2_180 r8\r
667 stmia r0!, {r3-r6}\r
668 mode2_4pix_to3 r7, 1\r
669 stmia r0!, {r3-r5}\r
670 bpl .loop_c2_32c_180\r
671\r
672 sub r12, r12, #1\r
673 adds r12, r12, #1<<16\r
674 ldmeqfd sp!, {r4-r11,pc} @ return\r
3823d229 675.if BORDER_R\r
676 add r0, r0, #BORDER_R*4\r
677.endif\r
cc68a136 678 sub r1, r1, #64+8\r
679 orr r12, #(240/15-1)<<16\r
680 b .loop_c2_32c_180\r
681\r
682\r
683@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
684\r
685\r
686.global vidClear @ void *to, int lines\r
687\r
688vidClear:\r
689 stmfd sp!, {lr}\r
690 mov r12, #240/16-1\r
691 orr r12, r1, r12, lsl #16\r
692 mov r1, #0\r
693 mov r2, #0\r
694 mov r3, #0\r
695 mov lr, #0\r
696\r
697.loopVidClear:\r
698 subs r12, r12, #1<<16\r
699\r
700 stmia r0!, {r1-r3,lr}\r
701 stmia r0!, {r1-r3,lr}\r
702 stmia r0!, {r1-r3,lr}\r
703 stmia r0!, {r1-r3,lr}\r
704 bpl .loopVidClear\r
705\r
706 sub r12, r12, #1\r
707 adds r12, r12, #1<<16\r
708 ldmeqfd sp!, {pc} @ return\r
3823d229 709.if BORDER_R\r
710 add r0, r0, #BORDER_R*4\r
711.endif\r
cc68a136 712 orr r12, #(240/16-1)<<16\r
713 b .loopVidClear\r
714\r
ca482e5d 715@ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\r
716\r
717.equ EExecSetExceptionHandler, (90)\r
718\r
719.global my_SetExceptionHandler\r
720\r
721my_SetExceptionHandler:\r
722 mov ip, lr\r
723 swi EExecSetExceptionHandler\r
724\r