mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
asm code updated, Bass Masters fix
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@330 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
689fb2c089
commit
0ffefdb8bd
13 changed files with 91 additions and 47 deletions
|
@ -498,10 +498,13 @@ int PicoCartInsert(unsigned char *rom,unsigned int romsize)
|
|||
PicoResetHook = NULL;
|
||||
PicoLineHook = NULL;
|
||||
|
||||
PicoMemReset();
|
||||
|
||||
if (!(PicoMCD & 1))
|
||||
PicoCartDetect();
|
||||
|
||||
// setup correct memory map for loaded ROM
|
||||
// call PicoMemReset again due to possible memmap change
|
||||
if (PicoMCD & 1)
|
||||
PicoMemSetupCD();
|
||||
else PicoMemSetup();
|
||||
|
|
|
@ -448,10 +448,13 @@ m_read8_above_rom:
|
|||
tst r1, #5
|
||||
bne SRAMRead
|
||||
m_read8_ar_nosram:
|
||||
ldr r2, =PicoRead16Hook
|
||||
stmfd sp!,{r0,lr}
|
||||
ldr r2, [r2]
|
||||
bic r0, r0, #1
|
||||
mov r1, #8
|
||||
bl OtherRead16End
|
||||
mov lr, pc
|
||||
bx r2
|
||||
ldmfd sp!,{r1,lr}
|
||||
tst r1, #1
|
||||
moveq r0, r0, lsr #8
|
||||
|
@ -595,8 +598,10 @@ m_read16_above_rom:
|
|||
bl SRAMRead16
|
||||
ldmfd sp!,{pc}
|
||||
m_read16_ar_nosram:
|
||||
ldr r2, =PicoRead16Hook
|
||||
ldr r2, [r2]
|
||||
mov r1, #16
|
||||
b OtherRead16End
|
||||
bx r2
|
||||
|
||||
.pool
|
||||
|
||||
|
@ -748,16 +753,20 @@ m_read32_ram:
|
|||
bx lr
|
||||
|
||||
m_read32_above_rom:
|
||||
ldr r2, =PicoRead16Hook
|
||||
bic r0, r0, #1
|
||||
stmfd sp!,{r0,lr}
|
||||
ldr r2, [r2]
|
||||
mov r1, #32
|
||||
bl OtherRead16End
|
||||
stmfd sp!,{r0,r2,lr}
|
||||
mov lr, pc
|
||||
bx r2
|
||||
mov r1, r0
|
||||
ldmfd sp!,{r0}
|
||||
ldmfd sp!,{r0,r2}
|
||||
stmfd sp!,{r1}
|
||||
add r0, r0, #2
|
||||
mov r1, #32
|
||||
bl OtherRead16End
|
||||
mov lr, pc
|
||||
bx r2
|
||||
ldmfd sp!,{r1,lr}
|
||||
orr r0, r0, r1, lsl #16
|
||||
bx lr
|
||||
|
|
|
@ -8,13 +8,6 @@ typedef unsigned int u32;
|
|||
#define UTYPES_DEFINED
|
||||
#endif
|
||||
|
||||
#ifdef _ASM_MEMORY_C
|
||||
u32 OtherRead16End(u32 a, int realsize);
|
||||
#endif
|
||||
#ifdef _ASM_CD_MEMORY_C
|
||||
static void OtherWrite8End(u32 a,u32 d,int realsize);
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _ASM_MEMORY_C
|
||||
static
|
||||
|
|
|
@ -435,16 +435,28 @@ m_read8_fake_ym2612:
|
|||
sb $t1, %lo(Pico+0x22208)($t0)
|
||||
|
||||
# delay slot friendly
|
||||
.macro m_read8_call16 funcname
|
||||
.macro m_read8_call16 funcname is_func_ptr=0
|
||||
.if \is_func_ptr
|
||||
lui $t1, %hi(\funcname)
|
||||
lw $t1, %lo(\funcname)($t1)
|
||||
.endif
|
||||
andi $t0, $a0, 1
|
||||
beqz $t0, 1f
|
||||
li $a1, 8 # not always needed, but shouln't cause problems
|
||||
.if \is_func_ptr
|
||||
jr $t1
|
||||
.else
|
||||
j \funcname # odd address
|
||||
.endif
|
||||
nop
|
||||
1:
|
||||
addiu $sp, -4
|
||||
sw $ra, 0($sp)
|
||||
.if \is_func_ptr
|
||||
jalr $t1
|
||||
.else
|
||||
jal \funcname
|
||||
.endif
|
||||
xori $a0, 1
|
||||
lw $ra, 0($sp)
|
||||
addiu $sp, 4
|
||||
|
@ -473,7 +485,7 @@ m_read8_ram:
|
|||
m_read8_above_rom:
|
||||
# might still be SRam (Micro Machines, HardBall '95)
|
||||
m_read_rom_try_sram 0 8
|
||||
m_read8_call16 OtherRead16End
|
||||
m_read8_call16 PicoRead16Hook 1
|
||||
|
||||
# #############################################################################
|
||||
|
||||
|
@ -584,7 +596,9 @@ m_read16_ram:
|
|||
m_read16_above_rom:
|
||||
# might still be SRam
|
||||
m_read_rom_try_sram 0 16
|
||||
j OtherRead16End
|
||||
lui $t1, %hi(PicoRead16Hook)
|
||||
lw $t1, %lo(PicoRead16Hook)($t1)
|
||||
jr $t1
|
||||
ins $a0, $0, 0, 1
|
||||
|
||||
# #############################################################################
|
||||
|
@ -725,7 +739,25 @@ m_read32_above_rom:
|
|||
# might still be SRam
|
||||
m_read_rom_try_sram 0 32
|
||||
ins $a0, $0, 0, 1
|
||||
m_read32_call16 OtherRead16End
|
||||
lui $t1, %hi(PicoRead16Hook)
|
||||
lw $t1, %lo(PicoRead16Hook)($t1)
|
||||
addiu $sp, -4*3
|
||||
sw $ra, 0($sp)
|
||||
sw $s0, 4($sp)
|
||||
sw $t1, 8($sp)
|
||||
jalr $t1
|
||||
move $s0, $a0
|
||||
|
||||
lw $t1, 8($sp)
|
||||
addu $a0, $s0, 2
|
||||
jalr $t1
|
||||
move $s0, $v0
|
||||
|
||||
ins $v0, $s0, 16, 16
|
||||
lw $ra, 0($sp)
|
||||
lw $s0, 4($sp)
|
||||
jr $ra
|
||||
addiu $sp, 4*3
|
||||
|
||||
# #############################################################################
|
||||
|
||||
|
|
14
Pico/Pico.c
14
Pico/Pico.c
|
@ -19,7 +19,7 @@ int PicoAutoRgnOrder = 0;
|
|||
int emustatus = 0; // rapid_ym2612, multi_ym_updates
|
||||
void (*PicoWriteSound)(int len) = NULL; // called at the best time to send sound buffer (PsndOut) to hardware
|
||||
void (*PicoResetHook)(void) = NULL;
|
||||
void (*PicoLineHook)(void) = NULL;
|
||||
void (*PicoLineHook)(int count) = NULL;
|
||||
|
||||
struct PicoSRAM SRam = {0,};
|
||||
int z80startCycle, z80stopCycle; // in 68k cycles
|
||||
|
@ -364,6 +364,7 @@ static int PicoFrameSimple(void)
|
|||
SekRunM68k(cycles_68k_block);
|
||||
|
||||
PicoRunZ80Simple(line, lines);
|
||||
if (PicoLineHook) PicoLineHook(lines_step);
|
||||
line=lines;
|
||||
}
|
||||
|
||||
|
@ -377,6 +378,7 @@ static int PicoFrameSimple(void)
|
|||
|
||||
lines += sects*lines_step;
|
||||
PicoRunZ80Simple(line, lines);
|
||||
if (PicoLineHook) PicoLineHook(sects*lines_step);
|
||||
}
|
||||
|
||||
// render screen
|
||||
|
@ -440,6 +442,7 @@ static int PicoFrameSimple(void)
|
|||
SekRunM68k(cycles_68k_vblock);
|
||||
|
||||
PicoRunZ80Simple(line, lines);
|
||||
if (PicoLineHook) PicoLineHook(lines_step);
|
||||
line=lines;
|
||||
|
||||
sects--;
|
||||
|
@ -450,6 +453,7 @@ static int PicoFrameSimple(void)
|
|||
if (sects) {
|
||||
lines += sects*lines_step;
|
||||
PicoRunZ80Simple(line, lines);
|
||||
if (PicoLineHook) PicoLineHook(sects*lines_step);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -577,14 +581,6 @@ char *debugString(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
{
|
||||
FILE *f = fopen("zram", "wb");
|
||||
fwrite(Pico.zram, 1, 0x2000, f);
|
||||
fclose(f);
|
||||
}
|
||||
#endif
|
||||
|
||||
return dstr;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -40,10 +40,11 @@ extern int PicoVer;
|
|||
extern int PicoSkipFrame; // skip rendering frame, but still do sound (if enabled) and emulation stuff
|
||||
extern int PicoRegionOverride; // override the region detection 0: auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe
|
||||
extern int PicoAutoRgnOrder; // packed priority list of regions, for example 0x148 means this detection order: EUR, USA, JAP
|
||||
int PicoInit(void);
|
||||
extern int PicoSVPCycles;
|
||||
int PicoInit(void);
|
||||
void PicoExit(void);
|
||||
int PicoReset(int hard);
|
||||
int PicoFrame(void);
|
||||
int PicoReset(int hard);
|
||||
int PicoFrame(void);
|
||||
void PicoFrameDrawOnly(void);
|
||||
extern int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU
|
||||
extern void (*PicoWriteSound)(int len); // called once per frame at the best time to send sound buffer (PsndOut) to hardware
|
||||
|
|
|
@ -150,7 +150,7 @@ static int PicoFrameHints(void)
|
|||
#ifdef PICO_CD
|
||||
update_chips();
|
||||
#else
|
||||
if (PicoLineHook) PicoLineHook();
|
||||
if (PicoLineHook) PicoLineHook(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ static int PicoFrameHints(void)
|
|||
#ifdef PICO_CD
|
||||
update_chips();
|
||||
#else
|
||||
if (PicoLineHook) PicoLineHook();
|
||||
if (PicoLineHook) PicoLineHook(1);
|
||||
#endif
|
||||
|
||||
// PAL line count might actually be 313 according to Steve Snake, but that would complicate things.
|
||||
|
@ -239,7 +239,7 @@ static int PicoFrameHints(void)
|
|||
#ifdef PICO_CD
|
||||
update_chips();
|
||||
#else
|
||||
if (PicoLineHook) PicoLineHook();
|
||||
if (PicoLineHook) PicoLineHook(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -410,7 +410,7 @@ extern struct PicoSRAM SRam;
|
|||
extern int emustatus;
|
||||
extern int z80startCycle, z80stopCycle; // in 68k cycles
|
||||
extern void (*PicoResetHook)(void);
|
||||
extern void (*PicoLineHook)(void);
|
||||
extern void (*PicoLineHook)(int count);
|
||||
PICO_INTERNAL int CheckDMA(void);
|
||||
|
||||
// cd/Pico.c
|
||||
|
|
|
@ -370,19 +370,24 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d)
|
|||
{
|
||||
// Register write:
|
||||
int num=(d>>8)&0x1f;
|
||||
if(num==00) elprintf(EL_INTSW, "hint_onoff: %i->%i [%i] pend=%i @ %06x", (pvid->reg[0]&0x10)>>4,
|
||||
int dold=pvid->reg[num];
|
||||
if (num > 0x0a && !(pvid->reg[1]&4)) {
|
||||
elprintf(EL_ANOMALY, "%02x written to reg %02x in SMS mode @ %06x", d, num, SekPc);
|
||||
} else
|
||||
pvid->reg[num]=(unsigned char)d;
|
||||
if (num==00) elprintf(EL_INTSW, "hint_onoff: %i->%i [%i] pend=%i @ %06x", (dold&0x10)>>4,
|
||||
(d&0x10)>>4, SekCyclesDone(), (pvid->pending_ints&0x10)>>4, SekPc);
|
||||
if(num==01) elprintf(EL_INTSW, "vint_onoff: %i->%i [%i] pend=%i @ %06x", (pvid->reg[1]&0x20)>>5,
|
||||
if (num==01) elprintf(EL_INTSW, "vint_onoff: %i->%i [%i] pend=%i @ %06x", (dold&0x20)>>5,
|
||||
(d&0x20)>>5, SekCyclesDone(), (pvid->pending_ints&0x20)>>5, SekPc);
|
||||
//if(num==01) dprintf("set_blank: %i @ %06x [%i|%i]", !((d&0x40)>>6), SekPc, Pico.m.scanline, SekCyclesDone());
|
||||
//if(num==10) dprintf("hint_set: %i @ %06x [%i|%i]", (unsigned char)d, SekPc, Pico.m.scanline, SekCyclesDone());
|
||||
pvid->reg[num]=(unsigned char)d;
|
||||
if (num == 5 && (d^dold)) rendstatus|=1;
|
||||
// renderers should update their palettes if sh/hi mode is changed
|
||||
else if (num == 0xc && ((d^dold)&8)) Pico.m.dirtyPal = 2;
|
||||
#ifndef EMU_CORE_DEBUG
|
||||
// update IRQ level (Lemmings, Wiz 'n' Liz intro, ... )
|
||||
// may break if done improperly:
|
||||
// International Superstar Soccer Deluxe (crash), Street Racer (logos), Burning Force (gfx),
|
||||
// Fatal Rewind (crash), Sesame Street Counting Cafe
|
||||
if (num < 2)
|
||||
else if (num < 2)
|
||||
{
|
||||
if (!SekShouldInterrupt) // hack
|
||||
{
|
||||
|
@ -396,10 +401,7 @@ PICO_INTERNAL_ASM void PicoVideoWrite(unsigned int a,unsigned short d)
|
|||
if (irq) SekEndRun(24); // make it delayed
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if(num == 5) rendstatus|=1;
|
||||
else if(num == 0xc) Pico.m.dirtyPal = 2; // renderers should update their palettes if sh/hi mode is changed
|
||||
pvid->type=0; // register writes clear command (else no Sega logo in Golden Axe II)
|
||||
} else {
|
||||
// High word of command:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "../../PicoInt.h"
|
||||
|
||||
svp_t *svp = NULL;
|
||||
int PicoSVPCycles = 800; // cycles/line
|
||||
|
||||
static void PicoSVPReset(void)
|
||||
{
|
||||
|
@ -11,12 +12,12 @@ static void PicoSVPReset(void)
|
|||
}
|
||||
|
||||
|
||||
static void PicoSVPLine(void)
|
||||
static void PicoSVPLine(int count)
|
||||
{
|
||||
// ???
|
||||
// OSC_NTSC / 3.0 / 60.0 / 262.0 ~= 1139
|
||||
// OSC_PAL / 3.0 / 50.0 / 312.0 ~= 1137
|
||||
ssp1601_run(800);
|
||||
ssp1601_run(PicoSVPCycles * count);
|
||||
|
||||
// test mode
|
||||
//if (Pico.m.frame_count == 13) PicoPad[0] |= 0xff;
|
||||
|
|
|
@ -376,11 +376,11 @@ void s68k_reg_write8(u32 a, u32 d)
|
|||
}
|
||||
|
||||
|
||||
#ifndef _ASM_CD_MEMORY_C
|
||||
static u32 OtherRead16End(u32 a, int realsize)
|
||||
{
|
||||
u32 d=0;
|
||||
|
||||
#ifndef _ASM_CD_MEMORY_C
|
||||
if ((a&0xffffc0)==0xa12000) {
|
||||
d=m68k_reg_read16(a);
|
||||
goto end;
|
||||
|
@ -403,16 +403,20 @@ static u32 OtherRead16End(u32 a, int realsize)
|
|||
d=Pico_mcd->m.bcram_reg;
|
||||
goto end;
|
||||
}
|
||||
#endif
|
||||
|
||||
elprintf(EL_UIO, "m68k FIXME: unusual r%i: %06x @%06x", realsize&~1, (a&0xfffffe)+(realsize&1), SekPc);
|
||||
|
||||
#ifndef _ASM_CD_MEMORY_C
|
||||
end:
|
||||
#endif
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
static void OtherWrite8End(u32 a, u32 d, int realsize)
|
||||
{
|
||||
#ifndef _ASM_CD_MEMORY_C
|
||||
if ((a&0xffffc0)==0xa12000) { m68k_reg_write8(a, d); return; }
|
||||
|
||||
if ((a&0xfe0000)==0x600000) {
|
||||
|
@ -427,15 +431,17 @@ static void OtherWrite8End(u32 a, u32 d, int realsize)
|
|||
Pico_mcd->m.bcram_reg=d;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
elprintf(EL_UIO, "m68k FIXME: strange w%i: [%06x], %08x @%06x", realsize, a&0xffffff, d, SekPc);
|
||||
}
|
||||
|
||||
#ifndef _ASM_CD_MEMORY_C
|
||||
#define _CD_MEMORY_C
|
||||
#undef _ASM_MEMORY_C
|
||||
#include "../MemoryCmn.c"
|
||||
#include "cell_map.c"
|
||||
#endif // !def _ASM_CD_MEMORY_C
|
||||
#endif
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
|
|
@ -128,7 +128,6 @@ m_s68k_decode_write_table:
|
|||
.extern PicoVideoRead
|
||||
.extern Read_CDC_Host
|
||||
.extern m68k_reg_write8
|
||||
.extern OtherWrite8
|
||||
.extern OtherWrite16
|
||||
.extern gfx_cd_read
|
||||
.extern s68k_reg_read16
|
||||
|
|
|
@ -73,6 +73,8 @@ OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pi
|
|||
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/gfx_cd.o \
|
||||
../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o
|
||||
endif
|
||||
# Pico - carthw
|
||||
OBJS += ../../Pico/carthw/svp/svp.o ../../Pico/carthw/svp/Memory.o ../../Pico/carthw/svp/ssp16.o
|
||||
|
||||
# asm stuff
|
||||
ifeq "$(asm_render)" "1"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue