{
V&=PRGmask2[r];
setpageptr(2,A,PRGptr[r]?(&PRGptr[r][V<<11]):0,PRGram[r]);
+ X6502_Rebase();
}
void FASTAPASS(2) setprg2(uint32 A, uint32 V)
{
V&=PRGmask4[r];
setpageptr(4,A,PRGptr[r]?(&PRGptr[r][V<<12]):0,PRGram[r]);
+ X6502_Rebase();
}
void FASTAPASS(2) setprg4(uint32 A, uint32 V)
for(x=0;x<4;x++)
setpageptr(2,A+(x<<11),PRGptr[r]?(&PRGptr[r][((VA+x)&PRGmask2[r])<<11]):0,PRGram[r]);
}
+ X6502_Rebase();
}
void FASTAPASS(2) setprg8(uint32 A, uint32 V)
for(x=0;x<8;x++)
setpageptr(2,A+(x<<11),PRGptr[r]?(&PRGptr[r][((VA+x)&PRGmask2[r])<<11]):0,PRGram[r]);
}
+ X6502_Rebase();
}
void FASTAPASS(2) setprg16(uint32 A, uint32 V)
for(x=0;x<16;x++)
setpageptr(2,A+(x<<11),PRGptr[r]?(&PRGptr[r][((VA+x)&PRGmask2[r])<<11]):0,PRGram[r]);
}
+ X6502_Rebase();
}
void FASTAPASS(2) setprg32(uint32 A, uint32 V)
+#define SCREEN_WIDTH 320
+#define SCREEN_OFFS 32
+
void DrawTextLineBG(uint8 *dest)
{
int x,y;
int offs;
if(y>=7) offs=otable[13-y];
- else offs=otable[y];
-
+ else offs=otable[y];
+
for(x=offs;x<(256-offs);x++)
- dest[y*256+x]=(dest[y*256+x]&0x0f)|0xC0;//&=0xe0; //0x80;
+ dest[y*SCREEN_WIDTH+x]=(dest[y*SCREEN_WIDTH+x]&0x0f)|0xC0;//&=0xe0; //0x80;
}
-}
+}
static void DrawMessage(void)
{
{
uint8 *t;
howlong--;
- t=XBuf+(FSettings.LastSLine-16)*256;
+ t=XBuf+(FSettings.LastSLine-16)*SCREEN_WIDTH+SCREEN_OFFS;
if(t>=XBuf)
{
DrawTextLineBG(t);
- DrawTextTrans(t+256*3+(128-strlen(errmsg)*4),256,(uint8 *)errmsg,4);
+ DrawTextTrans(t+3*SCREEN_WIDTH+(128-strlen(errmsg)*4),SCREEN_WIDTH,(uint8 *)errmsg,128+4);
}
}
}
uint8 y;
uint8 z;
- for(x=0;x<length;x++)
- for(y=0;y<8;y++)
- for(z=0;z<8;z++)
+ for(x=0;x<length;x++)
+ for(y=0;y<8;y++)
+ for(z=0;z<8;z++)
if((fontdata2[(textmsg[x]<<3)+y]>>z)&1) dest[y*width+(x<<3)+z]=fgcolor;
}
{
uint8 *XBaf;
int z,x,y;
-
- XBaf=XBuf - 4 + (FSettings.LastSLine-34)*256;
+
+ XBaf=XBuf - 4 + (FSettings.LastSLine-34)*SCREEN_WIDTH+SCREEN_OFFS;
if(XBaf>=XBuf)
for(z=1;z<11;z++)
- {
+ {
if(nstatus[z%10])
{
for(y=0;y<13;y++)
for(x=0;x<21;x++)
- XBaf[y*256+x+z*21+z]=sstat[y*21+x+(z-1)*21*12]^0x80;
+ XBaf[y*SCREEN_WIDTH+x+z*21+z]=sstat[y*21+x+(z-1)*21*12]^0x80;
} else {
for(y=0;y<13;y++)
for(x=0;x<21;x++)
if(sstat[y*21+x+(z-1)*21*12]!=0x83)
- XBaf[y*256+x+z*21+z]=sstat[y*21+x+(z-1)*21*12]^0x80;
+ XBaf[y*SCREEN_WIDTH+x+z*21+z]=sstat[y*21+x+(z-1)*21*12]^0x80;
else
- XBaf[y*256+x+z*21+z]=(XBaf[y*256+x+z*21+z]&0xF)|0xC0;
+ XBaf[y*SCREEN_WIDTH+x+z*21+z]=(XBaf[y*SCREEN_WIDTH+x+z*21+z]&0xF)|0xC0;
}
- if(cur==z%10)
+ if(cur==z%10)
{
for(x=0;x<21;x++)
XBaf[x+z*21+z*1]=4;
for(x=1;x<12;x++)
{
- XBaf[256*x+z*21+z*1]=
- XBaf[256*x+z*21+z*1+20]=4;
+ XBaf[SCREEN_WIDTH*x+z*21+z*1]=
+ XBaf[SCREEN_WIDTH*x+z*21+z*1+20]=4;
}
for(x=0;x<21;x++)
- XBaf[12*256+x+z*21+z*1]=4;
+ XBaf[12*SCREEN_WIDTH+x+z*21+z*1]=4;
}
}
-}
+}
static uint8 play_slines[]=
{
uint8* slines=sline_icons[n];
int i;
- XBuf += (FSettings.LastSLine-28)*256 + 240 + 255;
+ XBuf += (FSettings.LastSLine-28)*SCREEN_WIDTH+SCREEN_OFFS + 240 + 255;
for(i=0; slines[i]!=99; i+=3)
{
int y=slines[i];
- uint8* dest=XBuf+(y*256);
+ uint8* dest=XBuf+(y*SCREEN_WIDTH);
int x;
for(x=slines[i+1]; x!=slines[i+2]; ++x)
dest[x]=0;
for(i=0; slines[i]!=99; i+=3)
{
int y=slines[i];
- uint8* dest=XBuf+(y*256);
+ uint8* dest=XBuf+(y*SCREEN_WIDTH);
int x;
for(x=slines[i+1]; x!=slines[i+2]; ++x)
dest[x]=4;
#define JOY_LEFT 0x40
#define JOY_RIGHT 0x80
-
#include "minimal.h"
+
+
extern int swapbuttons;
extern int scaled_display;
extern int FSkip_setting;
extern void SetVideoScaling(int pixels,int width,int height);
-static INLINE long UpdateGamepadGP2X(void);
static uint8 fkbkeys[0x48];
unsigned long lastpad=0;
-void FCEUD_UpdateInput(void)
-{
- int t=0;
- long lastpad2=lastpad;
- long pad = UpdateGamepadGP2X();
- t=1;
- // JSreturn=(JSreturn&0xFF000000)|(JSreturn&0xFF)|((JSreturn&0xFF0000)>>8)|((JSreturn&0xFF00)<<8);
- if(gametype==GIT_FDS)
- {
- NoWaiting&=~1;
- if ((pad & GP2X_PUSH) && (!(pad & GP2X_SELECT)) && (!(pad & GP2X_L)) && (!(pad & GP2X_R)) && (!(lastpad2 & GP2X_PUSH)))
- {
- DriverInterface(DES_FDSSELECT,0);
- }
- else if ((pad & GP2X_L) && (!(pad & GP2X_SELECT)) && (!(pad & GP2X_PUSH)) && (!(pad & GP2X_R))&& (!(lastpad2 & GP2X_L)))
- {
- DriverInterface(DES_FDSINSERT,0);
- }
- else if ((pad & GP2X_R) && (!(pad & GP2X_SELECT)) && (!(pad & GP2X_L)) && (!(pad & GP2X_PUSH)) && (!(lastpad2 & GP2X_R)))
- {
- DriverInterface(DES_FDSEJECT,0);
- }
- }
-
-}
-
-
-//#ifdef GP2X
-
extern void ResetNES(void);
extern void CleanSurface(void);
int turbo_toggle_A=0;
int turbo_toggle_B=0;
+
static void setsoundvol(int soundvolume)
{
//FCEUI_SetSoundVolume(soundvol);
soundvolmeter[20]=0;
FCEU_DispMessage("|%s|", soundvolmeter);
}
-/**
- * GP2x joystick reader
- *
- */
-static INLINE long UpdateGamepadGP2X(void)
+
+
+
+void FCEUD_UpdateInput(void)
{
+ long lastpad2=lastpad;
+ unsigned long pad=gp2x_joystick_read();
uint32 JS=0;
- unsigned long pad=gp2x_joystick_read();
#define down(b) (pad & GP2X_##b)
#define last_down(b) (lastpad & GP2X_##b)
#define L_down (pad & GP2X_L)
//padTmp=(pad & GP2X_START) >> 8; // 2^8,
JS |= (((pad & GP2X_START) >> 8) << 3); // 0x8 is 2^3
-
JSreturn = JS;
lastpad=pad;
- return pad;
//JSreturn=(JS&0xFF000000)|(JS&0xFF)|((JS&0xFF0000)>>8)|((JS&0xFF00)<<8);
+
+
+ // JSreturn=(JSreturn&0xFF000000)|(JSreturn&0xFF)|((JSreturn&0xFF0000)>>8)|((JSreturn&0xFF00)<<8);
+ // TODO: make these bindable, use new interface
+ if(gametype==GIT_FDS)
+ {
+ NoWaiting&=~1;
+ if ((pad & GP2X_PUSH) && (!(pad & GP2X_SELECT)) && (!(pad & GP2X_L)) && (!(pad & GP2X_R)) && (!(lastpad2 & GP2X_PUSH)))
+ {
+ DriverInterface(DES_FDSSELECT,0);
+ }
+ else if ((pad & GP2X_L) && (!(pad & GP2X_SELECT)) && (!(pad & GP2X_PUSH)) && (!(pad & GP2X_R))&& (!(lastpad2 & GP2X_L)))
+ {
+ DriverInterface(DES_FDSINSERT,0);
+ }
+ else if ((pad & GP2X_R) && (!(pad & GP2X_SELECT)) && (!(pad & GP2X_L)) && (!(pad & GP2X_PUSH)) && (!(lastpad2 & GP2X_R)))
+ {
+ DriverInterface(DES_FDSEJECT,0);
+ }
+ }
+ return;
+
no_pad:
JSreturn=0;
lastpad=pad;
- return 0;
}
-//#endif
static void InitOtherInput(void)
if(FCEUGameInfo.type==GIT_NSF)
{
- X6502_Run((256+85)*240);
+ for(scanline=0;scanline<240;scanline++)
+ X6502_Run(256+85);
}
#ifdef FRAMESKIP
else if(FSkip)
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define _GNU_SOURCE // for asprintf
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@@ REG_ADDR¤òÊѹ¹¤¹¤ë¤¬µ¤¤Ë¤¹¤ë¤Ê
@@@
.macro READ_WORD
- READ
+ bl read_byte
mov REG_PC, r0
add REG_ADDR, REG_ADDR, #1
- READ
+ bl read_byte
orr r0, REG_PC, r0, lsl #8
.endm
SetReadHandler(0x2000,0x37ff,0);\r
SetReadHandler(0x3836,0x3FFF,0);\r
SetReadHandler(0x3800,0x3835,NSFROMRead);\r
+ Page[0x3800>>11]=NSFROM-0x3800; // this is required for asm core to work.\r
\r
SetWriteHandler(0x5ff6,0x5fff,NSF_write);\r
\r
\r
if(vismode==0) return;\r
\r
- memset(XBuf,0,320*240);\r
-\r
+ for (x=0;x<240;x++)\r
+ memset(XBuf+SCREEN_OFFS+x*SCREEN_WIDTH,0,256);\r
\r
{\r
int32 *Bufpl;\r
int x,u,y;
FILE *pp=NULL;
uint8 *compmem=NULL;
- uint32 compmemsize=totallines*263+12;
+ unsigned long compmemsize=totallines*263+12;
if(!(compmem=FCEU_malloc(compmemsize)))
return 0;
tmp+=16;
}
- if(compress(compmem,(unsigned long *)&compmemsize,mork,(totallines<<8)+totallines)!=Z_OK)
+ if(compress(compmem,&compmemsize,mork,(totallines<<8)+totallines)!=Z_OK)
{
if(mal) free(mal);
goto PNGerr;