diff options
author | Dave Chapman <dave@dchapman.com> | 2006-03-15 01:27:13 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2006-03-15 01:27:13 +0000 |
commit | b3358bd1a21a76f7e6c779f065249e9807e5df75 (patch) | |
tree | d7eada52e3e5fa9beaef122eb4da3725089356d9 /apps | |
parent | 789e01bd069bc59b30d24534843090103e7df482 (diff) | |
download | rockbox-b3358bd1a21a76f7e6c779f065249e9807e5df75.tar.gz rockbox-b3358bd1a21a76f7e6c779f065249e9807e5df75.zip |
Patch #4829 from Fredrik Öhrn - Coldfire assembler blit_display() function for H300 and move the palette data into IRAM. Each of these gives about a 1fps speed improvement.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9038 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/pacbox/SOURCES | 2 | ||||
-rw-r--r-- | apps/plugins/pacbox/arcade.c | 14 | ||||
-rw-r--r-- | apps/plugins/pacbox/pacbox_cf.S | 155 |
3 files changed, 166 insertions, 5 deletions
diff --git a/apps/plugins/pacbox/SOURCES b/apps/plugins/pacbox/SOURCES index 3d6145ddce..c457f5b2ce 100644 --- a/apps/plugins/pacbox/SOURCES +++ b/apps/plugins/pacbox/SOURCES | |||
@@ -4,6 +4,8 @@ hardware.c | |||
4 | z80.c | 4 | z80.c |
5 | #if (CONFIG_CPU == PP5020) && (LCD_WIDTH >= 288) && (LCD_HEIGHT >= 224) | 5 | #if (CONFIG_CPU == PP5020) && (LCD_WIDTH >= 288) && (LCD_HEIGHT >= 224) |
6 | pacbox_arm.S | 6 | pacbox_arm.S |
7 | #elif defined(IRIVER_H300_SERIES) && !defined(SIMULATOR) | ||
8 | pacbox_cf.S | ||
7 | #else | 9 | #else |
8 | pacbox_lcd.c | 10 | pacbox_lcd.c |
9 | #endif | 11 | #endif |
diff --git a/apps/plugins/pacbox/arcade.c b/apps/plugins/pacbox/arcade.c index dc3ea0c9ba..625ff6e8f1 100644 --- a/apps/plugins/pacbox/arcade.c +++ b/apps/plugins/pacbox/arcade.c | |||
@@ -87,9 +87,15 @@ enum { | |||
87 | FlipXY = 0x03 | 87 | FlipXY = 0x03 |
88 | }; | 88 | }; |
89 | 89 | ||
90 | fb_data palette[256]; /* Color palette */ | 90 | /* Putting this in IRAM actually slows down the iPods, but is good for |
91 | int vchar_to_x_[1024]; | 91 | the Coldfire |
92 | int vchar_to_y_[1024]; | 92 | */ |
93 | #ifdef CPU_COLDFIRE | ||
94 | fb_data palette[256] IBSS_ATTR; /* Color palette */ | ||
95 | #else | ||
96 | fb_data palette[256]; /* Color palette */ | ||
97 | #endif | ||
98 | |||
93 | 99 | ||
94 | void init_PacmanMachine(int dip) | 100 | void init_PacmanMachine(int dip) |
95 | { | 101 | { |
@@ -129,8 +135,6 @@ void init_PacmanMachine(int dip) | |||
129 | x = 27 - ((i-0x40) >> 5); | 135 | x = 27 - ((i-0x40) >> 5); |
130 | y = 2 + ((i-0x40) & 0x1F); | 136 | y = 2 + ((i-0x40) & 0x1F); |
131 | } | 137 | } |
132 | vchar_to_x_[i] = x; | ||
133 | vchar_to_y_[i] = y; | ||
134 | if( (y >= 0) && (y < 36) && (x >= 0) && (x < 28) ) | 138 | if( (y >= 0) && (y < 36) && (x >= 0) && (x < 28) ) |
135 | vchar_to_i_[i] = y*28 + x; | 139 | vchar_to_i_[i] = y*28 + x; |
136 | else | 140 | else |
diff --git a/apps/plugins/pacbox/pacbox_cf.S b/apps/plugins/pacbox/pacbox_cf.S new file mode 100644 index 0000000000..7dc6140b44 --- /dev/null +++ b/apps/plugins/pacbox/pacbox_cf.S | |||
@@ -0,0 +1,155 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (c) 2006 Fredrik Ohrn | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include "pacbox.h" | ||
21 | |||
22 | .section .text | ||
23 | .align 2 | ||
24 | .global blit_display | ||
25 | |||
26 | /* | ||
27 | |||
28 | 0.75 scaling - display 3 out of 4 pixels = 216x168 | ||
29 | Skipping pixel #2 out of 4 seems to give the most legible display | ||
30 | |||
31 | void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf) | ||
32 | { | ||
33 | next_dst=&lcd_framebuffer[YOFS*LCD_WIDTH+XOFS+((ScreenHeight*3)/4)-1]; | ||
34 | for (y=ScreenHeight-1;y >= 0; y--) { | ||
35 | if ((y & 3) != 1) { | ||
36 | dst = (next_dst--); | ||
37 | for (x=0;x<ScreenWidth;x++) { | ||
38 | if ((x & 3) == 1) { vbuf++; } | ||
39 | else { | ||
40 | *dst = palette[*(vbuf++)]; | ||
41 | dst+=LCD_WIDTH; | ||
42 | } | ||
43 | } | ||
44 | } else { | ||
45 | vbuf+=ScreenWidth; | ||
46 | } | ||
47 | } | ||
48 | } | ||
49 | */ | ||
50 | |||
51 | /* FIXME: ScreenWidth & ScreenHeight are defined in arcade.h, but all | ||
52 | hell breaks loose if you include it... */ | ||
53 | |||
54 | #define ScreenWidth 224 | ||
55 | #define ScreenHeight 288 | ||
56 | |||
57 | #define SHRUNK_WIDTH ((ScreenWidth/4)*3) | ||
58 | #define SHRUNK_HEIGHT ((ScreenHeight/4)*3) | ||
59 | |||
60 | blit_display: | ||
61 | lea -28(%sp), %sp | ||
62 | movem.l %d2-%d6/%a2, (%sp) | ||
63 | |||
64 | move.l 32(%sp), %a0 // lcd_framebuffer | ||
65 | move.l 36(%sp), %a2 // vbuf | ||
66 | |||
67 | lea palette, %a1 | ||
68 | |||
69 | lea.l ((YOFS * LCD_WIDTH + XOFS + SHRUNK_HEIGHT) * 2)(%a0), %a0 | ||
70 | |||
71 | move.l #(ScreenHeight / 4), %d0 | ||
72 | move.l #(ScreenWidth / 4), %d1 | ||
73 | moveq.l #0, %d2 | ||
74 | |||
75 | y_loop: | ||
76 | move.l %d1, %d5 | ||
77 | x_loop1: | ||
78 | move.l (%a2)+, %d3 | ||
79 | |||
80 | move.b %d3, %d2 | ||
81 | move.w (%a1, %d2.l * 2), %d6 | ||
82 | move.w %d6, (2 * LCD_WIDTH * 2)(%a0) | ||
83 | |||
84 | lsr.l #8, %d3 | ||
85 | move.b %d3, %d2 | ||
86 | move.w (%a1, %d2.l * 2), %d6 | ||
87 | move.w %d6, (1 * LCD_WIDTH * 2)(%a0) | ||
88 | |||
89 | swap.w %d3 | ||
90 | move.b %d3, %d2 | ||
91 | move.w (%a1, %d2.l * 2), (%a0) | ||
92 | |||
93 | lea.l 3 * LCD_WIDTH * 2(%a0), %a0 | ||
94 | |||
95 | subq.l #1, %d5 | ||
96 | bne.s x_loop1 | ||
97 | |||
98 | suba.l #(LCD_WIDTH * SHRUNK_WIDTH + 1) * 2, %a0 | ||
99 | lea.l ScreenWidth(%a2), %a2 // Skip 1 line | ||
100 | |||
101 | move.l %d1, %d5 | ||
102 | x_loop2: | ||
103 | move.l (%a2)+, %d3 | ||
104 | |||
105 | move.b %d3, %d2 | ||
106 | move.w (%a1, %d2.l * 2), %d6 | ||
107 | move.w %d6, 2 * LCD_WIDTH * 2(%a0) | ||
108 | |||
109 | lsr.l #8, %d3 | ||
110 | move.b %d3, %d2 | ||
111 | move.w (%a1, %d2.l * 2), %d6 | ||
112 | move.w %d6, 1 * LCD_WIDTH * 2(%a0) | ||
113 | |||
114 | swap.w %d3 | ||
115 | move.b %d3, %d2 | ||
116 | move.w (%a1, %d2.l * 2), (%a0) | ||
117 | |||
118 | lea.l 3 * LCD_WIDTH * 2(%a0), %a0 | ||
119 | |||
120 | subq.l #1, %d5 | ||
121 | bne.s x_loop2 | ||
122 | |||
123 | suba.l #(LCD_WIDTH * SHRUNK_WIDTH + 1) * 2, %a0 | ||
124 | |||
125 | move.l %d1, %d5 | ||
126 | x_loop3: | ||
127 | move.l (%a2)+, %d3 | ||
128 | |||
129 | move.b %d3, %d2 | ||
130 | move.w (%a1, %d2.l * 2), %d6 | ||
131 | move.w %d6, 2 * LCD_WIDTH * 2(%a0) | ||
132 | |||
133 | lsr.l #8, %d3 | ||
134 | move.b %d3, %d2 | ||
135 | move.w (%a1, %d2.l * 2), %d6 | ||
136 | move.w %d6, 1 * LCD_WIDTH * 2(%a0) | ||
137 | |||
138 | swap.w %d3 | ||
139 | move.b %d3, %d2 | ||
140 | move.w (%a1, %d2.l * 2), (%a0) | ||
141 | |||
142 | lea.l 3 * LCD_WIDTH * 2(%a0), %a0 | ||
143 | |||
144 | subq.l #1, %d5 | ||
145 | bne.s x_loop3 | ||
146 | |||
147 | suba.l #(LCD_WIDTH * SHRUNK_WIDTH + 1) * 2, %a0 | ||
148 | |||
149 | subq.l #1, %d0 | ||
150 | bne y_loop | ||
151 | |||
152 | movem.l (%sp), %d2-%d6/%a2 | ||
153 | lea.l 28(%sp), %sp | ||
154 | rts | ||
155 | |||