aboutsummaryrefslogtreecommitdiff
path: root/frontend/blit320.s
blob: 201fdea60c106a286383f757f90393ea738a9768 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 * (C) Gražvydas "notaz" Ignotas, 2011
 *
 * This work is licensed under the terms of any of these licenses
 * (at your option):
 *  - GNU GPL, version 2 or later.
 *  - GNU LGPL, version 2.1 or later.
 * See the COPYING file in the top-level directory.
 *
 * This code tries to make better use of pollux/arm926 store buffer
 * by fusing words instead of using strhs.
 */

.text
.align 2

.macro lhw_str rl rt
    lsl     \rl, #16
    lsr     \rl, #16
    orr     \rl, \rt, lsl #16
    str     \rl, [r0], #4
.endm

.global blit320_640
blit320_640:
    stmfd   sp!, {r4-r8,lr}
    mov     r12, #40
0:
    ldmia   r1!, {r2-r8,lr}
    lhw_str r2, r3
    lhw_str r4, r5
    lhw_str r6, r7
    subs    r12, #1
    lhw_str r8, lr
    bgt     0b
    ldmfd   sp!, {r4-r8,pc}


.global blit320_512
blit320_512:
    stmfd   sp!, {r4-r8,lr}
    mov     r12, #32
0:
    ldmia   r1!, {r2-r8,lr}
    lsl     r2, #16
    lsr     r2, #16
    orr     r2, r3, lsl #16
    str     r2, [r0], #4         @ 0,2
    lsr     r4, #16
    lsr     r3, #16
    orr     r3, r4, lsl #16
    str     r3, [r0], #4         @ 3,5
    lsr     r5, #16
    orr     r5, r6, lsl #16
    str     r5, [r0], #4         @ 7,8
    lsr     r8, #16
    lsr     lr, #16
    str     r7, [r0], #4         @ 10,11
    orr     r8, lr, lsl #16
    subs    r12, #1
    str     r8, [r0], #4         @ 13,15
    bgt     0b
    ldmfd   sp!, {r4-r8,pc}


.macro unaligned_str rl rt
    lsr     \rl, #16
    orr     \rl, \rt, lsl #16
    str     \rl, [r0], #4
.endm

.global blit320_368
blit320_368:
    stmfd   sp!, {r4-r8,lr}
    mov     r12, #23
0:
    ldmia   r1!, {r2-r8,lr}
    unaligned_str r2, r3         @ 1,2
    unaligned_str r3, r4         @ 3,4
    unaligned_str r4, r5         @ 5,6
    subs    r12, #1
    stmia   r0!, {r6-r8,lr}      @ 8-15
    bgt     0b
    ldmfd   sp!, {r4-r8,pc}


@ vim:filetype=armasm