1
0
Fork 0
forked from len0rd/rockbox

More patches from Fredrik Öhrn - joystick2.diff (add support using buttons on the iriver remotes) and speedup.diff (more optimisations for Coldfire targets).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9089 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Chapman 2006-03-18 09:14:10 +00:00
parent d00d58896b
commit 03627e0539
7 changed files with 214 additions and 81 deletions

View file

@ -4,8 +4,9 @@ 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
#if defined(CPU_COLDFIRE)
pacbox_cf.S
#endif

View file

@ -408,6 +408,9 @@ unsigned getDipSwitches(void) {
return result;
}
#if defined (CPU_COLDFIRE)
extern void drawChar( unsigned char * buffer, int index, int ox, int oy, int color );
#else
static inline void drawChar( unsigned char * buffer, int index, int ox, int oy, int color )
{
int x,y;
@ -446,6 +449,7 @@ static inline void drawChar( unsigned char * buffer, int index, int ox, int oy,
}
}
}
#endif
inline void drawSprite( unsigned char * buffer, int index )
{

View file

@ -35,7 +35,7 @@ unsigned char spriteset_rom_[4*1024] IBSS_ATTR; // Sprite set ROM (4K)
unsigned char dirty_[1024] IBSS_ATTR;
unsigned char video_mem_[1024] IBSS_ATTR; // Video memory (1K)
unsigned char color_mem_[1024] IBSS_ATTR; // Color memory (1K)
unsigned char charmap_[256*8*8]; /* Character data for 256 8x8 characters */
unsigned char charmap_[256*8*8] IBSS_ATTR; /* Character data for 256 8x8 characters */
unsigned char spritemap_[64*16*16]; /* Sprite data for 64 16x16 sprites */
unsigned char output_devices_ IBSS_ATTR; /* Output flip-flops set by the game program */
unsigned char interrupt_vector_ IBSS_ATTR;

View file

@ -115,7 +115,7 @@ static bool loadROMS( void )
}
/* A buffer to render Pacman's 244x288 screen into */
static unsigned char video_buffer[ScreenWidth*ScreenHeight] __attribute__ ((aligned (4)));
static unsigned char video_buffer[ScreenWidth*ScreenHeight] __attribute__ ((aligned (16)));
static long start_time;
static long video_frames = 0;
@ -283,7 +283,11 @@ static int gameProc( void )
/* Check the button status */
status = rb->button_status();
if ((status & PACMAN_MENU) == PACMAN_MENU) {
if ((status & PACMAN_MENU) == PACMAN_MENU
#ifdef PACMAN_RC_MENU
|| status == PACMAN_RC_MENU
#endif
) {
end_time = *rb->current_tick;
x = pacbox_menu();
rb->lcd_clear_display();
@ -295,6 +299,15 @@ static int gameProc( void )
start_time += *rb->current_tick-end_time;
}
#ifdef PACMAN_HAS_REMOTE
setDeviceMode( Joy1_Left, (status & PACMAN_LEFT || status == PACMAN_RC_LEFT) ? DeviceOn : DeviceOff);
setDeviceMode( Joy1_Right, (status & PACMAN_RIGHT || status == PACMAN_RC_RIGHT) ? DeviceOn : DeviceOff);
setDeviceMode( Joy1_Up, (status & PACMAN_UP || status == PACMAN_RC_UP) ? DeviceOn : DeviceOff);
setDeviceMode( Joy1_Down, (status & PACMAN_DOWN || status == PACMAN_RC_DOWN) ? DeviceOn : DeviceOff);
setDeviceMode( CoinSlot_1, (status & PACMAN_COIN || status == PACMAN_RC_COIN) ? DeviceOn : DeviceOff);
setDeviceMode( Key_OnePlayer, (status & PACMAN_1UP || status == PACMAN_RC_1UP) ? DeviceOn : DeviceOff);
setDeviceMode( Key_TwoPlayers, (status & PACMAN_2UP || status == PACMAN_RC_2UP) ? DeviceOn : DeviceOff);
#else
setDeviceMode( Joy1_Left, (status & PACMAN_LEFT) ? DeviceOn : DeviceOff);
setDeviceMode( Joy1_Right, (status & PACMAN_RIGHT) ? DeviceOn : DeviceOff);
setDeviceMode( Joy1_Up, (status & PACMAN_UP) ? DeviceOn : DeviceOff);
@ -303,6 +316,7 @@ static int gameProc( void )
setDeviceMode( Key_OnePlayer, (status & PACMAN_1UP) ? DeviceOn : DeviceOff);
#ifdef PACMAN_2UP
setDeviceMode( Key_TwoPlayers, (status & PACMAN_2UP) ? DeviceOn : DeviceOff);
#endif
#endif
/* We only update the screen every third frame - Pacman's native

View file

@ -50,6 +50,21 @@
#define PACMAN_COIN BUTTON_REC
#define PACMAN_MENU BUTTON_MODE
#ifdef HAVE_REMOTE_LCD
#define PACMAN_HAS_REMOTE
#define PACMAN_RC_UP BUTTON_RC_VOL_UP
#define PACMAN_RC_DOWN BUTTON_RC_VOL_DOWN
#define PACMAN_RC_LEFT BUTTON_RC_REW
#define PACMAN_RC_RIGHT BUTTON_RC_FF
#define PACMAN_RC_1UP BUTTON_RC_SOURCE
#define PACMAN_RC_2UP BUTTON_RC_BITRATE
#define PACMAN_RC_COIN BUTTON_RC_REC
#define PACMAN_RC_MENU BUTTON_RC_MODE
#endif
#elif CONFIG_KEYPAD == GIGABEAT_PAD
#define PACMAN_UP BUTTON_UP

View file

@ -21,6 +21,10 @@
.section .text
.align 2
#if defined(IRIVER_H300_SERIES) && !defined(SIMULATOR)
.global blit_display
/*
@ -57,99 +61,190 @@ void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf)
#define SHRUNK_WIDTH ((ScreenWidth/4)*3)
#define SHRUNK_HEIGHT ((ScreenHeight/4)*3)
blit_display:
lea -28(%sp), %sp
movem.l %d2-%d6/%a2, (%sp)
#define BD_SAVE (9 * 4)
move.l 32(%sp), %a0 // lcd_framebuffer
move.l 36(%sp), %a2 // vbuf
process_4_pixels:
move.b %d4, %d2
move.w (%a1, %d2.l * 2), %d3
move.w %d3, (2 * LCD_WIDTH * 2)(%a0)
lsr.l #8, %d4
move.b %d4, %d2
move.w (%a1, %d2.l * 2), %d3
move.w %d3, (1 * LCD_WIDTH * 2)(%a0)
swap.w %d4
move.b %d4, %d2
move.w (%a1, %d2.l * 2), (%a0)
lea.l 3 * LCD_WIDTH * 2(%a0), %a0
rts
process_line:
move.l %a3, %d1
bd_x_loop:
movem.l (%a2), %d4-%d7 // Read 16 pixels
bsr.s process_4_pixels
move.l %d5, %d4
bsr.s process_4_pixels
move.l %d6, %d4
bsr.s process_4_pixels
move.l %d7, %d4
bsr.s process_4_pixels
lea 16(%a2), %a2
subq.l #1, %d1;
bne.s bd_x_loop
rts
blit_display:
lea -BD_SAVE(%sp), %sp
movem.l %d2-%d7/%a2-%a4, (%sp)
move.l BD_SAVE + 4(%sp), %a0 // lcd_framebuffer
move.l BD_SAVE + 8(%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
move.l #(ScreenWidth / 16), %a3
move.l #(LCD_WIDTH * SHRUNK_WIDTH + 1) * 2, %a4
moveq.l #0, %d2
y_loop:
move.l %d1, %d5
x_loop1:
move.l (%a2)+, %d3
bd_y_loop:
bsr.s process_line
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
suba.l %a4, %a0
lea.l ScreenWidth(%a2), %a2 // Skip 1 line
move.l %d1, %d5
x_loop2:
move.l (%a2)+, %d3
bsr.s process_line
move.b %d3, %d2
move.w (%a1, %d2.l * 2), %d6
move.w %d6, 2 * LCD_WIDTH * 2(%a0)
suba.l %a4, %a0
lsr.l #8, %d3
move.b %d3, %d2
move.w (%a1, %d2.l * 2), %d6
move.w %d6, 1 * LCD_WIDTH * 2(%a0)
bsr.s process_line
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
suba.l %a4, %a0
subq.l #1, %d0
bne y_loop
bne bd_y_loop
movem.l (%sp), %d2-%d6/%a2
lea.l 28(%sp), %sp
movem.l (%sp), %d2-%d7/%a2-%a4
lea.l BD_SAVE(%sp), %sp
rts
#endif /* defined(IRIVER_H300_SERIES) && !defined(SIMULATOR) */
/* See arcade.c for the C implementation of drawChar */
/* Note! This version does not handle flipped screen mode. */
.global drawChar
#define DC_SAVE (4 * 4)
drawChar:
lea -DC_SAVE(%sp), %sp
movem.l %d2-%d5, (%sp)
movea.l DC_SAVE + 4(%sp), %a0 // buffer
move.l DC_SAVE + 16(%sp), %d0 // oy
move.l %d0, %d1
lsl.l #8, %d0
lsl.l #5, %d1
sub.l %d1, %d0
adda.l %d0, %a0
adda.l DC_SAVE + 12(%sp), %a0 // ox
move.l DC_SAVE + 20(%sp), %d0 // color
and.l #0x3F, %d0
bne.s have_color
moveq.l #8, %d1
moveq.l #0, %d2
moveq.l #0, %d3
clear_loop:
movem.l %d2-%d3, (%a0)
lea 224(%a0), %a0
subq.l #1, %d1
bne.s clear_loop
bra.s dc_exit
have_color:
lsl.l #2, %d0
lea.l charmap_, %a1
move.l DC_SAVE + 8(%sp), %d2 // index
lsl.l #6, %d2
adda.l %d2, %a1
moveq.l #8, %d1
moveq.l #0, %d3
moveq.l #24, %d5
dc_y_loop:
move.l (%a1)+, %d3
move.l %d3, %d4
move.l %d3, %d2 // Pixel 1
lsr.l %d5, %d2
add.l %d0, %d2
lsl.l #8, %d2
swap.w %d4 // Pixel 2
move.b %d4, %d2
add.l %d0, %d2
lsl.l #8, %d2
lsr.l #8, %d3 // Pixel 3
move.b %d3, %d2
add.l %d0, %d2
lsl.l #8, %d2
swap.w %d4 // Pixel 4
move.b %d4, %d2
add.l %d0, %d2
move.l %d2, (%a0)+
move.l (%a1)+, %d3
move.l %d3, %d4
move.l %d3, %d2 // Pixel 1
lsr.l %d5, %d2
add.l %d0, %d2
lsl.l #8, %d2
swap.w %d4 // Pixel 2
move.b %d4, %d2
add.l %d0, %d2
lsl.l #8, %d2
lsr.l #8, %d3 // Pixel 3
move.b %d3, %d2
add.l %d0, %d2
lsl.l #8, %d2
swap.w %d4 // Pixel 4
move.b %d4, %d2
add.l %d0, %d2
move.l %d2, (%a0)+
lea 216(%a0), %a0
subq.l #1, %d1
bne.s dc_y_loop
dc_exit:
movem.l (%sp), %d2-%d5
lea.l DC_SAVE(%sp), %sp
rts

View file

@ -26,6 +26,8 @@
#include "arcade.h"
#include "hardware.h"
#if defined(SIMULATOR) || !defined(IRIVER_H300_SERIES)
void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf)
{
fb_data* dst;
@ -103,3 +105,5 @@ void blit_display(fb_data* lcd_framebuffer, unsigned char* vbuf)
#endif /* Size >= 144x112 */
#endif /* Not Colour */
}
#endif