#include "svga.h"
#include "input.h"
+#include "state.h"
#include "movie.h"
-#ifdef DEBUG_ASM_6502
-extern int cpu_repeat;
-extern int cpu_lastval;
-#endif
+#include "fds.h"
+#include "vsuni.h"
+#include "dprintf.h"
extern INPUTC *FCEU_InitZapper(int w);
extern INPUTC *FCEU_InitPowerpad(int w);
extern INPUTCFC *FCEU_InitSpaceShadow(void);
extern INPUTCFC *FCEU_InitFKB(void);
static uint8 joy_readbit[2];
-static uint16 joy[4]={0,0,0,0};
+static uint8 joy[4]={0,0,0,0};
+static uint8 LastStrobe;
extern int coinon;
static INPUTC *JPorts[2]={&DummyJPort,&DummyJPort};
static INPUTCFC *FCExp=0;
+/* This function is a quick hack to get the NSF player to use emulated gamepad
+ input.
+*/
+uint8 FCEU_GetJoyJoy(void)
+{
+ return(joy[0]|joy[1]|joy[2]|joy[3]);
+}
+
static uint8 FP_FASTAPASS(1) ReadGPVS(int w)
{
uint8 ret=0;
{
uint8 ret=0;
-#ifdef DEBUG_ASM_6502
- if (cpu_repeat) return cpu_lastval;
-#endif
if(JPorts[A&1]->Read)
ret|=JPorts[A&1]->Read(A&1);
ret=FCExp->Read(A&1,ret);
ret|=X.DB&0xC0;
-#ifdef DEBUG_ASM_6502
-// cpu_lastval=ret;
-#endif
+ dprintf("JPRead %02x", ret);
return(ret);
}
if(JPorts[1]->Write)
JPorts[1]->Write(V&1);
- if((PSG[0x16]&1) && (!(V&1)))
+ if((LastStrobe&1) && (!(V&1)))
{
/* This strobe code is just for convenience. If it were
with the code in input / *.c, it would more accurately represent
if(FCExp->Strobe)
FCExp->Strobe();
}
- PSG[0x16]=V;
+ LastStrobe=V&1;
}
static void FP_FASTAPASS(1) StrobeGP(int w)
if(netplay) NetplayUpdate(&joy[0],&joy[1]);
#endif
if (current < 0) FCEUMOV_AddJoy(joy);
- FlushCommandQueue();
+ else framecount++; // for debug
+ //FlushCommandQueue();
}
static DECLFR(VSUNIRead0)
break;
case SI_ARKANOID:JPorts[x]=FCEU_InitArkanoid(x);break;
case SI_ZAPPER:JPorts[x]=FCEU_InitZapper(x);break;
- case SI_POWERPAD:JPorts[x]=FCEU_InitPowerpad(x);break;
+ case SI_POWERPADA:JPorts[x]=FCEU_InitPowerpad(x);break;
case SI_NONE:JPorts[x]=&DummyJPort;break;
}
{
memset(joy_readbit,0,sizeof(joy_readbit));
memset(joy,0,sizeof(joy));
+ LastStrobe=0;
if(FCEUGameInfo.type==GIT_VSUNI)
{
InputDataPtrFC=ptr;
SetInputStuffFC();
}
+
+// quick paste
+#define FCEUNPCMD_RESET 0x01
+#define FCEUNPCMD_POWER 0x02
+
+#define FCEUNPCMD_VSUNICOIN 0x07
+#define FCEUNPCMD_VSUNIDIP0 0x08
+#define FCEUNPCMD_FDSINSERT 0x18
+#define FCEUNPCMD_FDSSELECT 0x1A
+
+
+void FCEU_DoSimpleCommand(int cmd)
+{
+ switch(cmd)
+ {
+ case FCEUNPCMD_FDSINSERT: FCEU_FDSInsert();break;
+ case FCEUNPCMD_FDSSELECT: FCEU_FDSSelect();break;
+// case FCEUNPCMD_FDSEJECT: FCEU_FDSEject();break;
+ case FCEUNPCMD_VSUNICOIN: FCEU_VSUniCoin(); break;
+ case FCEUNPCMD_VSUNIDIP0 ... (FCEUNPCMD_VSUNIDIP0 + 7): FCEU_VSUniToggleDIP(cmd - FCEUNPCMD_VSUNIDIP0);break;
+ case FCEUNPCMD_POWER: PowerNES();break;
+ case FCEUNPCMD_RESET: ResetNES();break;
+ default: printf("FCEU_DoSimpleCommand: can't handle cmd %i\n", cmd); break;
+ }
+}
+
+void FCEU_QSimpleCommand(int cmd)
+{
+// if(FCEUnetplay)
+// FCEUNET_SendCommand(cmd, 0);
+// else
+ {
+ // totally wrong:
+// if(!FCEUMOV_IsPlaying())
+// FCEU_DoSimpleCommand(cmd);
+// else
+// FCEUMOV_AddCommand(cmd);
+
+ FCEU_DoSimpleCommand(cmd);
+// if(FCEUMOV_IsRecording())
+// FCEUMOV_AddCommand(cmd);
+ }
+}
+
+void FCEUI_FDSSelect(void)
+{
+ FCEU_QSimpleCommand(FCEUNPCMD_FDSSELECT);
+}
+
+int FCEUI_FDSInsert(void)
+{
+ FCEU_QSimpleCommand(FCEUNPCMD_FDSINSERT);
+ return(1);
+}
+
+/*
+int FCEUI_FDSEject(void)
+{
+ FCEU_QSimpleCommand(FCEUNPCMD_FDSEJECT);
+ return(1);
+}
+*/
+void FCEUI_VSUniToggleDIP(int w)
+{
+ FCEU_QSimpleCommand(FCEUNPCMD_VSUNIDIP0 + w);
+}
+
+void FCEUI_VSUniCoin(void)
+{
+ FCEU_QSimpleCommand(FCEUNPCMD_VSUNICOIN);
+}
+
+void FCEUI_ResetNES(void)
+{
+ FCEU_QSimpleCommand(FCEUNPCMD_RESET);
+}
+
+void FCEUI_PowerNES(void)
+{
+ FCEU_QSimpleCommand(FCEUNPCMD_POWER);
+}
+
+
+
+SFORMAT FCEUCTRL_STATEINFO[]={
+ { joy_readbit, 2, "JYRB"},
+ { joy, 4, "JOYS"},
+ { &LastStrobe, 1, "LSTS"},
+ { 0 }
+};
+
+