From: notaz Date: Fri, 9 Feb 2007 23:39:03 +0000 (+0000) Subject: fast dma X-Git-Tag: v1.85~754 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cea6590346640236914eeff840401c55db8a77ce;p=picodrive.git fast dma git-svn-id: file:///home/notaz/opt/svn/PicoDrive@35 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/Pico/Misc.c b/Pico/Misc.c index 887e90cc..12fe7c4d 100644 --- a/Pico/Misc.c +++ b/Pico/Misc.c @@ -85,7 +85,7 @@ const unsigned char hcounts_32[] = { 0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0c,0x0d, }; -// vcounter values for PicoFrameSimple +// vcounter values for PicoFrameSimple const unsigned short vcounts[] = { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, @@ -303,3 +303,27 @@ void SRAMUpdPending(unsigned int a, unsigned int d) Pico.m.sram_reg = (unsigned char) sreg; } + + +#ifndef _ASM_MISC_C +void memcpy16(unsigned short *dest, unsigned short *src, int count) +{ + while (count--) + *dest++ = *src++; +} + + +void memcpy32(int *dest, int *src, int count) +{ + while (count--) + *dest++ = *src++; +} + + +void memset32(int *dest, int c, int count) +{ + while (count--) + *dest++ = c; +} +#endif + diff --git a/Pico/PicoInt.h b/Pico/PicoInt.h index b17277f2..6168a7b1 100644 --- a/Pico/PicoInt.h +++ b/Pico/PicoInt.h @@ -289,6 +289,9 @@ unsigned int PicoVideoRead(unsigned int a); void SRAMWriteEEPROM(unsigned int d); unsigned int SRAMReadEEPROM(); void SRAMUpdPending(unsigned int a, unsigned int d); +void memcpy16(unsigned short *dest, unsigned short *src, int count); +void memcpy32(int *dest, int *src, int count); +void memset32(int *dest, int c, int count); #ifdef __cplusplus diff --git a/Pico/VideoPort.c b/Pico/VideoPort.c index b7a05f05..e3643df8 100644 --- a/Pico/VideoPort.c +++ b/Pico/VideoPort.c @@ -139,15 +139,24 @@ static void DmaSlow(int len) { case 1: // vram r = Pico.vram; - for(; len; len--) + if (inc == 2 && !(a&1) && a+len*2 < 0x10000) { - d=*pd++; - if(a&1) d=(d<<8)|(d>>8); - r[a>>1] = (u16)d; // will drop the upper bits - // AutoIncrement - a=(u16)(a+inc); - // didn't src overlap? - //if(pd >= pdend) pd-=0x8000; // should be good for RAM, bad for ROM + // most used DMA mode + memcpy16(r + (a>>1), pd, len); + a += len*2; + } + else + { + for(; len; len--) + { + d=*pd++; + if(a&1) d=(d<<8)|(d>>8); + r[a>>1] = (u16)d; // will drop the upper bits + // AutoIncrement + a=(u16)(a+inc); + // didn't src overlap? + //if(pd >= pdend) pd-=0x8000; // should be good for RAM, bad for ROM + } } rendstatus|=0x10; break; diff --git a/Pico/sound/mix.c b/Pico/sound/mix.c index 8e4a6315..4d68f1d7 100644 --- a/Pico/sound/mix.c +++ b/Pico/sound/mix.c @@ -8,22 +8,6 @@ } - - -void memcpy32(int *dest, int *src, int count) -{ - while (count--) - *dest++ = *src++; -} - - -void memset32(int *dest, int c, int count) -{ - while (count--) - *dest++ = c; -} - - void mix_32_to_16l_stereo(short *dest, int *src, int count) { int l, r; @@ -55,3 +39,16 @@ void mix_32_to_16_mono(short *dest, int *src, int count) } +/* unimplemented... */ +void mix_16h_to_32(int *dest_buf, short *mp3_buf, int count) +{ +} + +void mix_16h_to_32_s1(int *dest_buf, short *mp3_buf, int count) +{ +} + +void mix_16h_to_32_s2(int *dest_buf, short *mp3_buf, int count) +{ +} + diff --git a/Pico/sound/mix.h b/Pico/sound/mix.h index 752cfb68..be1b43b8 100644 --- a/Pico/sound/mix.h +++ b/Pico/sound/mix.h @@ -1,6 +1,4 @@ -void memcpy32(int *dest, int *src, int count); -void memset32(int *dest, int c, int count); //void mix_32_to_32(int *dest, int *src, int count); void mix_16h_to_32(int *dest, short *src, int count); void mix_16h_to_32_s1(int *dest, short *src, int count); diff --git a/Pico/sound/mix.s b/Pico/sound/mix.s index d34a2735..bc350270 100644 --- a/Pico/sound/mix.s +++ b/Pico/sound/mix.s @@ -1,63 +1,5 @@ @ vim:filetype=armasm -.global memcpy32 @ int *dest, int *src, int count - -memcpy32: - stmfd sp!, {r4,lr} - - subs r2, r2, #4 - bmi mcp32_fin - -mcp32_loop: - ldmia r1!, {r3,r4,r12,lr} - subs r2, r2, #4 - stmia r0!, {r3,r4,r12,lr} - bpl mcp32_loop - -mcp32_fin: - tst r2, #3 - ldmeqfd sp!, {r4,pc} - tst r2, #1 - ldrne r3, [r1], #4 - strne r3, [r0], #4 - -mcp32_no_unal1: - tst r2, #2 - ldmneia r1!, {r3,r12} - ldmfd sp!, {r4,lr} - stmneia r0!, {r3,r12} - bx lr - - - -.global memset32 @ int *dest, int c, int count - -memset32: - stmfd sp!, {lr} - - mov r3, r1 - subs r2, r2, #4 - bmi mst32_fin - - mov r12,r1 - mov lr, r1 - -mst32_loop: - subs r2, r2, #4 - stmia r0!, {r1,r3,r12,lr} - bpl mst32_loop - -mst32_fin: - tst r2, #1 - strne r1, [r0], #4 - - tst r2, #2 - stmneia r0!, {r1,r3} - - ldmfd sp!, {lr} - bx lr - - @ this assumes src is word aligned .global mix_16h_to_32 @ int *dest, short *src, int count diff --git a/Pico/sound/ym2612.c b/Pico/sound/ym2612.c index 75d5ad32..3c3b17e6 100644 --- a/Pico/sound/ym2612.c +++ b/Pico/sound/ym2612.c @@ -112,7 +112,6 @@ #include #include "ym2612.h" -#include "mix.h" #ifndef EXTERNAL_YM2612 #include @@ -125,6 +124,8 @@ extern YM2612 *ym2612_940; #endif +void memset32(int *dest, int c, int count); + #ifndef __GNUC__ #pragma warning (disable:4100) // unreferenced formal parameter diff --git a/platform/gp2x/Makefile b/platform/gp2x/Makefile index d4de0ec9..899f05fb 100644 --- a/platform/gp2x/Makefile +++ b/platform/gp2x/Makefile @@ -11,6 +11,7 @@ dprint = 1 asm_memory = 0 # TODO asm_render = 1 asm_ym2612 = 1 +asm_misc = 1 #profile = 1 #use_musashi = 1 #up = 1 @@ -55,6 +56,10 @@ ifeq "$(asm_ym2612)" "1" DEFINC += -D_ASM_YM2612_C OBJS += ../../Pico/sound/ym2612_asm.o endif +ifeq "$(asm_misc)" "1" +DEFINC += -D_ASM_MISC_C +OBJS += ../../Pico/misc_asm.o +endif # Pico - sound OBJS += ../../Pico/sound/mix_asm.o OBJS += ../../Pico/sound/sound.o ../../Pico/sound/sn76496.o ../../Pico/sound/ym2612.o @@ -128,6 +133,9 @@ testrefr.gpe : test.o gp2x.o asmutils.o ../../Pico/sound/mix_asm.o : ../../Pico/sound/mix.s @echo $< @$(AS) $(ASOPT) $< -o $@ +../../Pico/misc_asm.o : ../../Pico/misc.s + @echo $< + @$(AS) $(ASOPT) $< -o $@ # build Cyclone ../../cpu/Cyclone/proj/Cyclone.s : diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index 36408f48..a5a46eac 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -1232,6 +1232,7 @@ if (Pico.m.frame_count == 31563) { // if in 16bit mode, generate 8it image for menu background if (!(PicoOpt&0x10) && (currentConfig.EmuOpt&0x80)) { PicoOpt |= 0x10; + Pico.m.dirtyPal = 1; PicoFrameFull(); blit("", NULL); blit("", NULL); blit("", NULL); blit("", NULL); // be sure buffer3 gets updated PicoOpt &= ~0x10; diff --git a/platform/linux/940ctl_ym2612.c b/platform/linux/940ctl_ym2612.c index 86435e46..451c9429 100644 --- a/platform/linux/940ctl_ym2612.c +++ b/platform/linux/940ctl_ym2612.c @@ -224,16 +224,3 @@ int mp3_get_offset(void) } -/* unimplemented... */ -void mix_16h_to_32(int *dest_buf, short *mp3_buf, int count) -{ -} - -void mix_16h_to_32_s1(int *dest_buf, short *mp3_buf, int count) -{ -} - -void mix_16h_to_32_s2(int *dest_buf, short *mp3_buf, int count) -{ -} -