mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
gfx_cd finished, bugfixes
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@76 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
528ec9568f
commit
00bd648e63
6 changed files with 56 additions and 40 deletions
|
@ -245,7 +245,8 @@ int PicoCdLoadState(void *file)
|
||||||
wram_2M_to_1M(Pico_mcd->word_ram2M);
|
wram_2M_to_1M(Pico_mcd->word_ram2M);
|
||||||
#ifdef _ASM_CD_MEMORY_C
|
#ifdef _ASM_CD_MEMORY_C
|
||||||
PicoMemResetCD(Pico_mcd->s68k_regs[3]);
|
PicoMemResetCD(Pico_mcd->s68k_regs[3]);
|
||||||
PicoMemResetCDdecode(Pico_mcd->s68k_regs[3]);
|
if (Pico_mcd->s68k_regs[3]&4)
|
||||||
|
PicoMemResetCDdecode(Pico_mcd->s68k_regs[3]);
|
||||||
#endif
|
#endif
|
||||||
if (Pico_mcd->m.audio_track > 0 && Pico_mcd->m.audio_track < Pico_mcd->TOC.Last_Track)
|
if (Pico_mcd->m.audio_track > 0 && Pico_mcd->m.audio_track < Pico_mcd->TOC.Last_Track)
|
||||||
mp3_start_play(Pico_mcd->TOC.Tracks[Pico_mcd->m.audio_track].F, Pico_mcd->m.audio_offset);
|
mp3_start_play(Pico_mcd->TOC.Tracks[Pico_mcd->m.audio_track].F, Pico_mcd->m.audio_offset);
|
||||||
|
|
|
@ -199,6 +199,8 @@ PicoMemResetCD: @ r3
|
||||||
|
|
||||||
|
|
||||||
PicoMemResetCDdecode: @r3
|
PicoMemResetCDdecode: @r3
|
||||||
|
tst r3, #4
|
||||||
|
bxeq lr @ we should not be called in 2M mode
|
||||||
ldr r1, =m_s68k_write8_table
|
ldr r1, =m_s68k_write8_table
|
||||||
ldr r3, =m_s68k_decode_write_table
|
ldr r3, =m_s68k_decode_write_table
|
||||||
and r2, r0, #0x18
|
and r2, r0, #0x18
|
||||||
|
@ -336,7 +338,7 @@ PicoWriteS68k32: @ u32 a, u32 d
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
|
||||||
@ r0=prt1, r1=ptr2
|
@ r0=prt1, r1=ptr2; unaligned ptr MUST be r0
|
||||||
.macro m_read32_gen
|
.macro m_read32_gen
|
||||||
tst r0, #2
|
tst r0, #2
|
||||||
ldrneh r0, [r1, r0]!
|
ldrneh r0, [r1, r0]!
|
||||||
|
@ -347,7 +349,7 @@ PicoWriteS68k32: @ u32 a, u32 d
|
||||||
.endm
|
.endm
|
||||||
|
|
||||||
|
|
||||||
@ r0=prt1, r1=data, r2=ptr2
|
@ r0=prt1, r1=data, r2=ptr2; unaligned ptr MUST be r0
|
||||||
.macro m_write32_gen
|
.macro m_write32_gen
|
||||||
tst r0, #2
|
tst r0, #2
|
||||||
mov r1, r1, ror #16
|
mov r1, r1, ror #16
|
||||||
|
@ -468,7 +470,7 @@ m_m68k_read8_system_io:
|
||||||
.long m_m68k_read8_r0d
|
.long m_m68k_read8_r0d
|
||||||
m_m68k_read8_r00:
|
m_m68k_read8_r00:
|
||||||
add r1, r1, #0x110000
|
add r1, r1, #0x110000
|
||||||
ldr r0, [r1, #30]
|
ldr r0, [r1, #0x30]
|
||||||
and r0, r0, #0x04000000 @ we need irq2 mask state
|
and r0, r0, #0x04000000 @ we need irq2 mask state
|
||||||
mov r0, r0, lsr #19
|
mov r0, r0, lsr #19
|
||||||
bx lr
|
bx lr
|
||||||
|
@ -842,11 +844,12 @@ m_m68k_read32_system_io:
|
||||||
movge r0, #0
|
movge r0, #0
|
||||||
bxge lr
|
bxge lr
|
||||||
@ I have seen the range 0x0e-0x2f accessed quite frequently with long i/o, so here is some code for that
|
@ I have seen the range 0x0e-0x2f accessed quite frequently with long i/o, so here is some code for that
|
||||||
ldr r0, =(Pico+0x22200)
|
mov r0, r1
|
||||||
|
ldr r1, =(Pico+0x22200)
|
||||||
mov r2, #0xff
|
mov r2, #0xff
|
||||||
ldr r0, [r0]
|
ldr r1, [r1]
|
||||||
orr r2, r2, r2, lsl #16
|
orr r2, r2, r2, lsl #16
|
||||||
add r0, r0, #0x110000
|
add r1, r1, #0x110000
|
||||||
m_read32_gen
|
m_read32_gen
|
||||||
and r1, r2, r0 @ data is big-endian read as little, have to byteswap
|
and r1, r2, r0 @ data is big-endian read as little, have to byteswap
|
||||||
and r0, r2, r0, lsr #8
|
and r0, r2, r0, lsr #8
|
||||||
|
|
|
@ -51,7 +51,7 @@ int PicoResetMCD(int hard)
|
||||||
gfx_cd_reset();
|
gfx_cd_reset();
|
||||||
#ifdef _ASM_CD_MEMORY_C
|
#ifdef _ASM_CD_MEMORY_C
|
||||||
PicoMemResetCD(1);
|
PicoMemResetCD(1);
|
||||||
PicoMemResetCDdecode(1);
|
//PicoMemResetCDdecode(1); // don't have to call this in 2M mode
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -79,18 +79,14 @@ static void gfx_completed(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void gfx_do(void)
|
static void gfx_do(unsigned int func, unsigned short *stamp_base, unsigned int H_Dot)
|
||||||
{
|
{
|
||||||
unsigned int eax, ebx, ecx, edx, esi, edi, pixel;
|
unsigned int eax, ebx, ecx, edx, esi, edi, pixel;
|
||||||
unsigned int XD, Buffer_Adr, H_Dot;
|
unsigned int XD, Buffer_Adr;
|
||||||
unsigned int func = rot_comp.Function;
|
|
||||||
unsigned short *stamp_base;
|
|
||||||
int DYXS;
|
int DYXS;
|
||||||
|
|
||||||
XD = rot_comp.Reg_60 & 7;
|
XD = rot_comp.Reg_60 & 7;
|
||||||
Buffer_Adr = ((rot_comp.Reg_5E & 0xfff8) + rot_comp.YD) << 2;
|
Buffer_Adr = ((rot_comp.Reg_5E & 0xfff8) + rot_comp.YD) << 2;
|
||||||
stamp_base = (unsigned short *) (Pico_mcd->word_ram2M + rot_comp.Stamp_Map_Adr);
|
|
||||||
H_Dot = rot_comp.Reg_62 & 0x1ff;
|
|
||||||
ecx = *(unsigned int *)(Pico_mcd->word_ram2M + rot_comp.Vector_Adr);
|
ecx = *(unsigned int *)(Pico_mcd->word_ram2M + rot_comp.Vector_Adr);
|
||||||
edx = ecx >> 16;
|
edx = ecx >> 16;
|
||||||
ecx = (ecx & 0xffff) << 8;
|
ecx = (ecx & 0xffff) << 8;
|
||||||
|
@ -105,29 +101,28 @@ static void gfx_do(void)
|
||||||
{
|
{
|
||||||
if (func & 4) // 16x16 screen
|
if (func & 4) // 16x16 screen
|
||||||
{
|
{
|
||||||
eax = (ecx >> (11+5)) & 0x007f;
|
ebx = ((ecx >> (11+5)) & 0x007f) |
|
||||||
ebx = (edx >> (11-2)) & 0x3f80;
|
((edx >> (11-2)) & 0x3f80);
|
||||||
}
|
}
|
||||||
else // 1x1 screen
|
else // 1x1 screen
|
||||||
{
|
{
|
||||||
eax = (ecx >> (11+5)) & 0x07;
|
ebx = ((ecx >> (11+5)) & 0x07) |
|
||||||
ebx = (edx >> (11+2)) & 0x38;
|
((edx >> (11+2)) & 0x38);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // mode 16x16 dot
|
else // mode 16x16 dot
|
||||||
{
|
{
|
||||||
if (func & 4) // 16x16 screen
|
if (func & 4) // 16x16 screen
|
||||||
{
|
{
|
||||||
eax = (ecx >> (11+4)) & 0x00ff;
|
ebx = ((ecx >> (11+4)) & 0x00ff) |
|
||||||
ebx = (edx >> (11-4)) & 0xff00;
|
((edx >> (11-4)) & 0xff00);
|
||||||
}
|
}
|
||||||
else // 1x1 screen
|
else // 1x1 screen
|
||||||
{
|
{
|
||||||
eax = (ecx >> (11+4)) & 0x0f;
|
ebx = ((ecx >> (11+4)) & 0x0f) |
|
||||||
ebx = (edx >> (11+0)) & 0xf0;
|
((edx >> (11+0)) & 0xf0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ebx += eax;
|
|
||||||
|
|
||||||
// MAKE_IMAGE_PIXEL
|
// MAKE_IMAGE_PIXEL
|
||||||
if (!(func & 1)) // NOT TILED
|
if (!(func & 1)) // NOT TILED
|
||||||
|
@ -141,12 +136,10 @@ static void gfx_do(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// esi = rot_comp.Stamp_Map_Adr;
|
edi = stamp_base[ebx];// | (stamp_base[ebx+1] << 16);
|
||||||
edi = stamp_base[ebx] | (stamp_base[ebx+1] << 16);
|
esi = (edi & 0x7ff) << 7;
|
||||||
esi = edi;
|
|
||||||
edi >>= (11+1);
|
|
||||||
esi = (esi & 0x7ff) << 7;
|
|
||||||
if (!esi) { pixel = 0; goto Pixel_Out; }
|
if (!esi) { pixel = 0; goto Pixel_Out; }
|
||||||
|
edi >>= (11+1);
|
||||||
edi &= (0x1c>>1);
|
edi &= (0x1c>>1);
|
||||||
eax = ecx;
|
eax = ecx;
|
||||||
ebx = edx;
|
ebx = edx;
|
||||||
|
@ -285,7 +278,7 @@ Next_Pixel:
|
||||||
// end while
|
// end while
|
||||||
|
|
||||||
|
|
||||||
//nothing_to_draw:
|
// nothing_to_draw:
|
||||||
rot_comp.YD++;
|
rot_comp.YD++;
|
||||||
// rot_comp.V_Dot--; // will be done by caller
|
// rot_comp.V_Dot--; // will be done by caller
|
||||||
}
|
}
|
||||||
|
@ -293,12 +286,12 @@ Next_Pixel:
|
||||||
|
|
||||||
void gfx_cd_update(void)
|
void gfx_cd_update(void)
|
||||||
{
|
{
|
||||||
unsigned char *V_Dot = (unsigned char *) &rot_comp.Reg_64;
|
int V_Dot = rot_comp.Reg_64 & 0xff;
|
||||||
int jobs;
|
int jobs;
|
||||||
|
|
||||||
dprintf("gfx_cd_update, Reg_64 = %04x", rot_comp.Reg_64);
|
dprintf("gfx_cd_update, Reg_64 = %04x", rot_comp.Reg_64);
|
||||||
|
|
||||||
if (!*V_Dot)
|
if (!V_Dot)
|
||||||
{
|
{
|
||||||
gfx_completed();
|
gfx_completed();
|
||||||
return;
|
return;
|
||||||
|
@ -315,20 +308,36 @@ void gfx_cd_update(void)
|
||||||
rot_comp.Float_Part &= 0xffff;
|
rot_comp.Float_Part &= 0xffff;
|
||||||
rot_comp.Float_Part += rot_comp.Draw_Speed;
|
rot_comp.Float_Part += rot_comp.Draw_Speed;
|
||||||
|
|
||||||
while (jobs--)
|
if (PicoOpt & 0x1000) // scale/rot enabled
|
||||||
{
|
{
|
||||||
if (PicoOpt & 0x1000)
|
unsigned int func = rot_comp.Function;
|
||||||
gfx_do(); // jmp [Jmp_Adr]:
|
unsigned int H_Dot = rot_comp.Reg_62 & 0x1ff;
|
||||||
|
unsigned short *stamp_base = (unsigned short *) (Pico_mcd->word_ram2M + rot_comp.Stamp_Map_Adr);
|
||||||
|
|
||||||
(*V_Dot)--; // dec byte [V_Dot]
|
while (jobs--)
|
||||||
|
{
|
||||||
if (!*V_Dot)
|
gfx_do(func, stamp_base, H_Dot); // jmp [Jmp_Adr]:
|
||||||
|
|
||||||
|
V_Dot--; // dec byte [V_Dot]
|
||||||
|
if (V_Dot == 0)
|
||||||
|
{
|
||||||
|
// GFX_Completed:
|
||||||
|
gfx_completed();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (jobs >= V_Dot)
|
||||||
{
|
{
|
||||||
// GFX_Completed:
|
|
||||||
gfx_completed();
|
gfx_completed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
V_Dot -= jobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rot_comp.Reg_64 = V_Dot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
extern volatile unsigned short *gp2x_memregs; /* from minimal library rlyeh */
|
extern volatile unsigned short *gp2x_memregs; /* from minimal library rlyeh */
|
||||||
extern volatile unsigned long *gp2x_memregl;
|
extern volatile unsigned long *gp2x_memregl;
|
||||||
|
|
||||||
|
extern int reset_timing;
|
||||||
static unsigned char *shared_mem = 0;
|
static unsigned char *shared_mem = 0;
|
||||||
static _940_data_t *shared_data = 0;
|
static _940_data_t *shared_data = 0;
|
||||||
_940_ctl_t *shared_ctl = 0;
|
_940_ctl_t *shared_ctl = 0;
|
||||||
|
@ -589,6 +590,7 @@ void mp3_start_play(FILE *f, int pos) // pos is 0-1023
|
||||||
if (CHECK_BUSY(JOB940_MP3DECODE)) wait_busy_940(JOB940_MP3DECODE);
|
if (CHECK_BUSY(JOB940_MP3DECODE)) wait_busy_940(JOB940_MP3DECODE);
|
||||||
add_job_940(JOB940_INVALIDATE_DCACHE);
|
add_job_940(JOB940_INVALIDATE_DCACHE);
|
||||||
}
|
}
|
||||||
|
reset_timing = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// seek..
|
// seek..
|
||||||
|
|
|
@ -54,13 +54,14 @@ extern int crashed_940;
|
||||||
static short sndBuffer[2*44100/50];
|
static short sndBuffer[2*44100/50];
|
||||||
static char noticeMsg[64]; // notice msg to draw
|
static char noticeMsg[64]; // notice msg to draw
|
||||||
static struct timeval noticeMsgTime = { 0, 0 }; // when started showing
|
static struct timeval noticeMsgTime = { 0, 0 }; // when started showing
|
||||||
static int reset_timing, osd_fps_x;
|
static int osd_fps_x;
|
||||||
static int combo_keys = 0, combo_acts = 0; // keys and actions which need button combos
|
static int combo_keys = 0, combo_acts = 0; // keys and actions which need button combos
|
||||||
static int gp2x_old_gamma = 100;
|
static int gp2x_old_gamma = 100;
|
||||||
static unsigned char *movie_data = NULL;
|
static unsigned char *movie_data = NULL;
|
||||||
static int movie_size = 0;
|
static int movie_size = 0;
|
||||||
unsigned char *framebuff = 0; // temporary buffer for alt renderer
|
unsigned char *framebuff = 0; // temporary buffer for alt renderer
|
||||||
int state_slot = 0;
|
int state_slot = 0;
|
||||||
|
int reset_timing = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// tmp
|
// tmp
|
||||||
|
@ -1191,7 +1192,7 @@ void emu_Loop(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
updateKeys();
|
updateKeys();
|
||||||
SkipFrame(tval.tv_usec < lim_time+target_frametime); frames_done++;
|
SkipFrame(tval.tv_usec < lim_time+target_frametime*2); frames_done++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue