Subversion Repositories freemyipod

Rev

Rev 710 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 theseven 1
@
2
@
3
@    Copyright 2010 TheSeven
4
@
5
@
427 farthen 6
@    This file is part of emCORE.
2 theseven 7
@
427 farthen 8
@    emCORE is free software: you can redistribute it and/or
2 theseven 9
@    modify it under the terms of the GNU General Public License as
10
@    published by the Free Software Foundation, either version 2 of the
11
@    License, or (at your option) any later version.
12
@
427 farthen 13
@    emCORE is distributed in the hope that it will be useful,
2 theseven 14
@    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
@    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
@    See the GNU General Public License for more details.
17
@
18
@    You should have received a copy of the GNU General Public License
427 farthen 19
@    along with emCORE.  If not, see <http://www.gnu.org/licenses/>.
2 theseven 20
@
21
@
22
 
23
 
138 theseven 24
#define ASM_FILE
25
#include "global.h"
26
 
27
 
28
.section .icode.get_font_width, "ax", %progbits
29
.align 2
30
.global get_font_width
31
.type get_font_width, %function
32
get_font_width:
33
	mov	r0, #6
34
	mov	pc, lr
35
.size get_font_width, .-get_font_width
36
 
37
 
38
.section .icode.get_font_height, "ax", %progbits
39
.align 2
40
.global get_font_height
41
.type get_font_height, %function
42
get_font_height:
43
	mov	r0, #8
44
	mov	pc, lr
45
.size get_font_height, .-get_font_height
46
 
47
 
48
.section .icode.rendertext, "ax", %progbits
49
.align 2
50
.global rendertext
51
.type rendertext, %function
52
rendertext:
497 theseven 53
	stmfd	sp!, {r1-r8,lr}
54
	mov	r4, r0
55
	ldmfd	sp, {r5-r7}
