undocumented opcodes added to ncpu
[fceu.git] / input / toprider.c
1 /* FCE Ultra - NES/Famicom Emulator
2  *
3  * Copyright notice for this file:
4  *  Copyright (C) 2003 Xodnizel
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include <string.h>
22 #include "share.h"
23
24 static uint32 bs,bss;
25 static uint32 boop;
26
27 static uint8 FP_FASTAPASS(2) Read(int w, uint8 ret)
28 {
29  if(w) 
30  {
31   ret|=(bs&1)<<3;
32   ret|=(boop&1)<<4;
33   bs>>=1;  
34   boop>>=1;
35 //  puts("Read");
36  }
37  return(ret);
38 }
39
40 static void FP_FASTAPASS(1) Write(uint8 V)
41 {
42  // if(V&0x2) 
43  bs=bss;
44  //printf("Write: %02x\n",V);
45 // boop=0xC0;
46 }
47
48 static void FP_FASTAPASS(2) Update(void *data, int arg)
49 {
50  bss=*(uint8*)data;
51  bss|=bss<<8;
52  bss|=bss<<8;
53 }
54
55 static INPUTCFC TopRider={Read,Write,0,Update,0,0};
56
57 INPUTCFC *FCEU_InitTopRider(void)
58 {
59
60  return(&TopRider);
61 }
62