diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-01-04 23:42:38 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-01-04 23:42:38 +0000 |
commit | feb5b15e9bf9292e3d4d82ea1e01ab3557fb1240 (patch) | |
tree | d854c9a6fbbb3263537071fb02df349fdfa62361 /firmware/target/coldfire/iriver/h100/lcd-as-h100.S | |
parent | d3586837fa9221a7ef104550b4c0aadc1a6ea77c (diff) | |
download | rockbox-feb5b15e9bf9292e3d4d82ea1e01ab3557fb1240.tar.gz rockbox-feb5b15e9bf9292e3d4d82ea1e01ab3557fb1240.zip |
All-new greyscale library, replacing the old one. Features: (1) Drawing/updating is faster than the old grayscale lib at full depth. (2) Always 129 shades instead of 2..33 shades. (3) No graininess caused by frequent updates (mpegplayer, doom, ...). (4) Needs less memory than the old grayscale lib at full depth. * The tradeoff is slightly higher CPU load in the ISR (frames are calculated 'live') and an extra function in the core. * Ported all plugins which used the graylib to use the new one. * Some slight optimisations for archos and H1x0 LCD update.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15998 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/iriver/h100/lcd-as-h100.S')
-rw-r--r-- | firmware/target/coldfire/iriver/h100/lcd-as-h100.S | 120 |
1 files changed, 91 insertions, 29 deletions
diff --git a/firmware/target/coldfire/iriver/h100/lcd-as-h100.S b/firmware/target/coldfire/iriver/h100/lcd-as-h100.S index c7509871fc..df410fa379 100644 --- a/firmware/target/coldfire/iriver/h100/lcd-as-h100.S +++ b/firmware/target/coldfire/iriver/h100/lcd-as-h100.S | |||
@@ -28,11 +28,10 @@ | |||
28 | .type lcd_write_command,@function | 28 | .type lcd_write_command,@function |
29 | 29 | ||
30 | lcd_write_command: | 30 | lcd_write_command: |
31 | move.l (4,%sp),%d0 | 31 | move.l #~8, %d1 |
32 | lea MBAR2,%a1 | 32 | and.l %d1, (MBAR2+0xb4) |
33 | move.l #~8,%d1 | 33 | move.l (4, %sp), %d0 |
34 | and.l %d1,(0xb4,%a1) | 34 | move.w %d0, 0xf0000000 |
35 | move.w %d0,0xf0000000 | ||
36 | rts | 35 | rts |
37 | .wc_end: | 36 | .wc_end: |
38 | .size lcd_write_command,.wc_end-lcd_write_command | 37 | .size lcd_write_command,.wc_end-lcd_write_command |
@@ -43,26 +42,27 @@ lcd_write_command: | |||
43 | .type lcd_write_command_ex,@function | 42 | .type lcd_write_command_ex,@function |
44 | 43 | ||
45 | lcd_write_command_ex: | 44 | lcd_write_command_ex: |
46 | lea MBAR2,%a1 | 45 | lea.l 0xf0000000, %a0 |
46 | lea.l MBAR2+0xb4, %a1 | ||
47 | 47 | ||
48 | move.l (4,%sp),%d0 /* Command */ | 48 | move.l #~8, %d1 /* Set A0 = 0 */ |
49 | and.l %d1, (%a1) | ||
49 | 50 | ||
50 | move.l #~8,%d1 /* Set A0 = 0 */ | 51 | move.l (4, %sp), %d0 /* Command */ |
51 | and.l %d1,(0xb4,%a1) | 52 | move.w %d0, (%a0) /* Write to LCD */ |
52 | move.w %d0,0xf0000000 /* Write to LCD */ | ||
53 | 53 | ||
54 | not.l %d1 /* Set A0 = 1 */ | 54 | not.l %d1 /* Set A0 = 1 */ |
55 | or.l %d1,(0xb4,%a1) | 55 | or.l %d1, (%a1) |
56 | 56 | ||
57 | move.l (8,%sp),%d0 /* Data */ | 57 | move.l (8, %sp), %d0 /* Data */ |
58 | cmp.l #0xffffffff,%d0 /* -1? */ | 58 | cmp.l #-1, %d0 /* -1? */ |
59 | beq.b .last | 59 | beq.b .last |
60 | move.w %d0,0xf0000000 /* Write to LCD */ | 60 | move.w %d0, (%a0) /* Write to LCD */ |
61 | 61 | ||
62 | move.l (12,%sp),%d0 /* Data */ | 62 | move.l (12, %sp), %d0 /* Data */ |
63 | cmp.l #0xffffffff,%d0 /* -1? */ | 63 | cmp.l #-1, %d0 /* -1? */ |
64 | beq.b .last | 64 | beq.b .last |
65 | move.w %d0,0xf0000000 /* Write to LCD */ | 65 | move.w %d0, (%a0) /* Write to LCD */ |
66 | 66 | ||
67 | .last: | 67 | .last: |
68 | rts | 68 | rts |
@@ -75,22 +75,84 @@ lcd_write_command_ex: | |||
75 | .type lcd_write_data,@function | 75 | .type lcd_write_data,@function |
76 | 76 | ||
77 | lcd_write_data: | 77 | lcd_write_data: |
78 | move.l (4,%sp),%a0 /* Data pointer */ | 78 | movem.l (4, %sp), %a0-%a1 /* Data pointer */ |
79 | move.l (8,%sp),%d0 /* Length */ | 79 | move.l %a1, %d0 /* Length */ |
80 | lea MBAR2,%a1 | 80 | moveq #8, %d1 |
81 | moveq #8,%d1 | 81 | or.l %d1, (MBAR2+0xb4) |
82 | or.l %d1,(0xb4,%a1) | 82 | lea.l 0xf0000000, %a1 |
83 | 83 | ||
84 | lea 0xf0000000,%a1 | ||
85 | .loop: | 84 | .loop: |
86 | /* When running in IRAM, this loop takes 10 cycles plus the LCD write. | 85 | /* When running in IRAM, this loop takes 10 cycles plus the LCD write. |
87 | The 10 cycles are necessary to follow the LCD timing specs | 86 | The 10 cycles are necessary to follow the LCD timing specs |
88 | at 140MHz */ | 87 | at 140MHz */ |
89 | nop /* 3(0/0) */ | 88 | nop /* 3(0/0) */ |
90 | move.b (%a0)+,%d1 /* 3(1/0) */ | 89 | move.b (%a0)+, %d1 /* 3(1/0) */ |
91 | move.w %d1,(%a1) /* 1(0/1) */ | 90 | move.w %d1, (%a1) /* 1(0/1) */ |
92 | subq.l #1,%d0 /* 1(0/0) */ | 91 | subq.l #1, %d0 /* 1(0/0) */ |
93 | bne .loop /* 2(0/0) */ | 92 | bne .loop /* 2(0/0) */ |
94 | rts | 93 | rts |
95 | .wd_end: | 94 | .wd_end: |
96 | .size lcd_write_data,.wd_end-lcd_write_data | 95 | .size lcd_write_data,.wd_end-lcd_write_data |
96 | |||
97 | |||
98 | .align 2 | ||
99 | .global lcd_grey_data | ||
100 | .type lcd_grey_data,@function | ||
101 | |||
102 | lcd_grey_data: | ||
103 | lea.l (-4*4, %sp), %sp | ||
104 | movem.l %d2-%d5, (%sp) | ||
105 | movem.l (4*4+4, %sp), %a0-%a1 /* Data pointer */ | ||
106 | move.l %a1, %d0 /* Length */ | ||
107 | moveq #8, %d1 | ||
108 | or.l %d1, (MBAR2+0xb4) /* A0 = 1 (data) */ | ||
109 | lea 0xf0000000, %a1 /* LCD data port */ | ||
110 | move.l #0xff00ff00, %d2 /* mask for splitting value/phase pairs */ | ||
111 | |||
112 | .greyloop: | ||
113 | movem.l (%a0), %d4-%d5 /* fetch 4 pixel phase/value pairs at once */ | ||
114 | /* %d4 = p0v0p1v1, %d5 = p2v2p3v3 */ | ||
115 | move.l %d2, %d3 /* copy mask */ | ||
116 | and.l %d4, %d3 /* %d3 = p0--p1-- */ | ||
117 | eor.l %d3, %d4 /* %d4 = --v0--v1 */ | ||
118 | lsr.l #8, %d3 /* %d3 = --p0--p1 */ | ||
119 | |||
120 | bclr.l #23, %d3 /* Z = !(p0 & 0x80); p0 &= ~0x80; */ | ||
121 | seq.b %d1 /* %d1 = ........................00000000 */ | ||
122 | lsl.l #2, %d1 /* %d1 = ......................00000000.. */ | ||
123 | bclr.l #7, %d3 /* Z = !(p1 & 0x80); p1 &= ~0x80; */ | ||
124 | seq.b %d1 /* %d1 = ......................0011111111 */ | ||
125 | lsl.l #2, %d1 /* %d1 = ....................0011111111.. */ | ||
126 | |||
127 | add.l %d4, %d3 /* p0 += v0; p1 += v1; */ | ||
128 | move.b %d3, (2, %a0) /* store p1 */ | ||
129 | swap %d3 | ||
130 | move.b %d3, (%a0) /* store p0 */ | ||
131 | |||
132 | move.l %d2, %d3 /* copy mask */ | ||
133 | and.l %d5, %d3 /* %d3 = p2--p3-- */ | ||
134 | eor.l %d3, %d5 /* %d5 = --v2--v3 */ | ||
135 | lsr.l #8, %d3 /* %d3 = --p2--p3 */ | ||
136 | |||
137 | bclr.l #23, %d3 /* Z = !(p2 & 0x80); p2 &= ~0x80; */ | ||
138 | seq.b %d1 /* %d1 = ....................001122222222 */ | ||
139 | lsl.l #2, %d1 /* %d1 = ..................001122222222.. */ | ||
140 | bclr.l #7, %d3 /* Z = !(p3 & 0x80); p3 &= ~0x80; */ | ||
141 | seq.b %d1 /* %d1 = ..................00112233333333 */ | ||
142 | lsr.l #6, %d1 /* %d1 = ........................00112233 */ | ||
143 | |||
144 | add.l %d5, %d3 /* p2 += v2; p3 += v3; */ | ||
145 | move.b %d3, (6, %a0) /* store p3 */ | ||
146 | swap %d3 | ||
147 | move.b %d3, (4, %a0) /* store p2 */ | ||
148 | |||
149 | move.w %d1, (%a1) /* write pixel block */ | ||
150 | addq.l #8, %a0 /* advance address pointer */ | ||
151 | subq.l #1, %d0 /* any blocks left? */ | ||
152 | bne.b .greyloop | ||
153 | |||
154 | movem.l (%sp), %d2-%d5 | ||
155 | lea.l (4*4, %sp), %sp | ||
156 | rts | ||
157 | .gd_end: | ||
158 | .size lcd_grey_data,.gd_end-lcd_grey_data | ||