summaryrefslogtreecommitdiff
path: root/apps/plugins/pacbox
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2006-03-15 01:27:13 +0000
committerDave Chapman <dave@dchapman.com>2006-03-15 01:27:13 +0000
commitb3358bd1a21a76f7e6c779f065249e9807e5df75 (patch)
treed7eada52e3e5fa9beaef122eb4da3725089356d9 /apps/plugins/pacbox
parent789e01bd069bc59b30d24534843090103e7df482 (diff)
downloadrockbox-b3358bd1a21a76f7e6c779f065249e9807e5df75.zip
rockbox-b3358bd1a21a76f7e6c779f065249e9807e5df75.tar.gz
rockbox-b3358bd1a21a76f7e6c779f065249e9807e5df75.tar.bz2
rockbox-b3358bd1a21a76f7e6c779f065249e9807e5df75.tar.xz
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/plugins/pacbox')
-rw-r--r--apps/plugins/pacbox/SOURCES2
-rw-r--r--apps/plugins/pacbox/arcade.c14
-rw-r--r--apps/plugins/pacbox/pacbox_cf.S155
3 files changed, 166 insertions, 5 deletions
diff --git a/apps/plugins/pacbox/SOURCES b/apps/plugins/pacbox/SOURCES
index 3d6145d..c457f5b 100644
--- a/apps/plugins/pacbox/SOURCES
+++ b/apps/plugins/pacbox/SOURCES
@@ -4,6 +4,8 @@ hardware.c
z80.c
#if (CONFIG_CPU == PP5020) && (LCD_WIDTH >= 288) && (LCD_HEIGHT >= 224)
pacbox_arm.S
+#elif defined(IRIVER_H300_SERIES) && !defined(SIMULATOR)
+pacbox_cf.S
#else
pacbox_lcd.c
#endif
diff --git a/apps/plugins/pacbox/arcade.c b/apps/plugins/pacbox/arcade.c
index dc3ea0c..625ff6e 100644
--- a/apps/plugins/pacbox/arcade.c
+++ b/apps/plugins/pacbox/arcade.c
@@ -87,9 +87,15 @@ enum {
FlipXY = 0x03
};
-fb_data palette[256]; /* Color palette */
-int vchar_to_x_[1024];
-int vchar_to_y_[1024];
+/* Putting this in IRAM actually slows down the iPods, but is good for
+ the Coldfire
+*/
+#ifdef CPU_COLDFIRE
+fb_data palette[256] IBSS_ATTR; /* Color palette */
+#else
+fb_data palette[256]; /* Color palette */
+#endif
+
void init_PacmanMachine(int dip)
{
@@ -129,8 +135,6 @@ void init_PacmanMachine(int dip)
x = 27 - ((i-0x40) >> 5);
y = 2 + ((i-0x40) & 0x1F);
}
- vchar_to_x_[i] = x;
- vchar_to_y_[i] = y;
if( (y >= 0) && (y < 36) && (x >= 0) && (x < 28) )
vchar_to_i_[i] = y*28 + x;
else
diff --git a/apps/plugins/pacbox/pacbox_cf.S b/apps/plugins/pacbox/pacbox_cf.S
new file mode 100644
index 0000000..7dc6140
--- /dev/null
+++ b/apps/plugins/pacbox/pacbox_cf.S
@@ -0,0 +1,155 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (c) 2006 Fredrik Ohrn
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "pacbox.h"
+
+ .section .text
+ .align 2
+ .global blit_display
+
+/*
+
+ 0.75 scaling - display 3 out of 4 pixels = 216x168
+ Skipping pixel #2 out of 4 seems to give the most legible display
+
+void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf)
+{
+ next_dst=&lcd_framebuffer[YOFS*LCD_WIDTH+XOFS+((ScreenHeight*3)/4)-1];
+ for (y=ScreenHeight-1;y >= 0; y--) {
+ if ((y & 3) != 1) {
+ dst = (next_dst--);
+ for (x=0;x<ScreenWidth;x++) {
+ if ((x & 3) == 1) { vbuf++; }
+ else {
+ *dst = palette[*(vbuf++)];
+ dst+=LCD_WIDTH;
+ }
+ }
+ } else {
+ vbuf+=ScreenWidth;
+ }
+ }
+}
+*/
+
+/* FIXME: ScreenWidth & ScreenHeight are defined in arcade.h, but all
+ hell breaks loose if you include it... */
+
+#define ScreenWidth 224
+#define ScreenHeight 288
+
+#define SHRUNK_WIDTH ((ScreenWidth/4)*3)
+#define SHRUNK_HEIGHT ((ScreenHeight/4)*3)
+
+blit_display:
+ lea -28(%sp), %sp
+ movem.l %d2-%d6/%a2, (%sp)
+
+ move.l 32(%sp), %a0 // lcd_framebuffer
+ move.l 36(%sp), %a2 // vbuf
+
+ lea palette, %a1
+
+ lea.l ((YOFS * LCD_WIDTH + XOFS + SHRUNK_HEIGHT) * 2)(%a0), %a0
+
+ move.l #(ScreenHeight / 4), %d0
+ move.l #(ScreenWidth / 4), %d1
+ moveq.l #0, %d2
+
+y_loop:
+ move.l %d1, %d5
+x_loop1:
+ move.l (%a2)+, %d3
+
+ move.b %d3, %d2
+ move.w (%a1, %d2.l * 2), %d6
+ move.w %d6, (2 * LCD_WIDTH * 2)(%a0)
+
+ lsr.l #8, %d3
+ move.b %d3, %d2
+ move.w (%a1, %d2.l * 2), %d6
+ move.w %d6, (1 * LCD_WIDTH * 2)(%a0)
+
+ swap.w %d3
+ move.b %d3, %d2
+ move.w (%a1, %d2.l * 2), (%a0)
+
+ lea.l 3 * LCD_WIDTH * 2(%a0), %a0
+
+ subq.l #1, %d5
+ bne.s x_loop1
+
+ suba.l #(LCD_WIDTH * SHRUNK_WIDTH + 1) * 2, %a0
+ lea.l ScreenWidth(%a2), %a2 // Skip 1 line
+
+ move.l %d1, %d5
+x_loop2:
+ move.l (%a2)+, %d3
+
+ move.b %d3, %d2
+ move.w (%a1, %d2.l * 2), %d6
+ move.w %d6, 2 * LCD_WIDTH * 2(%a0)
+
+ lsr.l #8, %d3
+ move.b %d3, %d2
+ move.w (%a1, %d2.l * 2), %d6
+ move.w %d6, 1 * LCD_WIDTH * 2(%a0)
+
+ swap.w %d3
+ move.b %d3, %d2
+ move.w (%a1, %d2.l * 2), (%a0)
+
+ lea.l 3 * LCD_WIDTH * 2(%a0), %a0
+
+ subq.l #1, %d5
+ bne.s x_loop2
+
+ suba.l #(LCD_WIDTH * SHRUNK_WIDTH + 1) * 2, %a0
+
+ move.l %d1, %d5
+x_loop3:
+ move.l (%a2)+, %d3
+
+ move.b %d3, %d2
+ move.w (%a1, %d2.l * 2), %d6
+ move.w %d6, 2 * LCD_WIDTH * 2(%a0)
+
+ lsr.l #8, %d3
+ move.b %d3, %d2
+ move.w (%a1, %d2.l * 2), %d6
+ move.w %d6, 1 * LCD_WIDTH * 2(%a0)
+
+ swap.w %d3
+ move.b %d3, %d2
+ move.w (%a1, %d2.l * 2), (%a0)
+
+ lea.l 3 * LCD_WIDTH * 2(%a0), %a0
+
+ subq.l #1, %d5
+ bne.s x_loop3
+
+ suba.l #(LCD_WIDTH * SHRUNK_WIDTH + 1) * 2, %a0
+
+ subq.l #1, %d0
+ bne y_loop
+
+ movem.l (%sp), %d2-%d6/%a2
+ lea.l 28(%sp), %sp
+ rts
+