summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/target/coldfire/mpio/hd200/lcd-as-hd200.S84
1 files changed, 77 insertions, 7 deletions
diff --git a/firmware/target/coldfire/mpio/hd200/lcd-as-hd200.S b/firmware/target/coldfire/mpio/hd200/lcd-as-hd200.S
index 9709e210e2..a284896af7 100644
--- a/firmware/target/coldfire/mpio/hd200/lcd-as-hd200.S
+++ b/firmware/target/coldfire/mpio/hd200/lcd-as-hd200.S
@@ -125,16 +125,26 @@ lcd_mono_data:
125 .type lcd_grey_data,@function 125 .type lcd_grey_data,@function
126 126
127lcd_grey_data: 127lcd_grey_data:
128 lea.l (-6*4, %sp), %sp 128 lea.l (-8*4, %sp), %sp
129 movem.l %d2-%d5/%a2-%a3, (%sp) 129 movem.l %d2-%d7/%a2-%a3, (%sp) /* save some registers */
130 movem.l (6*4+4, %sp), %a0-%a2 /* values, phases, length */ 130 movem.l (8*4+4, %sp), %a0-%a2 /* values, phases, length */
131 add.l %a2, %a2 131 add.l %a2, %a2
132 lea.l (%a1, %a2.l*4), %a2 /* end address */ 132 lea.l (%a1, %a2.l*4), %a2 /* end address */
133 lea.l LCD_BASE_ADDRESS+2, %a3 /* LCD data port address */ 133 lea.l LCD_BASE_ADDRESS+2, %a3 /* LCD data port address */
134 moveq.l #24, %d4 /* shift count */ 134 moveq.l #24, %d4 /* shift count */
135 move.l #0x204081, %d5 /* bit shuffle factor */ 135 move.l #0x204081, %d5 /* bit shuffle factor */
136 136
137.ph_loop: 137 moveq.l #12, %d2
138 add.l %a1, %d2
139 and.l #0xfffffff0, %d2 /* first line bound */
140 cmp.l %d2, %a2 /* end address lower than first line bound? */
141 bhs.s 1f
142 move.l %a2, %d2 /* -> adjust end address of head loop */
1431:
144 cmp.l %a1, %d2
145 bls.s .g_head_tail_end
146
147.g_head_tail:
138 movem.l (%a1), %d0-%d1 /* fetch 8 pixel phases */ 148 movem.l (%a1), %d0-%d1 /* fetch 8 pixel phases */
139 149
140 move.l %d0, %d2 150 move.l %d0, %d2
@@ -159,11 +169,71 @@ lcd_grey_data:
159 addq.l #8, %a1 169 addq.l #8, %a1
160 170
161 move.w %d2, (%a3) /* transfer second LCD byte */ 171 move.w %d2, (%a3) /* transfer second LCD byte */
172
173.g_head_tail_end:
174 cmp.l %a1, %a2
175 bls.w .g_end
176 lea.l (-8, %a2), %a2
177 cmp.l %a1, %a2
178 bls.s .g_line_end
179
180.g_line_loop:
181 /* loop that utilize line transfers */
182 movem.l (%a1), %d0-%d3 /* fetch 2 * 8 pixels phases */
183
184 move.l %d0, %d6
185 and.l #0x80808080, %d6 /* %d6 = 0.......1.......2.......3....... */
186 eor.l %d6, %d0
187 add.l (%a0)+, %d0 /* add values to first 4 phases */
188
189 move.l %d1, %d7
190 and.l #0x80808080, %d7 /* %d7 = 4.......5.......6.......7....... */
191 eor.l %d7, %d1
192 add.l (%a0)+, %d1 /* add values to second 4 phases */
193
194 lsr.l #4, %d7 /* %d7 = ....4.......5.......6.......7... */
195 or.l %d7, %d6 /* %d6 = 0...4...1...5...2...6...3...7... */
196 mulu.l %d5, %d6 /* %d6 = 01234567123.567.23..67..3...7... */
197 not.l %d6 /* negate bits */
198 lsr.l %d4, %d6 /* %d6 = ........................01234567 */
199
200 move.w %d6, (%a3) /* transfer first LCD byte */
201 move.w %d6, (%a3) /* transfer second LCD byte */
202
203 move.l %d2, %d6
204 and.l #0x80808080, %d6 /* %d6 = 0.......1.......2.......3....... */
205 eor.l %d6, %d2
206 add.l (%a0)+, %d2 /* add values to first 4 phases */
207
208 move.l %d3, %d7
209 and.l #0x80808080, %d7 /* %d7 = 4.......5.......6.......7....... */
210 eor.l %d7, %d3
211 add.l (%a0)+, %d3 /* add values to second 4 phases */
212
213 lsr.l #4, %d7 /* %d7 = ....4.......5.......6.......7... */
214 or.l %d7, %d6 /* %d6 = 0...4...1...5...2...6...3...7... */
215 mulu.l %d5, %d6 /* %d6 = 01234567123.567.23..67..3...7... */
216 not.l %d6 /* negate bits */
217 lsr.l %d4, %d6 /* %d6 = ........................01234567 */
218
219 move.w %d6, (%a3) /* transfer first LCD byte */
220 move.w %d6, (%a3) /* transfer second LCD byte */
221
222 movem.l %d0-%d3, (%a1) /* store 2 * 8 new pixel phases */
223 lea.l (16, %a1), %a1 /* advance pointer */
224
162 cmp.l %a2, %a1 225 cmp.l %a2, %a1
163 bls.s .ph_loop 226 bls.s .g_line_loop
227
228.g_line_end:
229 lea.l (8, %a2), %a2
230 cmp.l %a1, %a2
231 bls.s .g_end
232 bra.w .g_head_tail
164 233
165 movem.l (%sp), %d2-%d5/%a2-%a3 234.g_end:
166 lea.l (6*4, %sp), %sp 235 movem.l (%sp), %d2-%d7/%a2-%a3
236 lea.l (8*4, %sp), %sp
167 rts 237 rts
168.grey_end: 238.grey_end:
169 .size lcd_grey_data,.grey_end-lcd_grey_data 239 .size lcd_grey_data,.grey_end-lcd_grey_data