Index: emcore/trunk/drawing.S |
— | — | @@ -50,46 +50,130 @@ |
51 | 51 | .global rendertext
|
52 | 52 | .type rendertext, %function
|
53 | 53 | rendertext:
|
54 | | - stmfd sp!, {r0-r2,r4,r5,lr}
|
55 | | - ldr r4, [sp,#0x18]
|
56 | | - str r4, [sp,#-4]!
|
57 | | - mov r4, r3
|
58 | | - mov r5, #6 * LCD_BYTESPERPIXEL
|
| 54 | + stmfd sp!, {r1-r8,lr}
|
| 55 | + mov r4, r0
|
| 56 | + ldmfd sp, {r5-r7}
|
| 57 | + ldr r0, [sp,#0x24]
|
| 58 | + ldr r1, [sp,#0x28]
|
| 59 | + ldr r8, [sp,#0x2c]
|
| 60 | + stmia sp, {r0,r1}
|
59 | 61 | rendertext_loop:
|
60 | | - ldrb r3, [r4], #1
|
61 | | - cmp r3, #0
|
| 62 | + ldrb r12, [r8], #1
|
| 63 | + mov r0, r4
|
| 64 | + cmp r12, #0
|
| 65 | + mov r1, r5
|
62 | 66 | beq rendertext_done
|
| 67 | + mov r2, r6
|
| 68 | + str r12, [sp,#0x8]
|
| 69 | + mov r3, r7
|
63 | 70 | bl renderchar
|
64 | | - ldmed sp, {r0-r2}
|
65 | | - add r0, r0, r5
|
66 | | - str r0, [sp,#4]
|
| 71 | + add r5, r5, #6
|
67 | 72 | b rendertext_loop
|
68 | 73 | rendertext_done:
|
69 | | - ldmfd sp!, {r0-r5,pc}
|
| 74 | + ldmfd sp!, {r1-r8,pc}
|
70 | 75 | .size rendertext, .-rendertext
|
71 | 76 |
|
72 | 77 |
|
73 | | -#if (LCD_BYTESPERPIXEL == 2)
|
74 | 78 | .section .icode.renderchar, "ax", %progbits
|
75 | 79 | .align 2
|
76 | 80 | .global renderchar
|
77 | 81 | .type renderchar, %function
|
| 82 | +.global renderchar_native
|
| 83 | +.type renderchar_native, %function
|
78 | 84 | renderchar:
|
| 85 | + stmfd sp!, {r4-r9,lr}
|
| 86 | + mla r1, r2, r3, r1
|
| 87 | + ldr r2, [sp,#0x24]
|
| 88 | + add r1, r1, r1,lsl#1
|
| 89 | + sub r2, r2, #0x20
|
| 90 | + add r0, r0, r1
|
| 91 | + adr r7, renderchar_font
|
| 92 | + cmp r2, #0x5f
|
| 93 | + add r2, r2, r2,lsl#2
|
| 94 | + mov r1, #6
|
| 95 | + addcc r7, r7, r2
|
| 96 | + ldr r4, [sp,#0x1c]
|
| 97 | + add r3, r3, r3,lsl#1
|
| 98 | + ldr r5, [sp,#0x20]
|
| 99 | +renderchar_x:
|
| 100 | + cmp r1, #1
|
| 101 | + mov r2, #8
|
| 102 | + ldrneb lr, [r7], #1
|
| 103 | +renderchar_y:
|
| 104 | + mov r12, r5,lsr#24
|
| 105 | + and r9, r5, #0xff
|
| 106 | + ldrb r8, [r0]
|
| 107 | + mul r9, r12, r9
|
| 108 | + rsb r12, r12, #0xff
|
| 109 | + tst lr, #1
|
| 110 | + mla r8, r12, r8, r9
|
| 111 | + movne r12, r4,lsr#24
|
| 112 | + andne r9, r4, #0xff
|
| 113 | + mov r8, r8,lsr#8
|
| 114 | + mulne r9, r12, r9
|
| 115 | + rsbne r12, r12, #0xff
|
| 116 | + mov lr, lr,lsr#1
|
| 117 | + mlane r8, r12, r8, r9
|
| 118 | + mov r9, r5,lsr#8
|
| 119 | + movne r8, r8,lsr#8
|
| 120 | + mov r12, r5,lsr#24
|
| 121 | + strb r8, [r0]
|
| 122 | + and r9, r9, #0xff
|
| 123 | + ldrb r8, [r0,#1]
|
| 124 | + mul r9, r12, r9
|
| 125 | + rsb r12, r12, #0xff
|
| 126 | + mla r8, r12, r8, r9
|
| 127 | + movne r9, r4,lsr#8
|
| 128 | + movne r12, r4,lsr#24
|
| 129 | + andne r9, r9, #0xff
|
| 130 | + mov r8, r8,lsr#8
|
| 131 | + mulne r9, r12, r9
|
| 132 | + rsbne r12, r12, #0xff
|
| 133 | + mlane r8, r12, r8, r9
|
| 134 | + mov r12, r5,lsr#24
|
| 135 | + mov r9, r5,lsr#16
|
| 136 | + movne r8, r8,lsr#8
|
| 137 | + and r9, r9, #0xff
|
| 138 | + strb r8, [r0,#1]
|
| 139 | + mul r9, r12, r9
|
| 140 | + ldrb r8, [r0,#2]
|
| 141 | + rsb r12, r12, #0xff
|
| 142 | + movne r9, r4,lsr#16
|
| 143 | + mla r8, r12, r8, r9
|
| 144 | + andne r9, r9, #0xff
|
| 145 | + movne r12, r4,lsr#24
|
| 146 | + mov r8, r8,lsr#8
|
| 147 | + mulne r9, r12, r9
|
| 148 | + rsbne r12, r12, #0xff
|
| 149 | + mlane r8, r12, r8, r9
|
| 150 | + movne r8, r8,lsr#8
|
| 151 | + subs r2, r2, #1
|
| 152 | + strb r8, [r0,#2]
|
| 153 | + add r0, r0, r3
|
| 154 | + bne renderchar_y
|
| 155 | + sub r0, r0, r3,lsl#3
|
| 156 | + subs r1, r1, #1
|
| 157 | + add r0, r0, #3
|
| 158 | + bne renderchar_x
|
| 159 | + ldmfd sp!, {r4-r9,pc}
|
| 160 | +
|
| 161 | +#if (LCD_BYTESPERPIXEL == 2)
|
| 162 | +renderchar_native:
|
79 | 163 | stmfd sp!, {r4-r7,lr}
|
80 | 164 | ldr r7, [sp,#0x14]
|
81 | 165 | cmn r2, #1
|
82 | | - beq renderchar_nobg
|
| 166 | + beq renderchar_native_nobg
|
83 | 167 | mov r6, r0
|
84 | 168 | mov r4, #8
|
85 | 169 | mov lr, r2,lsr#16
|
86 | 170 | sub lr, lr, #0xff00
|
87 | 171 | subs lr, lr, #0xff
|
88 | | - bne renderchar_opaquerow
|
| 172 | + bne renderchar_native_opaquerow
|
89 | 173 | mov r12, r2,lsl#16
|
90 | 174 | mov r12, r12,lsr#16
|
91 | | -renderchar_blendrow:
|
| 175 | +renderchar_native_blendrow:
|
92 | 176 | mov r5, #6
|
93 | | -renderchar_blendcol:
|
| 177 | +renderchar_native_blendcol:
|
94 | 178 | ldrh lr, [r6]
|
95 | 179 | movs lr, lr,lsr#1
|
96 | 180 | #ifdef LCD_BIGENDIAN
|
— | — | @@ -102,23 +186,23 @@ |
103 | 187 | add lr, lr, r12
|
104 | 188 | strh lr, [r6], #2
|
105 | 189 | subs r5, r5, #1
|
106 | | - bne renderchar_blendcol
|
| 190 | + bne renderchar_native_blendcol
|
107 | 191 | add r6, r6, r7,lsl#1
|
108 | 192 | sub r6, r6, #12
|
109 | 193 | subs r4, r4, #1
|
110 | | - bne renderchar_blendrow
|
111 | | - b renderchar_nobg
|
112 | | -renderchar_opaquerow:
|
| 194 | + bne renderchar_native_blendrow
|
| 195 | + b renderchar_native_nobg
|
| 196 | +renderchar_native_opaquerow:
|
113 | 197 | mov r5, #6
|
114 | | -renderchar_opaquecol:
|
| 198 | +renderchar_native_opaquecol:
|
115 | 199 | strh r2, [r6], #2
|
116 | 200 | subs r5, r5, #1
|
117 | | - bne renderchar_opaquecol
|
| 201 | + bne renderchar_native_opaquecol
|
118 | 202 | add r6, r6, r7,lsl#1
|
119 | 203 | sub r6, r6, #12
|
120 | 204 | subs r4, r4, #1
|
121 | | - bne renderchar_opaquerow
|
122 | | -renderchar_nobg:
|
| 205 | + bne renderchar_native_opaquerow
|
| 206 | +renderchar_native_nobg:
|
123 | 207 | adr r5, renderchar_font
|
124 | 208 | sub r3, r3, #0x20
|
125 | 209 | cmp r3, #0x5f
|
— | — | @@ -125,20 +209,23 @@ |
126 | 210 | addcc r5, r3,lsl#2
|
127 | 211 | addcc r5, r3
|
128 | 212 | mov r3, #5
|
129 | | -renderchar_col:
|
| 213 | +renderchar_native_col:
|
130 | 214 | mov r6, r0
|
131 | 215 | ldrb r4, [r5], #1
|
132 | | -renderchar_row:
|
| 216 | +renderchar_native_row:
|
133 | 217 | tst r4, #1
|
134 | 218 | strneh r1, [r6]
|
135 | 219 | add r6, r6, r7,lsl#1
|
136 | 220 | movs r4, r4,lsr#1
|
137 | | - bne renderchar_row
|
| 221 | + bne renderchar_native_row
|
138 | 222 | add r0, r0, #2
|
139 | 223 | subs r3, r3, #1
|
140 | | - bne renderchar_col
|
| 224 | + bne renderchar_native_col
|
141 | 225 | add r0, r0, #2
|
142 | 226 | ldmfd sp!, {r4-r7,pc}
|
| 227 | +#else
|
| 228 | +#error Unknown number of bytes per pixel!
|
| 229 | +#endif
|
143 | 230 |
|
144 | 231 | renderchar_font:
|
145 | 232 | .byte 0, 0, 0, 0, 0
|
— | — | @@ -237,7 +324,4 @@ |
238 | 325 | .byte 0, 65, 54, 8, 0
|
239 | 326 | .byte 2, 1, 2, 4, 2
|
240 | 327 | .align 2
|
241 | | -.size renderchar, .-renderchar
|
242 | | -#else
|
243 | | -#error Unknown number of bytes per pixel!
|
244 | | -#endif
|
| 328 | +.size renderchar_native, .-renderchar_native
|
Index: emcore/trunk/drawing.h |
— | — | @@ -32,8 +32,11 @@ |
33 | 33 | #define FONT_HEIGHT 8
|
34 | 34 |
|
35 | 35 |
|
36 | | -void renderchar(void* buffer, int fgcol, int bgcol, char text, int stride);
|
37 | | -void rendertext(void* buffer, int fgcol, int bgcol, char* text, int stride);
|
| 36 | +void renderchar_native(void* buffer, int fgcol, int bgcol, char text, int stride);
|
| 37 | +void renderchar(void* buffer, int x, int y, int stride,
|
| 38 | + uint32_t fgcolor, uint32_t bgcolor, char c);
|
| 39 | +void rendertext(void* buffer, int x, int y, int stride,
|
| 40 | + uint32_t fgcolor, uint32_t bgcolor, char* str);
|
38 | 41 | int get_font_width(void);
|
39 | 42 | int get_font_height(void);
|
40 | 43 |
|
Index: emcore/trunk/export/syscallwrappers.h |
— | — | @@ -48,6 +48,7 @@ |
49 | 49 | #define readdir __emcore_syscall->readdir
|
50 | 50 | #define mkdir __emcore_syscall->mkdir
|
51 | 51 | #define rmdir __emcore_syscall->rmdir
|
| 52 | +#define renderchar_native __emcore_syscall->renderchar_native
|
52 | 53 | #define renderchar __emcore_syscall->renderchar
|
53 | 54 | #define rendertext __emcore_syscall->rendertext
|
54 | 55 | #define get_font_width __emcore_syscall->get_font_width
|
Index: emcore/trunk/export/syscallapi.h |
— | — | @@ -108,6 +108,7 @@ |
109 | 109 | typeof(readdir) *readdir;
|
110 | 110 | typeof(mkdir) *mkdir;
|
111 | 111 | typeof(rmdir) *rmdir;
|
| 112 | + typeof(renderchar_native) *renderchar_native;
|
112 | 113 | typeof(renderchar) *renderchar;
|
113 | 114 | typeof(rendertext) *rendertext;
|
114 | 115 | typeof(get_font_width) *get_font_width;
|
Index: emcore/trunk/syscallapi.c |
— | — | @@ -169,6 +169,7 @@ |
170 | 170 | .lcd_get_height = lcd_get_height,
|
171 | 171 | .lcd_get_bytes_per_pixel = lcd_get_bytes_per_pixel,
|
172 | 172 | .lcd_translate_color = lcd_translate_color,
|
| 173 | + .renderchar_native = renderchar_native,
|
173 | 174 | .renderchar = renderchar,
|
174 | 175 | .rendertext = rendertext,
|
175 | 176 | .get_font_width = get_font_width,
|
Index: emcore/trunk/lcdconsole.c |
— | — | @@ -81,8 +81,8 @@ |
82 | 82 | LCDCONSOLE_BGCOLOR, ROWBYTES * offset);
|
83 | 83 | current_row = LCDCONSOLE_ROWS - 1;
|
84 | 84 | }
|
85 | | - renderchar(&framebuf[OFFSETBYTES + ROWBYTES * current_row + COLBYTES * current_col],
|
86 | | - fgcolor, bgcolor, string, LCD_WIDTH);
|
| 85 | + renderchar_native(&framebuf[OFFSETBYTES + ROWBYTES * current_row + COLBYTES * current_col],
|
| 86 | + fgcolor, bgcolor, string, LCD_WIDTH);
|
87 | 87 | }
|
88 | 88 |
|
89 | 89 | void lcdconsole_puts_noblit(const char* string, int fgcolor, int bgcolor)
|