summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/grey_coldfire.S
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lib/grey_coldfire.S')
-rwxr-xr-xapps/plugins/lib/grey_coldfire.S128
1 files changed, 128 insertions, 0 deletions
diff --git a/apps/plugins/lib/grey_coldfire.S b/apps/plugins/lib/grey_coldfire.S
new file mode 100755
index 0000000000..cf66ca66b6
--- /dev/null
+++ b/apps/plugins/lib/grey_coldfire.S
@@ -0,0 +1,128 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id: grey_draw.c 16080 2008-01-13 18:39:09Z amiconn $
9*
10* New greyscale framework
11* Coldfire assembler routines
12*
13* This is a generic framework to display 129 shades of grey on low-depth
14* bitmap LCDs (Archos b&w, Iriver & Ipod 4-grey) within plugins.
15*
16* Copyright (C) 2008 Jens Arnold
17*
18* All files in this archive are subject to the GNU General Public License.
19* See the file COPYING in the source tree root for full license agreement.
20*
21* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
22* KIND, either express or implied.
23*
24****************************************************************************/
25
26#include "config.h"
27/* Plugins should not normally do this, but we need to check a macro, and
28 * plugin.h would confuse the assembler. */
29
30 .text
31 .global _grey_line1
32 .type _grey_line1, @function
33
34#if (LCD_PIXELFORMAT == VERTICAL_PACKING) && (LCD_DEPTH == 2)
35
36/****************************************************************************
37 * void _grey_line1(int width,
38 * unsigned char *dst,
39 * const unsigned char *src,
40 * const unsigned char *lut);
41 */
42
43_grey_line1:
44 lea.l (-2*4, %sp), %sp
45 movem.l %d2/%a2, (%sp)
46 movem.l (2*4+4, %sp), %d2/%a0-%a2
47 clr.l %d0
48
49 move.l %a1, %d1
50 and.l #1, %d1
51 beq.s .p1_h_end
52
53 move.b (%a1)+, %d0
54 move.b (%d0.l, %a2), (%a0)
55 addq.l #4, %a0
56 subq.l #1, %d2
57.p1_h_end:
58
59 cmp.l #2, %d2
60 blo.s .p2_t_end
61 move.l %a1, %d1
62 and.l #2, %d1
63 beq.s .p2_h_end
64
65 move.w (%a1)+, %d1
66 move.w %d1, %d0
67 lsr.l #8, %d0
68 move.b (%d0.l, %a2), (%a0)
69 addq.l #4, %a0
70 move.b %d1, %d0
71 move.b (%d0.l, %a2), (%a0)
72 addq.l #4, %a0
73 subq.l #2, %d2
74.p2_h_end:
75
76 subq.l #4, %d2
77 blo.s .p4_end
78
79.p4_loop:
80 move.l (%a1)+, %d1
81 swap %d1
82 move.w %d1, %d0
83 lsr.l #8, %d0
84 move.b (%d0.l, %a2), (%a0)
85 addq.l #4, %a0
86 move.b %d1, %d0
87 move.b (%d0.l, %a2), (%a0)
88 addq.l #4, %a0
89 swap %d1
90 move.w %d1, %d0
91 lsr.l #8, %d0
92 move.b (%d0.l, %a2), (%a0)
93 addq.l #4, %a0
94 move.b %d1, %d0
95 move.b (%d0.l, %a2), (%a0)
96 addq.l #4, %a0
97 subq.l #4, %d2
98 bhs.s .p4_loop
99
100.p4_end:
101 addq.l #4, %d2
102 cmp.l #2, %d2
103 blo.s .p2_t_end
104
105 move.w (%a1)+, %d1
106 move.w %d1, %d0
107 lsr.l #8, %d0
108 move.b (%d0.l, %a2), (%a0)
109 addq.l #4, %a0
110 move.b %d1, %d0
111 move.b (%d0.l, %a2), (%a0)
112 addq.l #4, %a0
113 subq.l #2, %d2
114.p2_t_end:
115
116 tst.l %d2
117 beq.s .p1_t_end
118
119 move.b (%a1)+, %d0
120 move.b (%d0.l, %a2), (%a0)
121.p1_t_end:
122
123 movem.l (%sp), %d2/%a2
124 lea.l (2*4, %sp), %sp
125 rts
126 .size _grey_line1, . - _grey_line1
127
128#endif