static DECLFW(Mapper153_write) { A&=0xF; if(A<=0x7) { mapbyte1[A&7]=V; PRGO(); } else if(A==0x8) { mapbyte2[0]=V; PRGO(); } else switch(A) { case 0x9: switch(V&3) { case 0x00:MIRROR_SET2(1);break; case 0x01:MIRROR_SET2(0);break; case 0x02:onemir(0);break; case 0x03:onemir(1);break; } break; case 0xA:X6502_IRQEnd(FCEU_IQEXT); IRQa=V&1; IRQCount=IRQLatch; break; case 0xB:IRQLatch&=0xFF00; IRQLatch|=V; break; case 0xC:IRQLatch&=0xFF; IRQLatch|=V<<8; break; } }
static DECLFW(Mapper16_write) { A&=0xF; if(A<=0x7) VROM_BANK1(A<<10,V); else if(A==0x8) ROM_BANK16(0x8000,V); else switch(A) { case 0x9: switch(V&3) { case 0x00:MIRROR_SET2(1);break; case 0x01:MIRROR_SET2(0);break; case 0x02:onemir(0);break; case 0x03:onemir(1);break; } break; case 0xA:X6502_IRQEnd(FCEU_IQEXT); IRQa=V&1; IRQCount=IRQLatch; break; case 0xB:IRQLatch&=0xFF00; IRQLatch|=V; break; case 0xC:IRQLatch&=0xFF; IRQLatch|=V<<8; break; case 0xD: break;/* Serial EEPROM control port */ } }
static DECLFW(Mapper24_write) { if(swaparoo) A=(A&0xFFFC)|((A>>1)&1)|((A<<1)&2); if(A>=0x9000 && A<=0xb002) { VRC6SW(A,V); return; } A&=0xF003; // if(A>=0xF000) printf("%d, %d, $%04x:$%02x\n",scanline,timestamp,A,V); switch(A&0xF003) { case 0x8000:ROM_BANK16(0x8000,V);break; case 0xB003: switch(V&0xF) { case 0x0:MIRROR_SET2(1);break; case 0x4:MIRROR_SET2(0);break; case 0x8:onemir(0);break; case 0xC:onemir(1);break; } break; case 0xC000:ROM_BANK8(0xC000,V);break; case 0xD000:VROM_BANK1(0x0000,V);break; case 0xD001:VROM_BANK1(0x0400,V);break; case 0xD002:VROM_BANK1(0x0800,V);break; case 0xD003:VROM_BANK1(0x0c00,V);break; case 0xE000:VROM_BANK1(0x1000,V);break; case 0xE001:VROM_BANK1(0x1400,V);break; case 0xE002:VROM_BANK1(0x1800,V);break; case 0xE003:VROM_BANK1(0x1c00,V);break; case 0xF000:IRQLatch=V; //acount=0; break; case 0xF001:IRQa=V&2; vrctemp=V&1; if(V&2) { IRQCount=IRQLatch; acount=0; } X6502_IRQEnd(FCEU_IQEXT); break; case 0xf002:IRQa=vrctemp; X6502_IRQEnd(FCEU_IQEXT);break; case 0xF003:break; } }
static DECLFW(Mapper69_write) { switch(A&0xE000) { case 0x8000:sunselect=V;break; case 0xa000: sunselect&=0xF; if(sunselect<=7) VROM_BANK1(sunselect<<10,V); else switch(sunselect&0x0f) { case 8: sungah=V; if(V&0x40) { if(V&0x80) // Select WRAM setprg8r(0x10,0x6000,0); } else setprg8(0x6000,V); break; case 9:ROM_BANK8(0x8000,V);break; case 0xa:ROM_BANK8(0xa000,V);break; case 0xb:ROM_BANK8(0xc000,V);break; case 0xc: switch(V&3) { case 0:MIRROR_SET2(1);break; case 1:MIRROR_SET2(0);break; case 2:onemir(0);break; case 3:onemir(1);break; } break; case 0xd:IRQa=V;X6502_IRQEnd(FCEU_IQEXT);break; case 0xe:IRQCount&=0xFF00;IRQCount|=V;X6502_IRQEnd(FCEU_IQEXT);break; case 0xf:IRQCount&=0x00FF;IRQCount|=V<<8;X6502_IRQEnd(FCEU_IQEXT);break; } break; } }
static void mira() { if(isfu) { int x; CCache[0]=CCache[1]=mapbyte2[0]>>7; CCache[2]=CCache[3]=mapbyte2[1]>>7; for(x=0;x<4;x++) CCache[4+x]=mapbyte2[2+x]>>7; onemir(CCache[lastA]); } else
static void Fudou_PPU(uint32 A) { static int last=-1; static uint8 z; if(A>=0x2000) return; A>>=10; lastA=A; z=CCache[A]; if(z!=last) { onemir(z); last=z; } }
static DECLFW(Mapper83_write) { //printf("$%04x:$%02x\n",A,V); switch(A) { case 0x8000: case 0xB000: case 0xB0FF: case 0xB1FF: { mapbyte1[0]=V; m83prg(); m83chr(); } break; case 0x8100: mapbyte3[0]=V&0x80; switch(V&0x3) { case 0x00: MIRROR_SET2(1); break; case 0x01: MIRROR_SET2(0); break; case 0x02: onemir(0); break; case 0x03: onemir(1); break; } break; case 0x8200: IRQCount&=0xFF00; IRQCount|=V; X6502_IRQEnd(FCEU_IQEXT); break; case 0x8201: IRQa=mapbyte3[0]; IRQCount&=0xFF; IRQCount|=V<<8; break; case 0x8300: ROM_BANK8(0x8000,V); break; case 0x8301: ROM_BANK8(0xA000,V); break; case 0x8302: ROM_BANK8(0xC000,V); break; case 0x8310: mapbyte2[0]=V; m83chr(); break; case 0x8311: mapbyte2[1]=V; m83chr(); break; case 0x8312: mapbyte2[2]=V; m83chr(); break; case 0x8313: mapbyte2[3]=V; m83chr(); break; case 0x8314: mapbyte2[4]=V; m83chr(); break; case 0x8315: mapbyte2[5]=V; m83chr(); break; case 0x8316: mapbyte2[6]=V; m83chr(); break; case 0x8317: mapbyte2[7]=V; m83chr(); break; case 0x8318: mapbyte1[1]=V; m83prg(); break; } // printf("$%04x:$%02x, $%04x\n",A,V,X.PC.W); }