summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iaudio/m5/lcd-as-m5.S
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/coldfire/iaudio/m5/lcd-as-m5.S')
-rw-r--r--firmware/target/coldfire/iaudio/m5/lcd-as-m5.S72
1 files changed, 41 insertions, 31 deletions
diff --git a/firmware/target/coldfire/iaudio/m5/lcd-as-m5.S b/firmware/target/coldfire/iaudio/m5/lcd-as-m5.S
index 0ec98e4589..0ec4f4b032 100644
--- a/firmware/target/coldfire/iaudio/m5/lcd-as-m5.S
+++ b/firmware/target/coldfire/iaudio/m5/lcd-as-m5.S
@@ -87,10 +87,14 @@ lcd_write_data:
87 .global lcd_grey_data 87 .global lcd_grey_data
88 .type lcd_grey_data,@function 88 .type lcd_grey_data,@function
89 89
90 /* The main loop assumes the buffers are in SDRAM. Otherwise the LCD
91 * controller timing won't be met at 124 MHz and graphical glitches
92 * will occur. */
93
90lcd_grey_data: 94lcd_grey_data:
91 lea.l (-9*4, %sp), %sp 95 lea.l (-10*4, %sp), %sp
92 movem.l %d2-%d5/%a2-%a6, (%sp) /* free some registers */ 96 movem.l %d2-%d6/%a2-%a6, (%sp) /* free some registers */
93 movem.l (9*4+4, %sp), %a0-%a2 /* values, phases, length */ 97 movem.l (10*4+4, %sp), %a0-%a2 /* values, phases, length */
94 lea.l (%a1, %a2.l*4), %a2 /* end address */ 98 lea.l (%a1, %a2.l*4), %a2 /* end address */
95 lea 0xf0008002, %a3 /* LCD data port */ 99 lea 0xf0008002, %a3 /* LCD data port */
96 100
@@ -128,9 +132,9 @@ lcd_grey_data:
128 bhi.s .g_hloop 132 bhi.s .g_hloop
129 133
130.g_lloop: 134.g_lloop:
131 movem.l (%a1), %d2-%d5 135 movem.l (%a1), %d2-%d5 /* fetch 4 blocks of 4 pixel phases each */
132 136
133 bclr.l #31, %d2 137 bclr.l #31, %d2 /* calculate first pixel block */
134 seq.b %d0 138 seq.b %d0
135 lsl.l #2, %d0 139 lsl.l #2, %d0
136 bclr.l #23, %d2 140 bclr.l #23, %d2
@@ -142,23 +146,23 @@ lcd_grey_data:
142 bclr.l #7, %d2 146 bclr.l #7, %d2
143 seq.b %d0 147 seq.b %d0
144 lsr.l #6, %d0 148 lsr.l #6, %d0
145 move.w %d0, (%a3)
146 149
147 bclr.l #31, %d3 150 move.w %d0, (%a3) /* write first block to LCD */
148 seq.b %d0 151
149 lsl.l #2, %d0 152 bclr.l #31, %d3 /* calculate second pixel block */
153 seq.b %d6
154 lsl.l #2, %d6
150 bclr.l #23, %d3 155 bclr.l #23, %d3
151 seq.b %d0 156 seq.b %d6
152 lsl.l #2, %d0 157 lsl.l #2, %d6
153 bclr.l #15, %d3 158 bclr.l #15, %d3
154 seq.b %d0 159 seq.b %d6
155 lsl.l #2, %d0 160 lsl.l #2, %d6
156 bclr.l #7, %d3 161 bclr.l #7, %d3
157 seq.b %d0 162 seq.b %d6
158 lsr.l #6, %d0 163 lsr.l #6, %d6
159 move.w %d0, (%a3) 164
160 165 bclr.l #31, %d4 /* calculate third pixel block */
161 bclr.l #31, %d4
162 seq.b %d0 166 seq.b %d0
163 lsl.l #2, %d0 167 lsl.l #2, %d0
164 bclr.l #23, %d4 168 bclr.l #23, %d4
@@ -170,9 +174,15 @@ lcd_grey_data:
170 bclr.l #7, %d4 174 bclr.l #7, %d4
171 seq.b %d0 175 seq.b %d0
172 lsr.l #6, %d0 176 lsr.l #6, %d0
173 move.w %d0, (%a3) 177
174 178 move.w %d6, (%a3) /* write second block to LCD */
175 bclr.l #31, %d5 179
180 movem.l (%a0), %d6/%a4-%a6 /* fetch 4 blocks of 4 pixel values each */
181 lea.l (16, %a0), %a0
182
183 move.w %d0, (%a3) /* write third block to LCD */
184
185 bclr.l #31, %d5 /* calculate fourth pixel block */
176 seq.b %d0 186 seq.b %d0
177 lsl.l #2, %d0 187 lsl.l #2, %d0
178 bclr.l #23, %d5 188 bclr.l #23, %d5
@@ -184,20 +194,20 @@ lcd_grey_data:
184 bclr.l #7, %d5 194 bclr.l #7, %d5
185 seq.b %d0 195 seq.b %d0
186 lsr.l #6, %d0 196 lsr.l #6, %d0
187 move.w %d0, (%a3) 197
188 198 add.l %d6, %d2 /* calculate 4*4 new pixel phases */
189 movem.l (%a0), %d0/%a4-%a6 199 add.l %a4, %d3 /* (packed addition) */
190 lea.l (16, %a0), %a0
191 add.l %d0, %d2
192 add.l %a4, %d3
193 add.l %a5, %d4 200 add.l %a5, %d4
194 add.l %a6, %d5 201 add.l %a6, %d5
195 movem.l %d2-%d5, (%a1) 202
203 movem.l %d2-%d5, (%a1) /* store 4*4 new pixel phases */
196 lea.l (16, %a1), %a1 204 lea.l (16, %a1), %a1
197 205
206 move.w %d0, (%a3) /* write fourth block to LCD */
207
198 cmp.l %a1, %d1 /* go up to last line bound */ 208 cmp.l %a1, %d1 /* go up to last line bound */
199 bhi.w .g_lloop 209 bhi.w .g_lloop
200 210
201 cmp.l %a1, %a2 211 cmp.l %a1, %a2
202 bls.s .g_no_tail 212 bls.s .g_no_tail
203 213
@@ -225,8 +235,8 @@ lcd_grey_data:
225 bhi.s .g_tloop 235 bhi.s .g_tloop
226 236
227.g_no_tail: 237.g_no_tail:
228 movem.l (%sp), %d2-%d5/%a2-%a6 /* restore registers */ 238 movem.l (%sp), %d2-%d6/%a2-%a6 /* restore registers */
229 lea.l (9*4, %sp), %sp 239 lea.l (10*4, %sp), %sp
230 rts 240 rts
231 241
232.gd_end: 242.gd_end: