summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd.S
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd.S')
-rwxr-xr-xfirmware/drivers/lcd.S66
1 files changed, 44 insertions, 22 deletions
diff --git a/firmware/drivers/lcd.S b/firmware/drivers/lcd.S
index 2b50de5190..8764d793c3 100755
--- a/firmware/drivers/lcd.S
+++ b/firmware/drivers/lcd.S
@@ -267,7 +267,7 @@ _lcd_write_data:
267 shll r1 267 shll r1
268 mov.b r0,@r3 268 mov.b r0,@r3
269 or #(LCD_SC),r0 269 or #(LCD_SC),r0
270 mov.b r0,@r3 270 mov.b r0,@r3
271 271
272 negc r2,r0 272 negc r2,r0
273 mov.b r0,@r3 273 mov.b r0,@r3
@@ -385,29 +385,41 @@ lcd_write_data:
385 add.l %a0,%d0 /* -> end address */ 385 add.l %a0,%d0 /* -> end address */
386 lea.l 0xf0000002,%a1 /* LCD data port */ 386 lea.l 0xf0000002,%a1 /* LCD data port */
387 387
388 moveq.l #31,%d1 388 move.l %a0,%d1
389 btst.l #1,%d1 /* already longword aligned? */
390 beq.b .word1_end /* yes: skip initial word copy */
391
392 move.w (%a0)+,(%a1) /* transfer initial word */
393
394.word1_end: /* now longword aligned */
395 moveq.l #28,%d1
389 add.l %a0,%d1 396 add.l %a0,%d1
390 and.l #0xFFFFFFF0,%d1 /* %d1 = first line bound + 16 */ 397 and.l #0xFFFFFFF0,%d1 /* %d1 = first line bound + 16 */
391 cmp.l %d1,%d0 /* at least one full line to send? */ 398 cmp.l %d1,%d0 /* at least one full line to send? */
392 blo.b .words2_loop /* no: skip to word loop */ 399 blo.b .long2_start /* no: skip to trailing longword handling */
393 400
401 lea.l (-16,%sp),%sp /* free up some registers */
402 movem.l %d2-%d4/%a2,(%sp)
403
394 subq.l #8,%d1 404 subq.l #8,%d1
395 subq.l #8,%d1 /* %d1 = first line bound */ 405 subq.l #8,%d1 /* %d1 = first line bound */
396 406
397 cmp.l %a0,%d1 /* any leading words? */ 407 cmp.l %a0,%d1 /* any leading longwords? */
398 bls.b .words1_end /* no: skip leading word loop */ 408 bls.b .long1_end /* no: skip leading long loop */
399 409
400.words1_loop: 410.long1_loop:
401 move.w (%a0)+,(%a1) /* transfer word */ 411 move.l (%a0)+,%d2 /* read longword */
412 swap %d2 /* send data to LCD in correct order...*/
413 move.w %d2,(%a1)
414 swap %d2
415 move.w %d2,(%a1)
402 cmp.l %a0,%d1 /* run %a0 up to first line bound */ 416 cmp.l %a0,%d1 /* run %a0 up to first line bound */
403 bhi.b .words1_loop 417 bhi.b .long1_loop
404 418
405.words1_end: 419.long1_end:
406 lea.l (-16,%sp),%sp /* free up some registers */
407 movem.l %d2-%d4/%a2,(%sp)
408 move.l %d0,%a2 420 move.l %d0,%a2
409 lea.l (-15,%a2),%a2 /* %a2 = end address - 15 (one line/pass) */ 421 lea.l (-14,%a2),%a2 /* %a2 = end address - 14 (one line/pass) */
410 422
411 /* burst-optimised line transfers */ 423 /* burst-optimised line transfers */
412.line_loop: 424.line_loop:
413 movem.l (%a0),%d1-%d4 /* burst-read line */ 425 movem.l (%a0),%d1-%d4 /* burst-read line */
@@ -433,15 +445,25 @@ lcd_write_data:
433 445
434 movem.l (%sp),%d2-%d4/%a2 446 movem.l (%sp),%d2-%d4/%a2
435 lea.l (16,%sp),%sp /* restore registers */ 447 lea.l (16,%sp),%sp /* restore registers */
436
437 cmp.l %a0,%d0 /* any trailing words? */
438 bls.b .words2_end /* no: get otta here */
439 448
440.words2_loop: 449.long2_start:
441 move.w (%a0)+,(%a1) /* transfer word */ 450 subq.l #2,%d0 /* account for handling 2 words per loop */
442 cmp.l %a0,%d0 /* run %a0 up to end address */ 451 cmp.l %a0,%d0 /* any (trailing longwords? */
443 bhi.b .words2_loop 452 bls.b .long2_end /* no: skip trailing longword loop */
453
454.long2_loop:
455 move.l (%a0)+,%d1 /* read longword */
456 swap %d1 /* send data to LCD in correct order */
457 move.w %d1,(%a1)
458 swap %d1
459 move.w %d1,(%a1)
460 cmp.l %a0,%d0 /* run %a0 up to last long bound */
461 bhi.b .long2_loop
462
463.long2_end:
464 blo.b .word2_end /* no final word: skip */
465 move.w (%a0)+,(%a1) /* transfer final word */
444 466
445.words2_end: 467.word2_end:
446 rts 468 rts
447#endif 469#endif