From f3a57b2d6c6a32dc09a6efd4fbef31eb876263b2 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 2 Jun 2010 09:44:51 +0000 Subject: [PATCH] allow compiling without 32x and sms code git-svn-id: file:///home/notaz/opt/svn/PicoDrive@877 be3aeb3a-fb24-0410-a615-afba39da0efa --- cpu/debug.c | 4 +++- pico/32x/32x.c | 3 --- pico/debug.c | 6 ++++++ pico/memory.c | 8 ++++++++ pico/pico.c | 3 +++ pico/pico.h | 4 ++-- pico/pico_int.h | 22 ++++++++++++++++++++++ pico/state.c | 12 ++++++++++-- platform/common/common.mak | 18 +++++++++++++++--- platform/common/emu.c | 7 +++++-- 10 files changed, 74 insertions(+), 13 deletions(-) diff --git a/cpu/debug.c b/cpu/debug.c index 2811b43..4fffcf6 100644 --- a/cpu/debug.c +++ b/cpu/debug.c @@ -188,10 +188,11 @@ enum cmd_ret_e { static int do_print(struct pdb_cpu *cpu, const char *args) { - int i; elprintf(EL_STATUS, "cpu %d (%s)", cpu->id, cpu->name); +#ifndef NO_32X if (cpu->type == PDBCT_SH2) { SH2 *sh2 = cpu->context; + int i; printf("PC,SR %08x, %03x\n", sh2->pc, sh2->sr & 0x3ff); for (i = 0; i < 16/2; i++) printf("R%d,%2d %08x,%08x\n", i, i + 8, sh2->r[i], sh2->r[i + 8]); @@ -200,6 +201,7 @@ static int do_print(struct pdb_cpu *cpu, const char *args) Pico32x.sh2irq_mask[sh2->is_slave]); printf("cycles %d/%d (%d)\n", sh2->cycles_done, sh2->cycles_aim, (signed int)sh2->sr >> 12); } +#endif return CMDRET_DONE; } diff --git a/pico/32x/32x.c b/pico/32x/32x.c index ffd4f1f..59aa142 100644 --- a/pico/32x/32x.c +++ b/pico/32x/32x.c @@ -4,9 +4,6 @@ struct Pico32x Pico32x; SH2 sh2s[2]; -int p32x_msh2_multiplier = MSH2_MULTI_DEFAULT; -int p32x_ssh2_multiplier = SSH2_MULTI_DEFAULT; - static int REGPARM(2) sh2_irq_cb(SH2 *sh2, int level) { if (sh2->pending_irl > sh2->pending_int_irq) { diff --git a/pico/debug.c b/pico/debug.c index 79f201b..d6c6e45 100644 --- a/pico/debug.c +++ b/pico/debug.c @@ -56,6 +56,7 @@ char *PDebugMain(void) char *PDebug32x(void) { +#ifndef NO_32X char *dstrp = dstr; unsigned short *r; int i; @@ -85,6 +86,9 @@ char *PDebug32x(void) sprintf(dstrp, "gb,vb %08x,%08x %08x,%08x\n", sh2_gbr(0), sh2_vbr(0), sh2_gbr(1), sh2_vbr(1)); MVP; sprintf(dstrp, "IRQs/mask: %02x/%02x %02x/%02x\n", Pico32x.sh2irqi[0], Pico32x.sh2irq_mask[0], Pico32x.sh2irqi[1], Pico32x.sh2irq_mask[1]); MVP; +#else + dstr[0] = 0; +#endif return dstr; } @@ -329,6 +333,7 @@ void PDebugDumpMem(void) dump_ram_noswab(Pico_mcd->bram, "dumps/bram.bin"); } +#ifndef NO_32X if (PicoAHW & PAHW_32X) { dump_ram(Pico32xMem->sdram, "dumps/sdram.bin"); @@ -338,6 +343,7 @@ void PDebugDumpMem(void) dump_ram(Pico32xMem->data_array[0], "dumps/data_array0.bin"); dump_ram(Pico32xMem->data_array[1], "dumps/data_array1.bin"); } +#endif } void PDebugZ80Frame(void) diff --git a/pico/memory.c b/pico/memory.c index 00e5016..2fff489 100644 --- a/pico/memory.c +++ b/pico/memory.c @@ -1058,6 +1058,14 @@ void ym2612_unpack_state(void) elprintf(EL_YMTIMER, "load: %i/%i, timer_b_next_oflow %i", tbt>>16, tbc>>16, timer_b_next_oflow >> 8); } +#if defined(NO_32X) && defined(_ASM_MEMORY_C) +// referenced by asm code +u32 PicoRead8_32x(u32 a) { return 0; } +u32 PicoRead16_32x(u32 a) { return 0; } +void PicoWrite8_32x(u32 a, u32 d) {} +void PicoWrite16_32x(u32 a, u32 d) {} +#endif + // ----------------------------------------------------------------- // z80 memhandlers diff --git a/pico/pico.c b/pico/pico.c index 12677d7..2db3c3f 100644 --- a/pico/pico.c +++ b/pico/pico.c @@ -23,6 +23,9 @@ struct PicoSRAM SRam; int emustatus; // rapid_ym2612, multi_ym_updates int scanlines_total; +int p32x_msh2_multiplier = MSH2_MULTI_DEFAULT; +int p32x_ssh2_multiplier = SSH2_MULTI_DEFAULT; + 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; diff --git a/pico/pico.h b/pico/pico.h index bde9a5a..b61d7b1 100644 --- a/pico/pico.h +++ b/pico/pico.h @@ -101,7 +101,7 @@ extern void (*PicoMCDopenTray)(void); extern void (*PicoMCDcloseTray)(void); extern int PicoCDBuffers; -// Pico/Pico.c +// pico.c #define XPCM_BUFFER_SIZE (320+160) typedef struct { @@ -209,7 +209,7 @@ extern unsigned char *PicoDraw2FB; // buffer for fast renderer in format (8+32 extern unsigned short *PicoCramHigh; // pointer to CRAM buff (0x40 shorts), converted to native device color (works only with 16bit for now) extern void (*PicoPrepareCram)(); // prepares PicoCramHigh for renderer to use -// 32x/32x.c +// pico.c (32x) // multipliers against 68k clock extern int p32x_msh2_multiplier; extern int p32x_ssh2_multiplier; diff --git a/pico/pico_int.h b/pico/pico_int.h index 74d1da2..dcd321a 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -684,14 +684,24 @@ PICO_INTERNAL void PsndGetSamplesMS(void); extern int PsndDacLine; // sms.c +#ifndef NO_SMS void PicoPowerMS(void); void PicoResetMS(void); void PicoMemSetupMS(void); void PicoStateLoadedMS(void); void PicoFrameMS(void); void PicoFrameDrawOnlyMS(void); +#else +#define PicoPowerMS() +#define PicoResetMS() +#define PicoMemSetupMS() +#define PicoStateLoadedMS() +#define PicoFrameMS() +#define PicoFrameDrawOnlyMS() +#endif // 32x/32x.c +#ifndef NO_32X extern struct Pico32x Pico32x; void Pico32xInit(void); void PicoPower32x(void); @@ -731,6 +741,18 @@ void p32x_pwm_update(int *buf32, int length, int stereo); void p32x_timers_do(int line_call); void p32x_timers_recalc(void); extern int pwm_frame_smp_cnt; +#else +#define Pico32xInit() +#define PicoPower32x() +#define PicoReset32x() +#define PicoFrame32x() +#define PicoUnload32x() +#define Pico32xStateLoaded() +#define PicoDraw32xSetFrameMode(...) +#define FinalizeLine32xRGB555 NULL +#define p32x_pwm_update(...) +#define p32x_timers_recalc() +#endif /* avoid dependency on newer glibc */ static __inline int isspace_(int c) diff --git a/pico/state.c b/pico/state.c index 27c58a7..dbed8b9 100644 --- a/pico/state.c +++ b/pico/state.c @@ -308,6 +308,7 @@ static int state_save(void *file) wram_2M_to_1M(Pico_mcd->word_ram2M); } +#ifndef NO_32X if (PicoAHW & PAHW_32X) { unsigned char cpubuff[SH2_STATE_SIZE]; @@ -332,6 +333,7 @@ static int state_save(void *file) CHECKED_WRITE_BUFF(CHUNK_DRAM, Pico32xMem->dram); CHECKED_WRITE_BUFF(CHUNK_32XPAL, Pico32xMem->pal); } +#endif if (carthw_chunks != NULL) { @@ -451,6 +453,7 @@ static int state_load(void *file) case CHUNK_MISC_CD: CHECKED_READ_BUFF(Pico_mcd->m); break; // 32x stuff +#ifndef NO_32X case CHUNK_MSH2: CHECKED_READ_BUFF(buff_sh2); sh2_unpack(&sh2s[0], buff_sh2); @@ -472,7 +475,7 @@ static int state_load(void *file) case CHUNK_SDRAM: CHECKED_READ_BUFF(Pico32xMem->sdram); break; case CHUNK_DRAM: CHECKED_READ_BUFF(Pico32xMem->dram); break; case CHUNK_32XPAL: CHECKED_READ_BUFF(Pico32xMem->pal); break; - +#endif default: if (carthw_chunks != NULL) { @@ -546,6 +549,7 @@ static int state_load_gfx(void *file) case CHUNK_VSRAM: CHECKED_READ_BUFF(Pico.vsram); found++; break; case CHUNK_VIDEO: CHECKED_READ_BUFF(Pico.video); found++; break; +#ifndef NO_32X case CHUNK_DRAM: if (Pico32xMem != NULL) CHECKED_READ_BUFF(Pico32xMem->dram); @@ -560,7 +564,7 @@ static int state_load_gfx(void *file) case CHUNK_32XSYS: CHECKED_READ_BUFF(Pico32x); break; - +#endif default: areaSeek(file, len, SEEK_CUR); break; @@ -652,11 +656,13 @@ void *PicoTmpStateSave(void) memcpy(t->vsram, Pico.vsram, sizeof(Pico.vsram)); memcpy(&t->video, &Pico.video, sizeof(Pico.video)); +#ifndef NO_32X if (PicoAHW & PAHW_32X) { memcpy(&t->t32x.p32x, &Pico32x, sizeof(Pico32x)); memcpy(t->t32x.dram, Pico32xMem->dram, sizeof(Pico32xMem->dram)); memcpy(t->t32x.pal, Pico32xMem->pal, sizeof(Pico32xMem->pal)); } +#endif return t; } @@ -673,12 +679,14 @@ void PicoTmpStateRestore(void *data) memcpy(&Pico.video, &t->video, sizeof(Pico.video)); Pico.m.dirtyPal = 1; +#ifndef NO_32X if (PicoAHW & PAHW_32X) { memcpy(&Pico32x, &t->t32x.p32x, sizeof(Pico32x)); memcpy(Pico32xMem->dram, t->t32x.dram, sizeof(Pico32xMem->dram)); memcpy(Pico32xMem->pal, t->t32x.pal, sizeof(Pico32xMem->pal)); Pico32x.dirty_pal = 1; } +#endif } // vim:shiftwidth=2:expandtab diff --git a/platform/common/common.mak b/platform/common/common.mak index 2a240b0..2a0354b 100644 --- a/platform/common/common.mak +++ b/platform/common/common.mak @@ -26,14 +26,24 @@ endif # === Pico core === # Pico OBJS += pico/state.o pico/cart.o pico/memory.o pico/pico.o pico/sek.o pico/z80if.o \ - pico/videoport.o pico/draw2.o pico/draw.o pico/mode4.o pico/sms.o \ + pico/videoport.o pico/draw2.o pico/draw.o pico/mode4.o \ pico/misc.o pico/eeprom.o pico/patch.o pico/debug.o +# SMS +ifneq "$(no_sms)" "1" +OBJS += pico/sms.o +else +DEFINES += NO_SMS +endif # CD OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \ pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \ pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o # 32X +ifneq "$(no_32x)" "1" OBJS += pico/32x/32x.o pico/32x/memory.o pico/32x/draw.o pico/32x/pwm.o +else +DEFINES += NO_32X +endif # Pico OBJS += pico/pico/pico.o pico/pico/memory.o pico/pico/xpcm.o # carthw @@ -73,8 +83,9 @@ OBJS += cpu/cz80/cz80.o endif # --- SH2 --- -OBJS += cpu/sh2/sh2.o OBJS += cpu/drc/cmn.o +ifneq "$(no_32x)" "1" +OBJS += cpu/sh2/sh2.o # ifeq "$(use_sh2drc)" "1" DEFINES += DRC_SH2 @@ -89,11 +100,12 @@ ifeq "$(drc_debug_interp)" "1" DEFINES += DRC_DEBUG_INTERP use_sh2mame = 1 endif -endif +endif # use_sh2drc # ifeq "$(use_sh2mame)" "1" OBJS += cpu/sh2/mame/sh2pico.o endif +endif # !no_32x DIRS += platform platform/common pico pico/cd pico/pico pico/32x pico/sound pico/carthw/svp \ diff --git a/platform/common/emu.c b/platform/common/emu.c index b1927c1..618eb70 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -453,11 +453,14 @@ static void shutdown_MCD(void) static void system_announce(void) { - const char *sys_name, *tv_standard; + const char *sys_name, *tv_standard, *extra = ""; int fps; if (PicoAHW & PAHW_SMS) { sys_name = "Master System"; +#ifdef NO_SMS + extra = " [no support]"; +#endif } else if (PicoAHW & PAHW_PICO) { sys_name = "Pico"; } else if (PicoAHW & PAHW_MCD) { @@ -474,7 +477,7 @@ static void system_announce(void) tv_standard = Pico.m.pal ? "PAL" : "NTSC"; fps = Pico.m.pal ? 50 : 60; - emu_status_msg("%s %s / %dFPS", tv_standard, sys_name, fps); + emu_status_msg("%s %s / %dFPS%s", tv_standard, sys_name, fps, extra); } // note: this function might mangle rom_fname -- 2.39.2