- if ((a&0xffffe0)==0xa10000) { // I/O ports
- a=(a>>1)&0xf;
- // 6 button gamepad: if TH went from 0 to 1, gamepad changes state
- if(PicoOpt&0x20) {
- if(a==1) {
- Pico.m.padDelay[0] = 0;
- if(!(Pico.ioports[1]&0x40) && (d&0x40)) Pico.m.padTHPhase[0]++;
- }
- else if(a==2) {
- Pico.m.padDelay[1] = 0;
- if(!(Pico.ioports[2]&0x40) && (d&0x40)) Pico.m.padTHPhase[1]++;
- }
- }
- Pico.ioports[a]=(u8)d; // IO ports can be used as RAM
- return;
- }
- if (a==0xa11100) {
- extern int z80startCycle, z80stopCycle;
- //int lineCycles=(488-SekCyclesLeft)&0x1ff;
- d&=1; d^=1;
- if(!d) {
- // this is for a nasty situation where Z80 was enabled and disabled in the same 68k timeslice (Golden Axe III)
- if (Pico.m.z80Run) {
- int lineCycles=(488-SekCyclesLeft)&0x1ff;
- z80stopCycle = SekCyclesDone();
- lineCycles=(lineCycles>>1)-(lineCycles>>5);
- z80_run(lineCycles);
- }
- } else {
- z80startCycle = SekCyclesDone();
- //if(Pico.m.scanline != -1)
- }
- dprintf("set_zrun: %02x [%i|%i] @%06x", d, Pico.m.scanline, SekCyclesDone(), /*mz80GetRegisterValue(NULL, 0),*/ SekPc);
- Pico.m.z80Run=(u8)d; return;
- }
+ if ((a&0xffffe0)==0xa10000) { IoWrite8(a, d); return; } // I/O ports
+#endif
+ if (a==0xa11100) { z80WriteBusReq(d); return; }