#include <stdio.h>
#define lprintf printf
#elif defined(PSP)
- #if 0
+ #if 1
#include <stdio.h>
#define lprintf printf
#else
# settings
-dprint = 1
+use_fame = 1
+
# profile = 1
# unzip
OBJS += ../../unzip/unzip.o ../../unzip/unzip_stream.o
# CPU cores
+ifeq "$(use_fame)" "1"
+DEFINC += -DEMU_F68K
+OBJS += ../../cpu/fame/famec.o
+else
DEFINC += -DEMU_M68K
OBJS += ../../cpu/musashi/m68kops.o ../../cpu/musashi/m68kcpu.o
+endif
# mz80
DEFINC += -D_USE_MZ80
OBJS += ../../cpu/mz80/mz80.o
@echo $@
@$(GCC) $(COPT_COMMON) $(DEFINC) -c $< -o $@ # -mtune=arm940t -DEXTERNAL_YM2612
+../../cpu/fame/famec.o : ../../cpu/fame/famec.c
+ @echo $<
+ @$(GCC) $(COPT) $(DEFINC) -Wno-unused -c $< -o $@
+
PSPSDK = $(shell psp-config --pspsdk-path)\r
\r
# settings\r
-use_musashi = 1\r
+#use_musashi = 1\r
use_mz80 = 1\r
amalgamate = 0\r
#profile = 1\r
CFLAGS += -I../.. -I. -D_UNZIP_SUPPORT -DNO_SYNC # -DBENCHMARK\r
CFLAGS += -Wall -Winline\r
ifeq ($(DEBUG),)\r
-CFLAGS += -O2 -G0 -ftracer -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math\r
+CFLAGS += -O2 -G0 -ftracer -fstrength-reduce -ffast-math\r
else\r
CFLAGS += -ggdb\r
endif\r
else\r
OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Memory.o ../../Pico/Misc.o \\r
../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o \\r
- ../../Pico/Patch.o\r
+ ../../Pico/Patch.o ../../Pico/Draw_amips.o\r
# Pico - CD\r
OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \\r
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/gfx_cd.o \\r
ifeq "$(use_musashi)" "1"\r
CFLAGS += -DEMU_M68K\r
OBJS += ../../cpu/musashi/m68kops.o ../../cpu/musashi/m68kcpu.o\r
+else\r
+CFLAGS += -DEMU_F68K\r
+OBJS += ../../cpu/fame/famec.o\r
endif\r
# z80\r
ifeq "$(use_mz80)" "1"\r
endif\r
\r
\r
-LIBS += -lpng -lm -lpspgu # -lpspaudio -lpspgu -lpsppower -lpsphprm -lz -lm -lstdc++\r
+LIBS += -lpng -lm -lpspgu -lpsppower -Wl,-Map=PicoDrive.map # -lpspaudio -lpsphprm\r
\r
# target\r
TARGET = PicoDrive\r
\r
include $(PSPSDK)/lib/build.mak\r
\r
-\r
# some additional rules\r
.c.o:\r
@echo ">>>" $<\r
$(CC) $(CFLAGS) -c $< -o $@\r
\r
+AS := psp-as\r
+\r
+.s.o:\r
+ @echo ">>>" $<\r
+ $(AS) -march=allegrex -mtune=allegrex $< -o $@\r
+\r
../../cpu/musashi/m68kops.c :\r
make -C ../../cpu/musashi\r
\r
../../tools/textfilter: ../../tools/textfilter.c\r
make -C ../../tools/ textfilter\r
\r
+../../cpu/fame/famec.o : ../../cpu/fame/famec.c\r
+ @echo ">>>" $<\r
+ $(CC) $(CFLAGS) -Wno-unused -c $< -o $@\r
\r
# ?\r
up: EBOOT.PBP\r
#include <sys/syslimits.h> // PATH_MAX
#include <pspthreadman.h>
+#include <pspdisplay.h>
#include "psp.h"
#include "menu.h"
currentConfig.PicoAutoRgnOrder = 0x184; // US, EU, JP
currentConfig.Frameskip = -1; // auto
currentConfig.volume = 50;
+ currentConfig.CPUclock = 222;
currentConfig.KeyBinds[ 4] = 1<<0; // SACB RLDU
currentConfig.KeyBinds[ 6] = 1<<1;
currentConfig.KeyBinds[ 7] = 1<<2;
int i;
keys = psp_pad_read(0);
+ if (keys & PSP_CTRL_HOME)
+ sceDisplayWaitVblankStart();
+
if (keys & BTN_SELECT)
engineState = PGS_Menu;
fpsbuff[0] = 0;
+ if (currentConfig.CPUclock != psp_get_cpu_clock()) {
+ lprintf("setting cpu clock to %iMHz... ", currentConfig.CPUclock);
+ i = psp_set_cpu_clock(currentConfig.CPUclock);
+ lprintf(i ? "failed\n" : "done\n");
+ currentConfig.CPUclock = psp_get_cpu_clock();
+ }
+
// make sure we are in correct mode
vidResetMode();
Pico.m.dirtyPal = 1;
{ "Use SRAM/BRAM savestates", MB_ONOFF, MA_OPT_SRAM_STATES, ¤tConfig.EmuOpt, 0x0001, 0, 0, 1 },
{ NULL, MB_NONE, MA_OPT_CONFIRM_STATES,NULL, 0, 0, 0, 1 },
{ "Save slot", MB_RANGE, MA_OPT_SAVE_SLOT, &state_slot, 0, 0, 9, 1 },
+ { NULL, MB_NONE, MA_OPT_CPU_CLOCKS, NULL, 0, 0, 0, 1 },
{ "[Sega/Mega CD options]", MB_NONE, MA_OPT_SCD_OPTS, NULL, 0, 0, 0, 1 },
{ "[advanced options]", MB_NONE, MA_OPT_ADV_OPTS, NULL, 0, 0, 0, 1 },
{ NULL, MB_NONE, MA_OPT_SAVECFG, NULL, 0, 0, 0, 1 },
}
text_out16(x, y, "Confirm savestate %s", str);
break;
+ case MA_OPT_CPU_CLOCKS:
+ text_out16(x, y, "CPU/bus clock %3i/%3iMHz", currentConfig.CPUclock, currentConfig.CPUclock/2);
+ break;
case MA_OPT_SAVECFG:
str24[0] = 0;
if (config_slot != 0) sprintf(str24, " (profile: %i)", config_slot);
} else {state_slot--; if (state_slot < 0) state_slot = 9;
}
break;
+ case MA_OPT_CPU_CLOCKS:
+ while ((inp = psp_pad_read(0)) & (BTN_LEFT|BTN_RIGHT)) {
+ currentConfig.CPUclock += (inp & BTN_LEFT) ? -1 : 1;
+ if (currentConfig.CPUclock < 19) currentConfig.CPUclock = 19;
+ if (currentConfig.CPUclock > 333) currentConfig.CPUclock = 333;
+ draw_menu_options(menu_sel); // will wait vsync
+ }
+ break;
case MA_OPT_SAVECFG:
case MA_OPT_SAVECFG_GAME:
case MA_OPT_LOADCFG:
#define CPU_CALL\r
\r
// draw.c\r
+#define USE_BGR555 1\r
#define OVERRIDE_HIGHCOL 0\r
\r
// draw2.c\r
#include <pspkernel.h>
#include <pspiofilemgr.h>
#include <pspdisplay.h>
+#include <psppower.h>
#include <pspgu.h>
#include "psp.h"
void psp_video_flip(int wait_vsync)
{
if (wait_vsync) sceDisplayWaitVblankStart();
- sceDisplaySetFrameBuf(psp_screen, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
+ sceDisplaySetFrameBuf(psp_screen, 512, PSP_DISPLAY_PIXEL_FORMAT_565,
+ wait_vsync ? PSP_DISPLAY_SETBUF_IMMEDIATE : PSP_DISPLAY_SETBUF_NEXTFRAME);
current_screen ^= 1;
psp_screen = current_screen ? PSP_VRAM_BASE0 : PSP_VRAM_BASE1;
}
return pad.Buttons;
}
+int psp_get_cpu_clock(void)
+{
+ return scePowerGetCpuClockFrequencyInt();
+}
+
+int psp_set_cpu_clock(int clock)
+{
+ int ret = scePowerSetClockFrequency(clock, clock, clock/2);
+ if (ret != 0) lprintf("failed to set clock: %i\n", ret);
+
+ return ret;
+}
+
/* alt logging */
#define LOG_FILE "log.log"
unsigned int psp_pad_read(int blocking);
+int psp_get_cpu_clock(void);
+int psp_set_cpu_clock(int clock);
/* shorter btn names */
#define BTN_UP PSP_CTRL_UP