diff options
Diffstat (limited to 'apps/plugins/pacbox/pacbox_arm.S')
-rw-r--r-- | apps/plugins/pacbox/pacbox_arm.S | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/apps/plugins/pacbox/pacbox_arm.S b/apps/plugins/pacbox/pacbox_arm.S new file mode 100644 index 0000000000..ade3ad2de6 --- /dev/null +++ b/apps/plugins/pacbox/pacbox_arm.S | |||
@@ -0,0 +1,130 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Pacbox - a Pacman Emulator for Rockbox | ||
11 | * | ||
12 | * Based on PIE - Pacman Instructional Emulator | ||
13 | * | ||
14 | * Copyright (c) 1997-2003,2004 Alessandro Scotti | ||
15 | * | ||
16 | * All files in this archive are subject to the GNU General Public License. | ||
17 | * See the file COPYING in the source tree root for full license agreement. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | |||
24 | #include "pacbox.h" | ||
25 | |||
26 | .section .icode,"ax",%progbits | ||
27 | .global blit_display | ||
28 | |||
29 | /* void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf) | ||
30 | |||
31 | next_dst=&lcd_framebuffer[YOFS*LCD_WIDTH+XOFS+ScreenHeight-1]; | ||
32 | for( y=ScreenHeight; y>0; y-- ) { | ||
33 | dst = (next_dst--); | ||
34 | for( x=ScreenWidth; x>0; x-- ) { | ||
35 | *dst = palette[*(vbuf++)]; | ||
36 | dst+=LCD_WIDTH; | ||
37 | } | ||
38 | } | ||
39 | */ | ||
40 | |||
41 | #ifdef HAVE_LCD_COLOR | ||
42 | #if (LCD_WIDTH >= 288) && (LCD_HEIGHT >= 224) | ||
43 | |||
44 | blit_display: | ||
45 | stmdb sp!, {r4-r12, lr} | ||
46 | |||
47 | add r3, r0, #5696 | ||
48 | add r3, r3, #24 @ 5720 = (2*(YOFS*LCD_WIDTH+XOFS+ScreenHeight-4)) | ||
49 | ldr r0, =palette | ||
50 | mov lr, #288 @ y = 288 | ||
51 | |||
52 | mov r12, #224*3 | ||
53 | |||
54 | loop_y: mov r2, r3 @ r2 = next_dst | ||
55 | sub r3, r3, #8 @ next_dst-=4 | ||
56 | |||
57 | mov ip, #224 @ x = 224 | ||
58 | |||
59 | /* store 2 input bytes from the next four lines in r7-r10 */ | ||
60 | loop_x: | ||
61 | ldrh r8, [r1, #224] @ r8 = vbuf[224] | ||
62 | ldrh r7, [r1] @ r7 = vbuf[0] ; vbuf += 2; | ||
63 | add r1, r1, #448 | ||
64 | ldrh r10, [r1, #224] @ r8 = vbuf[224] | ||
65 | ldrh r9, [r1], #2 @ r7 = vbuf[0] ; vbuf += 2; | ||
66 | sub r1, r1, #448 | ||
67 | |||
68 | |||
69 | /* Convert high bytes of r7-r10 into palette entries in r5 and r6 */ | ||
70 | mov r6, r7, lsr #8 | ||
71 | mov r6, r6, lsl #1 | ||
72 | ldrh r6, [r6, r0] @ r6 = palette[hi(r7]] | ||
73 | |||
74 | mov r11, r8, lsr #8 | ||
75 | mov r11, r11, lsl #1 | ||
76 | ldrh r11, [r11, r0] @ r11 = palette[hi(r8]] | ||
77 | |||
78 | orr r6, r11, r6, lsl #16 @ r6 = palette[hi(r8]] | ||
79 | @ | (palette[hi(r7)] << 16) | ||
80 | |||
81 | mov r5, r9, lsr #8 | ||
82 | mov r5, r5, lsl #1 | ||
83 | ldrh r5, [r5, r0] @ r5 = palette[hi(r9]] | ||
84 | |||
85 | mov r11, r10, lsr #8 | ||
86 | mov r11, r11, lsl #1 | ||
87 | ldrh r11, [r11, r0] @ r11 = palette[hi(r10)]] | ||
88 | |||
89 | orr r5, r11, r5, lsl #16 @ r5 = palette[hi(r10]] | ||
90 | @ | (palette[hi(r9)] << 16) | ||
91 | |||
92 | /* Convert low bytes of r7-r10 into palette entries in r7 and r8 */ | ||
93 | and r7, r7, #0xff | ||
94 | mov r7, r7, lsl #1 | ||
95 | ldrh r7, [r7, r0] | ||
96 | |||
97 | and r8, r8, #0xff | ||
98 | mov r8, r8, lsl #1 | ||
99 | ldrh r8, [r8, r0] | ||
100 | |||
101 | orr r8, r8, r7, lsl #16 | ||
102 | |||
103 | and r9, r9, #0xff | ||
104 | mov r9, r9, lsl #1 | ||
105 | ldrh r9, [r9, r0] | ||
106 | |||
107 | and r10, r10, #0xff | ||
108 | mov r10, r10, lsl #1 | ||
109 | ldrh r10, [r10, r0] | ||
110 | |||
111 | orr r7, r10, r9, lsl #16 | ||
112 | |||
113 | /* Now write the 8 pixels to the screen */ | ||
114 | stmia r2!, {r7, r8} | ||
115 | add r2, r2, #(LCD_WIDTH*2)-8 @ dst += LCD_WIDTH | ||
116 | |||
117 | stmia r2!, {r5, r6} | ||
118 | add r2, r2, #(LCD_WIDTH*2)-8 @ dst += LCD_WIDTH | ||
119 | |||
120 | /* end of x loop */ | ||
121 | subs ip, ip, #2 @ x-=2 | ||
122 | bne loop_x | ||
123 | |||
124 | /* end of y loop */ | ||
125 | add r1, r1, #224*3 @ vbuf += 224*3 | ||
126 | subs lr, lr, #4 @ y-=4 | ||
127 | ldmeqia sp!, {r4-r12, pc} | ||
128 | b loop_y | ||
129 | #endif | ||
130 | #endif | ||