mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
fast dma
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@35 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
e11c55481f
commit
cea6590346
10 changed files with 69 additions and 99 deletions
26
Pico/Misc.c
26
Pico/Misc.c
|
@ -85,7 +85,7 @@ const unsigned char hcounts_32[] = {
|
||||||
0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0c,0x0d,
|
0x0a,0x0b,0x0b,0x0b,0x0c,0x0c,0x0c,0x0d,
|
||||||
};
|
};
|
||||||
|
|
||||||
// vcounter values for PicoFrameSimple
|
// vcounter values for PicoFrameSimple
|
||||||
const unsigned short vcounts[] = {
|
const unsigned short vcounts[] = {
|
||||||
0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7,
|
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,
|
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;
|
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
|
||||||
|
|
||||||
|
|
|
@ -289,6 +289,9 @@ unsigned int PicoVideoRead(unsigned int a);
|
||||||
void SRAMWriteEEPROM(unsigned int d);
|
void SRAMWriteEEPROM(unsigned int d);
|
||||||
unsigned int SRAMReadEEPROM();
|
unsigned int SRAMReadEEPROM();
|
||||||
void SRAMUpdPending(unsigned int a, unsigned int d);
|
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
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -139,15 +139,24 @@ static void DmaSlow(int len)
|
||||||
{
|
{
|
||||||
case 1: // vram
|
case 1: // vram
|
||||||
r = Pico.vram;
|
r = Pico.vram;
|
||||||
for(; len; len--)
|
if (inc == 2 && !(a&1) && a+len*2 < 0x10000)
|
||||||
{
|
{
|
||||||
d=*pd++;
|
// most used DMA mode
|
||||||
if(a&1) d=(d<<8)|(d>>8);
|
memcpy16(r + (a>>1), pd, len);
|
||||||
r[a>>1] = (u16)d; // will drop the upper bits
|
a += len*2;
|
||||||
// AutoIncrement
|
}
|
||||||
a=(u16)(a+inc);
|
else
|
||||||
// didn't src overlap?
|
{
|
||||||
//if(pd >= pdend) pd-=0x8000; // should be good for RAM, bad for ROM
|
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;
|
rendstatus|=0x10;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -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)
|
void mix_32_to_16l_stereo(short *dest, int *src, int count)
|
||||||
{
|
{
|
||||||
int l, r;
|
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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -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_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(int *dest, short *src, int count);
|
||||||
void mix_16h_to_32_s1(int *dest, short *src, int count);
|
void mix_16h_to_32_s1(int *dest, short *src, int count);
|
||||||
|
|
|
@ -1,63 +1,5 @@
|
||||||
@ vim:filetype=armasm
|
@ 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
|
@ this assumes src is word aligned
|
||||||
.global mix_16h_to_32 @ int *dest, short *src, int count
|
.global mix_16h_to_32 @ int *dest, short *src, int count
|
||||||
|
|
|
@ -112,7 +112,6 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "ym2612.h"
|
#include "ym2612.h"
|
||||||
#include "mix.h"
|
|
||||||
|
|
||||||
#ifndef EXTERNAL_YM2612
|
#ifndef EXTERNAL_YM2612
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -125,6 +124,8 @@ extern YM2612 *ym2612_940;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void memset32(int *dest, int c, int count);
|
||||||
|
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
#pragma warning (disable:4100) // unreferenced formal parameter
|
#pragma warning (disable:4100) // unreferenced formal parameter
|
||||||
|
|
|
@ -11,6 +11,7 @@ dprint = 1
|
||||||
asm_memory = 0 # TODO
|
asm_memory = 0 # TODO
|
||||||
asm_render = 1
|
asm_render = 1
|
||||||
asm_ym2612 = 1
|
asm_ym2612 = 1
|
||||||
|
asm_misc = 1
|
||||||
#profile = 1
|
#profile = 1
|
||||||
#use_musashi = 1
|
#use_musashi = 1
|
||||||
#up = 1
|
#up = 1
|
||||||
|
@ -55,6 +56,10 @@ ifeq "$(asm_ym2612)" "1"
|
||||||
DEFINC += -D_ASM_YM2612_C
|
DEFINC += -D_ASM_YM2612_C
|
||||||
OBJS += ../../Pico/sound/ym2612_asm.o
|
OBJS += ../../Pico/sound/ym2612_asm.o
|
||||||
endif
|
endif
|
||||||
|
ifeq "$(asm_misc)" "1"
|
||||||
|
DEFINC += -D_ASM_MISC_C
|
||||||
|
OBJS += ../../Pico/misc_asm.o
|
||||||
|
endif
|
||||||
# Pico - sound
|
# Pico - sound
|
||||||
OBJS += ../../Pico/sound/mix_asm.o
|
OBJS += ../../Pico/sound/mix_asm.o
|
||||||
OBJS += ../../Pico/sound/sound.o ../../Pico/sound/sn76496.o ../../Pico/sound/ym2612.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
|
../../Pico/sound/mix_asm.o : ../../Pico/sound/mix.s
|
||||||
@echo $<
|
@echo $<
|
||||||
@$(AS) $(ASOPT) $< -o $@
|
@$(AS) $(ASOPT) $< -o $@
|
||||||
|
../../Pico/misc_asm.o : ../../Pico/misc.s
|
||||||
|
@echo $<
|
||||||
|
@$(AS) $(ASOPT) $< -o $@
|
||||||
|
|
||||||
# build Cyclone
|
# build Cyclone
|
||||||
../../cpu/Cyclone/proj/Cyclone.s :
|
../../cpu/Cyclone/proj/Cyclone.s :
|
||||||
|
|
|
@ -1232,6 +1232,7 @@ if (Pico.m.frame_count == 31563) {
|
||||||
// if in 16bit mode, generate 8it image for menu background
|
// if in 16bit mode, generate 8it image for menu background
|
||||||
if (!(PicoOpt&0x10) && (currentConfig.EmuOpt&0x80)) {
|
if (!(PicoOpt&0x10) && (currentConfig.EmuOpt&0x80)) {
|
||||||
PicoOpt |= 0x10;
|
PicoOpt |= 0x10;
|
||||||
|
Pico.m.dirtyPal = 1;
|
||||||
PicoFrameFull();
|
PicoFrameFull();
|
||||||
blit("", NULL); blit("", NULL); blit("", NULL); blit("", NULL); // be sure buffer3 gets updated
|
blit("", NULL); blit("", NULL); blit("", NULL); blit("", NULL); // be sure buffer3 gets updated
|
||||||
PicoOpt &= ~0x10;
|
PicoOpt &= ~0x10;
|
||||||
|
|
|
@ -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)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue