A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
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* This program is free software; you can redistribute it and/or
19* modify it under the terms of the GNU General Public License
20* as published by the Free Software Foundation; either version 2
21* of the License, or (at your option) any later version.
22*
23* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
24* KIND, either express or implied.
25*
26****************************************************************************/
27
28#include "config.h"
29/* Plugins should not normally do this, but we need to check a macro, and
30 * plugin.h would confuse the assembler. */
31
32 .text
33 .global _grey_line1
34 .type _grey_line1, @function
35
36#if (LCD_PIXELFORMAT == VERTICAL_PACKING) \
37 || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)
38
39#if (LCD_DEPTH == 1) || (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED)
40#define GREY_BSIZE 8
41#elif LCD_DEPTH == 2
42#define GREY_BSIZE 4
43#endif
44
45/****************************************************************************
46 * void _grey_line1(int width,
47 * unsigned char *dst,
48 * const unsigned char *src,
49 * const unsigned char *lut);
50 */
51
52_grey_line1:
53 lea.l (-2*4, %sp), %sp
54 movem.l %d2/%a2, (%sp)
55 movem.l (2*4+4, %sp), %d2/%a0-%a2
56 clr.l %d0
57
58 move.l %a1, %d1
59 and.l #1, %d1
60 beq.s .p1_h_end
61
62 move.b (%a1)+, %d0
63 move.b (%d0.l, %a2), (%a0)
64 addq.l #GREY_BSIZE, %a0
65 subq.l #1, %d2
66.p1_h_end:
67
68 cmp.l #2, %d2
69 blo.s .p2_t_end
70 move.l %a1, %d1
71 and.l #2, %d1
72 beq.s .p2_h_end
73
74 move.w (%a1)+, %d1
75 move.w %d1, %d0
76 lsr.l #8, %d0
77 move.b (%d0.l, %a2), (%a0)
78 addq.l #GREY_BSIZE, %a0
79 move.b %d1, %d0
80 move.b (%d0.l, %a2), (%a0)
81 addq.l #GREY_BSIZE, %a0
82 subq.l #2, %d2
83.p2_h_end:
84
85 subq.l #4, %d2
86 blo.s .p4_end
87
88.p4_loop:
89 move.l (%a1)+, %d1
90 swap %d1
91 move.w %d1, %d0
92 lsr.l #8, %d0
93 move.b (%d0.l, %a2), (%a0)
94 addq.l #GREY_BSIZE, %a0
95 move.b %d1, %d0
96 move.b (%d0.l, %a2), (%a0)
97 addq.l #GREY_BSIZE, %a0
98 swap %d1
99 move.w %d1, %d0
100 lsr.l #8, %d0
101 move.b (%d0.l, %a2), (%a0)
102 addq.l #GREY_BSIZE, %a0
103 move.b %d1, %d0
104 move.b (%d0.l, %a2), (%a0)
105 addq.l #GREY_BSIZE, %a0
106 subq.l #4, %d2
107 bhs.s .p4_loop
108
109 /* No need to correct the count, we're only testing bits from now on. */
110
111.p4_end:
112 btst.l #1, %d2
113 beq.s .p2_t_end
114
115 move.w (%a1)+, %d1
116 move.w %d1, %d0
117 lsr.l #8, %d0
118 move.b (%d0.l, %a2), (%a0)
119 addq.l #GREY_BSIZE, %a0
120 move.b %d1, %d0
121 move.b (%d0.l, %a2), (%a0)
122 addq.l #GREY_BSIZE, %a0
123.p2_t_end:
124
125 btst.l #0, %d2
126 beq.s .p1_t_end
127
128 move.b (%a1)+, %d0
129 move.b (%d0.l, %a2), (%a0)
130.p1_t_end:
131
132 movem.l (%sp), %d2/%a2
133 lea.l (2*4, %sp), %sp
134 rts
135 .size _grey_line1, . - _grey_line1
136
137#endif