psxbios: assorted changes
[pcsx_rearmed.git] / frontend / blit320.s
... / ...
CommitLineData
1/*
2 * (C) GraÅžvydas "notaz" Ignotas, 2011
3 *
4 * This work is licensed under the terms of any of these licenses
5 * (at your option):
6 * - GNU GPL, version 2 or later.
7 * - GNU LGPL, version 2.1 or later.
8 * See the COPYING file in the top-level directory.
9 *
10 * This code tries to make better use of pollux/arm926 store buffer
11 * by fusing words instead of using strhs.
12 */
13
14.text
15.align 2
16
17.macro lhw_str rl rt
18 lsl \rl, #16
19 lsr \rl, #16
20 orr \rl, \rt, lsl #16
21 str \rl, [r0], #4
22.endm
23
24.global blit320_640
25blit320_640:
26 stmfd sp!, {r4-r8,lr}
27 mov r12, #40
28 bic r1, r1, #3
290:
30 ldmia r1!, {r2-r8,lr}
31 lhw_str r2, r3
32 lhw_str r4, r5
33 lhw_str r6, r7
34 subs r12, #1
35 lhw_str r8, lr
36 bgt 0b
37 ldmfd sp!, {r4-r8,pc}
38
39
40.global blit320_512
41blit320_512:
42 stmfd sp!, {r4-r8,lr}
43 mov r12, #32
44 bic r1, r1, #3
450:
46 ldmia r1!, {r2-r8,lr}
47 lsl r2, #16
48 lsr r2, #16
49 orr r2, r3, lsl #16
50 str r2, [r0], #4 @ 0,2
51 lsr r4, #16
52 lsr r3, #16
53 orr r3, r4, lsl #16
54 str r3, [r0], #4 @ 3,5
55 lsr r5, #16
56 orr r5, r6, lsl #16
57 str r5, [r0], #4 @ 7,8
58 lsr r8, #16
59 lsr lr, #16
60 str r7, [r0], #4 @ 10,11
61 orr r8, lr, lsl #16
62 subs r12, #1
63 str r8, [r0], #4 @ 13,15
64 bgt 0b
65 ldmfd sp!, {r4-r8,pc}
66
67
68.macro unaligned_str rl rt
69 lsr \rl, #16
70 orr \rl, \rt, lsl #16
71 str \rl, [r0], #4
72.endm
73
74.global blit320_368
75blit320_368:
76 stmfd sp!, {r4-r8,lr}
77 mov r12, #23
78 bic r1, r1, #3
790:
80 ldmia r1!, {r2-r8,lr}
81 unaligned_str r2, r3 @ 1,2
82 unaligned_str r3, r4 @ 3,4
83 unaligned_str r4, r5 @ 5,6
84 subs r12, #1
85 stmia r0!, {r6-r8,lr} @ 8-15
86 bgt 0b
87 ldmfd sp!, {r4-r8,pc}
88
89
90@ vim:filetype=armasm