56
	ldr	r0, [sp,#0x24]
57
	ldr	r1, [sp,#0x28]
58
	ldr	r8, [sp,#0x2c]
59
	stmia	sp, {r0,r1}
138 theseven 60
rendertext_loop:
497 theseven 61
	ldrb	r12, [r8], #1
62
	mov	r0, r4
63
	cmp	r12, #0
64
	mov	r1, r5
138 theseven 65
	beq	rendertext_done
497 theseven 66
	mov	r2, r6
67
	str	r12, [sp,#0x8]
68
	mov	r3, r7
138 theseven 69
	bl	renderchar
497 theseven 70
	add	r5, r5, #6
138 theseven 71
	b	rendertext_loop
72
rendertext_done:
497 theseven 73
	ldmfd	sp!, {r1-r8,pc}
138 theseven 74
.size rendertext, .-rendertext
75
 
76
 
2 theseven 77
.section .icode.renderchar, "ax", %progbits
78
.align 2
79
.global renderchar
80
.type renderchar, %function
497 theseven 81
.global renderchar_native
82
.type renderchar_native, %function
2 theseven 83
renderchar:
497 theseven 84
	stmfd	sp!, {r4-r9,lr}
85
	mla	r1, r2, r3, r1
86
	ldr	r2, [sp,#0x24]
87
	add	r1, r1, r1,lsl#1
88
	sub	r2, r2, #0x20
89
	add	r0, r0, r1
90
	adr	r7, renderchar_font
91
	cmp	r2, #0x5f
92
	add	r2, r2, r2,lsl#2
93
	mov	r1, #6
94
	addcc	r7, r7, r2
95
	ldr	r4, [sp,#0x1c]
96
	add	r3, r3, r3,lsl#1
97
	ldr	r5, [sp,#0x20]
98
renderchar_x:
99
	cmp	r1, #1
100
	mov	r2, #8
101
	ldrneb	lr, [r7], #1
102
renderchar_y:
103
	mov	r12, r5,lsr#24
104
	and	r9, r5, #0xff
105
	ldrb	r8, [r0]
106
	mul	r9, r12, r9
107
	rsb	r12, r12, #0xff
108
	tst	lr, #1
109
	mla	r8, r12, r8, r9
110
	movne	r12, r4,lsr#24
111
	andne	r9, r4, #0xff
112
	mov	r8, r8,lsr#8
113
	mulne	r9, r12, r9
114
	rsbne	r12, r12, #0xff
115
	mov	lr, lr,lsr#1
116
	mlane	r8, r12, r8, r9
117
	mov	r9, r5,lsr#8
118
	movne	r8, r8,lsr#8
119
	mov	r12, r5,lsr#24
120
	strb	r8, [r0]
121
	and	r9, r9, #0xff
122
	ldrb	r8, [r0,#1]
123
	mul	r9, r12, r9
124
	rsb	r12, r12, #0xff
125
	mla	r8, r12, r8, r9
126
	movne	r9, r4,lsr#8
127
	movne	r12, r4,lsr#24
128
	andne	r9, r9, #0xff
129
	mov	r8, r8,lsr#8
130
	mulne	r9, r12, r9
131
	rsbne	r12, r12, #0xff
132
	mlane	r8, r12, r8, r9
133
	mov	r12, r5,lsr#24
134
	mov	r9, r5,lsr#16
135
	movne	r8, r8,lsr#8
136
	and	r9, r9, #0xff
137
	strb	r8, [r0,#1]
138
	mul	r9, r12, r9
139
	ldrb	r8, [r0,#2]
140
	rsb	r12, r12, #0xff
141
	movne	r9, r4,lsr#16
142
	mla	r8, r12, r8, r9
143
	andne	r9, r9, #0xff
144
	movne	r12, r4,lsr#24
145
	mov	r8, r8,lsr#8
146
	mulne	r9, r12, r9
147
	rsbne	r12, r12, #0xff
148
	mlane	r8, r12, r8, r9
149
	movne	r8, r8,lsr#8
150
	subs	r2, r2, #1
151
	strb	r8, [r0,#2]
152
	add	r0, r0, r3
153
	bne	renderchar_y
154
	sub	r0, r0, r3,lsl#3
155
	subs	r1, r1, #1
156
	add	r0, r0, #3
157
	bne	renderchar_x
158
	ldmfd	sp!, {r4-r9,pc}
159
 
710 theseven 160
renderchar_native:
497 theseven 161
#if (LCD_BYTESPERPIXEL == 2)
7 theseven 162
	stmfd	sp!, {r4-r7,lr}
163
	ldr	r7, [sp,#0x14]
2 theseven 164
	cmn	r2, #1
497 theseven 165
	beq	renderchar_native_nobg
2 theseven 166
	mov	r6, r0
167
	mov	r4, #8
168
	mov	lr, r2,lsr#16
169
	sub	lr, lr, #0xff00
170
	subs	lr, lr, #0xff
497 theseven 171
	bne	renderchar_native_opaquerow
2 theseven 172
	mov	r12, r2,lsl#16
173
	mov	r12, r12,lsr#16
497 theseven 174
renderchar_native_blendrow:
2 theseven 175
	mov	r5, #6
497 theseven 176
renderchar_native_blendcol:
2 theseven 177
	ldrh	lr, [r6]
331 theseven 178
	movs	lr, lr,lsr#1
179
#ifdef LCD_BIGENDIAN
180
	orrcs	lr, lr, #0x10000
2 theseven 181
	bic	lr, lr, #0x1000
182
	bic	lr, lr, #0x84
331 theseven 183
#else
184
	bic	lr, lr, #0x410
185
#endif
2 theseven 186
	add	lr, lr, r12
187
	strh	lr, [r6], #2
188
	subs	r5, r5, #1
497 theseven 189
	bne	renderchar_native_blendcol
138 theseven 190
	add	r6, r6, r7,lsl#1
7 theseven 191
	sub	r6, r6, #12
2 theseven 192
	subs	r4, r4, #1
497 theseven 193
	bne	renderchar_native_blendrow
194
	b	renderchar_native_nobg
195
renderchar_native_opaquerow:
2 theseven 196
	mov	r5, #6
497 theseven 197
renderchar_native_opaquecol:
2 theseven 198
	strh	r2, [r6], #2
199
	subs	r5, r5, #1
497 theseven 200
	bne	renderchar_native_opaquecol
138 theseven 201
	add	r6, r6, r7,lsl#1
7 theseven 202
	sub	r6, r6, #12
2 theseven 203
	subs	r4, r4, #1
497 theseven 204
	bne	renderchar_native_opaquerow
205
renderchar_native_nobg:
2 theseven 206
	adr	r5, renderchar_font
207
	sub	r3, r3, #0x20
208
	cmp	r3, #0x5f
209
	addcc	r5, r3,lsl#2
210
	addcc	r5, r3
211
	mov	r3, #5
497 theseven 212
renderchar_native_col:
2 theseven 213
	mov	r6, r0
214
	ldrb	r4, [r5], #1
497 theseven 215
renderchar_native_row:
2 theseven 216
	tst	r4, #1
217
	strneh	r1, [r6]
138 theseven 218
	add	r6, r6, r7,lsl#1
2 theseven 219
	movs	r4, r4,lsr#1
497 theseven 220
	bne	renderchar_native_row
2 theseven 221
	add	r0, r0, #2
222
	subs	r3, r3, #1
497 theseven 223
	bne	renderchar_native_col
2 theseven 224
	add	r0, r0, #2
7 theseven 225
	ldmfd	sp!, {r4-r7,pc}
497 theseven 226
#else
710 theseven 227
#if (LCD_BYTESPERPIXEL == 4)
228
 
229
	stmfd	sp!, {r4-r7,lr}
230
	ldr	r7, [sp,#0x14]
231
	cmn	r2, #1
232
	beq	renderchar_native_nobg
233
	mov	r6, r0
234
	mov	r4, #8
235
renderchar_native_opaquerow:
236
	mov	r5, #6
237
renderchar_native_opaquecol:
238
	str	r2, [r6], #4
239
	subs	r5, r5, #1
240
	bne	renderchar_native_opaquecol
241
	add	r6, r6, r7,lsl#1
242
	sub	r6, r6, #12
243
	subs	r4, r4, #1
244
	bne	renderchar_native_opaquerow
245
renderchar_native_nobg:
246
	adr	r5, renderchar_font
247
	sub	r3, r3, #0x20
248
	cmp	r3, #0x5f
249
	addcc	r5, r3,lsl#2
250
	addcc	r5, r3
251
	mov	r3, #5
252
renderchar_native_col:
253
	mov	r6, r0
254
	ldrb	r4, [r5], #1
255
renderchar_native_row:
256
	tst	r4, #1
257
	strne	r1, [r6]
258
	add	r6, r6, r7,lsl#2
259
	movs	r4, r4,lsr#1
260
	bne	renderchar_native_row
261
	add	r0, r0, #4
262
	subs	r3, r3, #1
263
	bne	renderchar_native_col
264
	add	r0, r0, #4
265
	ldmfd	sp!, {r4-r7,pc}
266
#else
497 theseven 267
#error Unknown number of bytes per pixel!
268
#endif
710 theseven 269
#endif
2 theseven 270
 
271
renderchar_font:
272
	.byte 0, 0, 0, 0, 0
273
	.byte 0, 0, 95, 0, 0
274
	.byte 0, 7, 0, 7, 0
275
	.byte 20, 127, 20, 127, 20
276
	.byte 36, 42, 127, 42, 18
277
	.byte 35, 19, 8, 100, 98
278
	.byte 54, 73, 85, 34, 80
279
	.byte 5, 3, 0, 0, 0
280
	.byte 28, 34, 65, 0, 0
281
	.byte 0, 0, 65, 34, 28
282
	.byte 20, 8, 62, 8, 20
283
	.byte 8, 8, 62, 8, 8
284
	.byte 0, -96, 96, 0, 0
285
	.byte 8, 8, 8, 8, 8
286
	.byte 0, 96, 96, 0, 0
287
	.byte 32, 16, 8, 4, 2
288
	.byte 62, 81, 73, 69, 62
289
	.byte 0, 66, 127, 64, 0
290
	.byte 66, 97, 81, 73, 70
291
	.byte 33, 65, 69, 75, 49
292
	.byte 24, 20, 18, 127, 16
293
	.byte 39, 69, 69, 69, 57
294
	.byte 60, 74, 73, 73, 48
295
	.byte 1, 113, 9, 5, 3
296
	.byte 54, 73, 73, 73, 54
297
	.byte 6, 73, 73, 41, 30
298
	.byte 0, 54, 54, 0, 0
299
	.byte 0, 86, 54, 0, 0
300
	.byte 8, 20, 34, 65, 0
301
	.byte 20, 20, 20, 20, 20
302
	.byte 0, 65, 34, 20, 8
303
	.byte 2, 1, 81, 9, 6
304
	.byte 50, 73, 121, 65, 62
305
	.byte 124, 18, 17, 18, 124
306
	.byte 127, 73, 73, 73, 62
307
	.byte 62, 65, 65, 65, 34
308
	.byte 127, 65, 65, 34, 28
309
	.byte 127, 73, 73, 73, 65
310
	.byte 127, 9, 9, 9, 1
311
	.byte 62, 65, 73, 73, 58
312
	.byte 127, 8, 8, 8, 127
313
	.byte 0, 65, 127, 65, 0
314
	.byte 32, 64, 65, 63, 1
315
	.byte 127, 8, 20, 34, 65
316
	.byte 127, 64, 64, 64, 64
317
	.byte 127, 2, 12, 2, 127
318
	.byte 127, 4, 8, 16, 127
319
	.byte 62, 65, 65, 65, 62
320
	.byte 127, 9, 9, 9, 6
321
	.byte 62, 65, 81, 33, 94
322
	.byte 127, 9, 25, 41, 70
323
	.byte 38, 73, 73, 73, 50
324
	.byte 1, 1, 127, 1, 1
325
	.byte 63, 64, 64, 64, 63
326
	.byte 31, 32, 64, 32, 31
327
	.byte 127, 32, 24, 32, 127
328
	.byte 99, 20, 8, 20, 99
329
	.byte 3, 4, 120, 4, 3
330
	.byte 97, 81, 73, 69, 67
331
	.byte 0, 127, 65, 65, 0
332
	.byte 2, 4, 8, 16, 32
333
	.byte 0, 65, 65, 127, 0
334
	.byte 4, 2, 1, 2, 4
335
	.byte 64, 64, 64, 64, 64
336
	.byte 1, 2, 4, 0, 0
337
	.byte 32, 84, 84, 84, 120
338
	.byte 127, 68, 68, 68, 56
339
	.byte 56, 68, 68, 68, 40
340
	.byte 56, 68, 68, 68, 127
341
	.byte 56, 84, 84, 84, 24
342
	.byte 8, 126, 9, 1, 2
343
	.byte 8, 84, 84, 84, 60
344
	.byte 127, 4, 4, 4, 120
345
	.byte 0, 68, 125, 64, 0
346
	.byte 32, 64, 64, 61, 0
347
	.byte 127, 16, 40, 68, 0
348
	.byte 0, 65, 127, 64, 0
349
	.byte 124, 4, 24, 4, 120
350
	.byte 124, 8, 4, 4, 120
351
	.byte 56, 68, 68, 68, 56
352
	.byte 124, 20, 20, 20, 24
353
	.byte 8, 20, 20, 20, 124
354
	.byte 124, 8, 4, 4, 8
355
	.byte 72, 84, 84, 84, 32
356
	.byte 4, 63, 68, 64, 32
357
	.byte 60, 64, 64, 32, 124
358
	.byte 28, 32, 64, 32, 28
359
	.byte 60, 64, 56, 64, 60
360
	.byte 68, 40, 16, 40, 68
361
	.byte 12, 80, 80, 80, 60
362
	.byte 68, 100, 84, 76, 68
363
	.byte 0, 8, 54, 65, 0
364
	.byte 0, 0, 119, 0, 0
365
	.byte 0, 65, 54, 8, 0
366
	.byte 2, 1, 2, 4, 2
367
.align 2
497 theseven 368
.size renderchar_native, .-renderchar_native