PicoResetHook = NULL;\r
PicoLineHook = NULL;\r
\r
+ PicoMemReset();\r
+\r
if (!(PicoMCD & 1))\r
PicoCartDetect();\r
\r
// setup correct memory map for loaded ROM\r
+ // call PicoMemReset again due to possible memmap change\r
if (PicoMCD & 1)\r
PicoMemSetupCD();\r
else PicoMemSetup();\r
tst r1, #5\r
bne SRAMRead\r
m_read8_ar_nosram:\r
+ ldr r2, =PicoRead16Hook\r
stmfd sp!,{r0,lr}\r
+ ldr r2, [r2]\r
bic r0, r0, #1\r
mov r1, #8\r
- bl OtherRead16End\r
+ mov lr, pc\r
+ bx r2\r
ldmfd sp!,{r1,lr}\r
tst r1, #1\r
moveq r0, r0, lsr #8\r
bl SRAMRead16\r
ldmfd sp!,{pc}\r
m_read16_ar_nosram:\r
+ ldr r2, =PicoRead16Hook\r
+ ldr r2, [r2]\r
mov r1, #16\r
- b OtherRead16End\r
+ bx r2\r
\r
.pool\r
\r
bx lr\r
\r
m_read32_above_rom:\r
+ ldr r2, =PicoRead16Hook\r
bic r0, r0, #1\r
- stmfd sp!,{r0,lr}\r
+ ldr r2, [r2]\r
mov r1, #32\r
- bl OtherRead16End\r
+ stmfd sp!,{r0,r2,lr}\r
+ mov lr, pc\r
+ bx r2\r
mov r1, r0\r
- ldmfd sp!,{r0}\r
+ ldmfd sp!,{r0,r2}\r
stmfd sp!,{r1}\r
add r0, r0, #2\r
mov r1, #32\r
- bl OtherRead16End\r
+ mov lr, pc\r
+ bx r2\r
ldmfd sp!,{r1,lr}\r
orr r0, r0, r1, lsl #16\r
bx lr\r
#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
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
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
# #############################################################################
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
# #############################################################################
# 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
# #############################################################################
int emustatus = 0; // rapid_ym2612, multi_ym_updates\r
void (*PicoWriteSound)(int len) = NULL; // called at the best time to send sound buffer (PsndOut) to hardware\r
void (*PicoResetHook)(void) = NULL;\r
-void (*PicoLineHook)(void) = NULL;\r
+void (*PicoLineHook)(int count) = NULL;\r
\r
struct PicoSRAM SRam = {0,};\r
int z80startCycle, z80stopCycle; // in 68k cycles\r
SekRunM68k(cycles_68k_block);\r
\r
PicoRunZ80Simple(line, lines);\r
+ if (PicoLineHook) PicoLineHook(lines_step);\r
line=lines;\r
}\r
\r
\r
lines += sects*lines_step;\r
PicoRunZ80Simple(line, lines);\r
+ if (PicoLineHook) PicoLineHook(sects*lines_step);\r
}\r
\r
// render screen\r
SekRunM68k(cycles_68k_vblock);\r
\r
PicoRunZ80Simple(line, lines);\r
+ if (PicoLineHook) PicoLineHook(lines_step);\r
line=lines;\r
\r
sects--;\r
if (sects) {\r
lines += sects*lines_step;\r
PicoRunZ80Simple(line, lines);\r
+ if (PicoLineHook) PicoLineHook(sects*lines_step);\r
}\r
\r
return 0;\r
}\r
#endif\r
\r
-#if 0\r
- {\r
- FILE *f = fopen("zram", "wb");\r
- fwrite(Pico.zram, 1, 0x2000, f);\r
- fclose(f);\r
- }\r
-#endif\r
-\r
return dstr;\r
}\r
#endif\r
extern int PicoSkipFrame; // skip rendering frame, but still do sound (if enabled) and emulation stuff\r
extern int PicoRegionOverride; // override the region detection 0: auto, 1: Japan NTSC, 2: Japan PAL, 4: US, 8: Europe\r
extern int PicoAutoRgnOrder; // packed priority list of regions, for example 0x148 means this detection order: EUR, USA, JAP\r
-int PicoInit(void);\r
+extern int PicoSVPCycles;\r
+int PicoInit(void);\r
void PicoExit(void);\r
-int PicoReset(int hard);\r
-int PicoFrame(void);\r
+int PicoReset(int hard);\r
+int PicoFrame(void);\r
void PicoFrameDrawOnly(void);\r
extern int PicoPad[2]; // Joypads, format is MXYZ SACB RLDU\r
extern void (*PicoWriteSound)(int len); // called once per frame at the best time to send sound buffer (PsndOut) to hardware\r
#ifdef PICO_CD
update_chips();
#else
- if (PicoLineHook) PicoLineHook();
+ if (PicoLineHook) PicoLineHook(1);
#endif
}
#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.
#ifdef PICO_CD
update_chips();
#else
- if (PicoLineHook) PicoLineHook();
+ if (PicoLineHook) PicoLineHook(1);
#endif
}
extern int emustatus;\r
extern int z80startCycle, z80stopCycle; // in 68k cycles\r
extern void (*PicoResetHook)(void);\r
-extern void (*PicoLineHook)(void);\r
+extern void (*PicoLineHook)(int count);\r
PICO_INTERNAL int CheckDMA(void);\r
\r
// cd/Pico.c\r
{\r
// Register write:\r
int num=(d>>8)&0x1f;\r
- if(num==00) elprintf(EL_INTSW, "hint_onoff: %i->%i [%i] pend=%i @ %06x", (pvid->reg[0]&0x10)>>4,\r
+ int dold=pvid->reg[num];\r
+ if (num > 0x0a && !(pvid->reg[1]&4)) {\r
+ elprintf(EL_ANOMALY, "%02x written to reg %02x in SMS mode @ %06x", d, num, SekPc);\r
+ } else\r
+ pvid->reg[num]=(unsigned char)d;\r
+ if (num==00) elprintf(EL_INTSW, "hint_onoff: %i->%i [%i] pend=%i @ %06x", (dold&0x10)>>4,\r
(d&0x10)>>4, SekCyclesDone(), (pvid->pending_ints&0x10)>>4, SekPc);\r
- if(num==01) elprintf(EL_INTSW, "vint_onoff: %i->%i [%i] pend=%i @ %06x", (pvid->reg[1]&0x20)>>5,\r
+ if (num==01) elprintf(EL_INTSW, "vint_onoff: %i->%i [%i] pend=%i @ %06x", (dold&0x20)>>5,\r
(d&0x20)>>5, SekCyclesDone(), (pvid->pending_ints&0x20)>>5, SekPc);\r
- //if(num==01) dprintf("set_blank: %i @ %06x [%i|%i]", !((d&0x40)>>6), SekPc, Pico.m.scanline, SekCyclesDone());\r
- //if(num==10) dprintf("hint_set: %i @ %06x [%i|%i]", (unsigned char)d, SekPc, Pico.m.scanline, SekCyclesDone());\r
- pvid->reg[num]=(unsigned char)d;\r
+ if (num == 5 && (d^dold)) rendstatus|=1;\r
+ // renderers should update their palettes if sh/hi mode is changed\r
+ else if (num == 0xc && ((d^dold)&8)) Pico.m.dirtyPal = 2;\r
#ifndef EMU_CORE_DEBUG\r
// update IRQ level (Lemmings, Wiz 'n' Liz intro, ... )\r
// may break if done improperly:\r
// International Superstar Soccer Deluxe (crash), Street Racer (logos), Burning Force (gfx),\r
// Fatal Rewind (crash), Sesame Street Counting Cafe\r
- if (num < 2)\r
+ else if (num < 2)\r
{\r
if (!SekShouldInterrupt) // hack\r
{\r
if (irq) SekEndRun(24); // make it delayed\r
}\r
}\r
- else\r
#endif\r
- if(num == 5) rendstatus|=1;\r
- else if(num == 0xc) Pico.m.dirtyPal = 2; // renderers should update their palettes if sh/hi mode is changed\r
pvid->type=0; // register writes clear command (else no Sega logo in Golden Axe II)\r
} else {\r
// High word of command:\r
#include "../../PicoInt.h"
svp_t *svp = NULL;
+int PicoSVPCycles = 800; // cycles/line
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;
}\r
\r
\r
-#ifndef _ASM_CD_MEMORY_C\r
static u32 OtherRead16End(u32 a, int realsize)\r
{\r
u32 d=0;\r
\r
+#ifndef _ASM_CD_MEMORY_C\r
if ((a&0xffffc0)==0xa12000) {\r
d=m68k_reg_read16(a);\r
goto end;\r
d=Pico_mcd->m.bcram_reg;\r
goto end;\r
}\r
+#endif\r
\r
elprintf(EL_UIO, "m68k FIXME: unusual r%i: %06x @%06x", realsize&~1, (a&0xfffffe)+(realsize&1), SekPc);\r
\r
+#ifndef _ASM_CD_MEMORY_C\r
end:\r
+#endif\r
return d;\r
}\r
\r
\r
static void OtherWrite8End(u32 a, u32 d, int realsize)\r
{\r
+#ifndef _ASM_CD_MEMORY_C\r
if ((a&0xffffc0)==0xa12000) { m68k_reg_write8(a, d); return; }\r
\r
if ((a&0xfe0000)==0x600000) {\r
Pico_mcd->m.bcram_reg=d;\r
return;\r
}\r
+#endif\r
\r
elprintf(EL_UIO, "m68k FIXME: strange w%i: [%06x], %08x @%06x", realsize, a&0xffffff, d, SekPc);\r
}\r
\r
+#ifndef _ASM_CD_MEMORY_C\r
#define _CD_MEMORY_C\r
#undef _ASM_MEMORY_C\r
#include "../MemoryCmn.c"\r
#include "cell_map.c"\r
-#endif // !def _ASM_CD_MEMORY_C\r
+#endif\r
\r
\r
// -----------------------------------------------------------------\r
.extern PicoVideoRead
.extern Read_CDC_Host
.extern m68k_reg_write8
-.extern OtherWrite8
.extern OtherWrite16
.extern gfx_cd_read
.extern s68k_reg_read16
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/gfx_cd.o \\r
../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o\r
endif\r
+# Pico - carthw\r
+OBJS += ../../Pico/carthw/svp/svp.o ../../Pico/carthw/svp/Memory.o ../../Pico/carthw/svp/ssp16.o\r
\r
# asm stuff\r
ifeq "$(asm_render)" "1"\r