#ifdef _ASM_MEMORY_C\r
u32 PicoRead8(u32 a);\r
u32 PicoRead16(u32 a);\r
+void PicoWrite8(u32 a,u8 d);\r
void PicoWriteRomHW_SSF2(u32 a,u32 d);\r
void PicoWriteRomHW_in1 (u32 a,u32 d);\r
#endif\r
\r
// -----------------------------------------------------------------\r
\r
+int PadRead(int i)\r
+{\r
+ int pad,value,data_reg;\r
+ pad=~PicoPad[i]; // Get inverse of pad MXYZ SACB RLDU\r
+ data_reg=Pico.ioports[i+1];\r
+\r
+ // orr the bits, which are set as output\r
+ value = data_reg&(Pico.ioports[i+4]|0x80);\r
+\r
+ if(PicoOpt & 0x20) { // 6 button gamepad enabled\r
+ int phase = Pico.m.padTHPhase[i];\r
+\r
+ if(phase == 2 && !(data_reg&0x40)) { // TH\r
+ value|=(pad&0xc0)>>2; // ?0SA 0000\r
+ return value;\r
+ } else if(phase == 3) {\r
+ if(data_reg&0x40)\r
+ value|=(pad&0x30)|((pad>>8)&0xf); // ?1CB MXYZ\r
+ else\r
+ value|=((pad&0xc0)>>2)|0x0f; // ?0SA 1111\r
+ return value;\r
+ }\r
+ }\r
+\r
+ if(data_reg&0x40) // TH\r
+ value|=(pad&0x3f); // ?1CB RLDU\r
+ else value|=((pad&0xc0)>>2)|(pad&3); // ?0SA 00DU\r
+\r
+ return value; // will mirror later\r
+}\r
+\r
+\r
#ifndef _ASM_MEMORY_C\r
// address must already be checked\r
static int SRAMRead(u32 a)\r
// -----------------------------------------------------------------\r
// Write Ram\r
\r
-static void CPU_CALL PicoWrite8(u32 a,u8 d)\r
+#ifndef _ASM_MEMORY_C\r
+PICO_INTERNAL_ASM void CPU_CALL PicoWrite8(u32 a,u8 d)\r
{\r
#ifdef __debug_io\r
dprintf("w8 : %06x, %02x @%06x", a&0xffffff, d, SekPc);\r
log_io(a, 8, 1);\r
\r
a&=0xffffff;\r
- OtherWrite8(a,d,8);\r
+ OtherWrite8(a,d);\r
}\r
+#endif\r
\r
void CPU_CALL PicoWrite16(u32 a,u16 d)\r
{\r