1 /* FCE Ultra - NES/Famicom Emulator
3 * Copyright notice for this file:
4 * Copyright (C) 2002 Ben Parnell
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.
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.
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
36 static void FP_FASTAPASS(2) ZapperThingy(uint8 *buf, int line)
40 if(line==0) ZD.colok=1<<16; /* Disable it. */
41 ZD.coloklast=ZD.colok;
43 if((line>=ZD.mzy-3 && line<=ZD.mzy+3) && mzx<256)
49 if((mzx+x)<0 || (mzx+x)>255) continue;
51 sum=palo[a].r+palo[a].g+palo[a].b;
55 ZD.colok=timestamp+mzx/3;
62 static INLINE int CheckColor(void)
64 if( (timestamp>=ZD.coloklast && timestamp<=(ZD.coloklast+10)) ||
65 (timestamp>=ZD.colok && timestamp<=(ZD.colok+10)) )
70 static uint8 FP_FASTAPASS(2) ReadZapper(int w, uint8 ret)
82 //printf("Kayo: %d\n",ZD.zap_readbit);
84 //if(ZD.zap_readbit==4) ret|=ZD.mzb&2;
91 static void FP_FASTAPASS(2) DrawZapper(uint8 *buf, int arg)
94 FCEU_DrawCursor(buf, ZD.mzx, ZD.mzy);
97 static void FP_FASTAPASS(2) UpdateZapper(void *data, int arg)
103 if(ptr[2]&1 && (!(ZD.mzb&1)))
110 if(ZD.mzx>=256 || ZD.mzy>=240)
114 static void StrobeShadow(void)
119 static INPUTCFC SHADOWC={ReadZapper,0,StrobeShadow,UpdateZapper,ZapperThingy,DrawZapper};
121 INPUTCFC *FCEU_InitSpaceShadow(void)
123 memset(&ZD,0,sizeof(ZAPPER));