static void InterruptController(void) { if (tc0140syt.NmiReq && tc0140syt.NmiEnabled ) { ZetNmi(); tc0140syt.NmiReq = 0; } }
static void Sf2mdtMSM5205Vck0() { MSM5205DataWrite(0, Sf2mdtSampleBuffer1 & 0x0f); Sf2mdtSampleBuffer1 >>= 4; Sf2mdtSampleSelect1 ^= 1; if (Sf2mdtSampleSelect1 == 0) { ZetNmi(); } }
static void Wc90b1MSM5205Vck0() { static INT32 Toggle = 0; Toggle ^= 1; if (Toggle) { MSM5205DataWrite(0, (Wc90b1MSM5205Next & 0xf0) >> 4); ZetNmi(); } else {
void HangonPPI0WritePortC(UINT8 data) { System16ColScroll = ~data & 0x04; System16RowScroll = ~data & 0x02; if (!(data & 0x80)) { ZetNmi(); ZetRun(100); nSystem16CyclesDone[2] += 100; } }
void __fastcall PgmWriteWord(unsigned int sekAddress, unsigned short wordValue) { static int coin_counter_previous; switch (sekAddress) { case 0x700006: // Watchdog? break; case 0xC00002: ics2115_soundlatch_w(0, wordValue); if (nPgmZ80Work) ZetNmi(); break; case 0xC00004: ics2115_soundlatch_w(1, wordValue); break; case 0xC00006: pgm_calendar_w(wordValue); break; case 0xC00008: if (wordValue == 0x5050) { ics2115_reset(); nPgmZ80Work = 1; ZetReset(); } else { nPgmZ80Work = 0; } break; case 0xC0000A: // z80_ctrl_w break; case 0xC0000C: ics2115_soundlatch_w(2, wordValue); break; case 0xC08006: // coin counter if (coin_counter_previous == 0xf && wordValue == 0) { // bprintf (0, _T("increment coin counter!\n")); } coin_counter_previous = wordValue & 0x0f; break; // default: // bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x (PC: %5.5x)\n"), wordValue, sekAddress, SekGetPC(-1)); } }
void __fastcall rollerg_sound_write(unsigned short address, unsigned char data) { switch (address) { case 0xc000: case 0xc001: BurnYM3812Write(address & 1, data); return; case 0xfc00: ZetRun(100); ZetNmi(); return; } if (address >= 0xa000 && address <= 0xa02f) { K053260Write(0, address & 0x3f, data); return; } }
void __fastcall parodius_sound_write(UINT16 address, UINT8 data) { switch (address) { case 0xf800: BurnYM2151SelectRegister(data); return; case 0xf801: BurnYM2151WriteRegister(data); return; case 0xfa00: nCyclesDone[1] += ZetRun(100); ZetNmi(); return; } if (address >= 0xfc00 && address <= 0xfc2f) { K053260Write(0, address & 0x3f, data); } }
void __fastcall batriderWriteWord(UINT32 sekAddress, UINT16 wordValue) { switch (sekAddress) { case 0x500020: { RamShared[0] = wordValue; // The 68K program normally writes 0x500020/0x500022 as a single longword, // except during the communications test. if (wordValue == 0x55) { ZetNmi(); nCyclesDone[1] += ZetRun(0x1800); } break; } case 0x500022: RamShared[1] = wordValue; // Sound commands are processed by the Z80 using an NMI // So, trigger a Z80 NMI and execute it ZetNmi(); nCyclesDone[1] += ZetRun(0x1800); break; case 0x500024: // Writes to this address only occur in situations where the program sets // 0x20FA19 (Ram02[0x7A18]) to 0xFF, and then sits in a loop waiting for it to become 0x00 // Interrupt 4 does this (the same code is also conditionally called from interrupt 2) nIRQPending = 1; SekSetIRQLine(4, SEK_IRQSTATUS_ACK); break; case 0x500060: // Bit 0 of the value written to this location must be echod at 0x50000C nData = wordValue; break; case 0x500080: Map68KTextROM(false); break; case 0x500082: // Acknowledge interrupt SekSetIRQLine(0, SEK_IRQSTATUS_NONE); nIRQPending = 0; break; case 0x5000C0: case 0x5000C1: case 0x5000C2: case 0x5000C3: case 0x5000C4: case 0x5000C5: case 0x5000C6: case 0x5000C7: case 0x5000C8: case 0x5000C9: case 0x5000CA: case 0x5000CB: case 0x5000CC: case 0x5000CD: case 0x5000CE: GP9001TileBank[(sekAddress & 0x0F) >> 1] = ((wordValue & 0x0F) << 15); break; // default: // printf("Attempt to write %06X (word) -> %04X.\n", sekAddress, wordValue); } }
void __fastcall hotdogstWriteWord(UINT32 sekAddress, UINT16 wordValue) { switch (sekAddress) { case 0xa80000: nCaveXOffset = wordValue; return; case 0xa80002: nCaveYOffset = wordValue; return; case 0xa80008: CaveSpriteBuffer(); nCaveSpriteBank = wordValue; return; case 0xa8006e: { DrvSoundLatch = wordValue; ZetNmi(); return; } case 0xb00000: CaveTileReg[0][0] = wordValue; break; case 0xb00002: CaveTileReg[0][1] = wordValue; break; case 0xb00004: CaveTileReg[0][2] = wordValue; break; case 0xb80000: CaveTileReg[1][0] = wordValue; break; case 0xb80002: CaveTileReg[1][1] = wordValue; break; case 0xb80004: CaveTileReg[1][2] = wordValue; break; case 0xc00000: CaveTileReg[2][0] = wordValue; break; case 0xc00002: CaveTileReg[2][1] = wordValue; break; case 0xc00004: CaveTileReg[2][2] = wordValue; break; case 0xd00000: if (~wordValue & 0x0100) { wordValue >>= 8; EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08); break; } case 0xd00002: { //nop return; } default: { bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); } }
void __fastcall metmqstrWriteWord(UINT32 sekAddress, UINT16 wordValue) { if (sekAddress >= 0xa8000a && sekAddress <= 0xa80068) return; if (sekAddress >= 0xa8006a && sekAddress <= 0xa8006c) return; if (sekAddress >= 0xa80004 && sekAddress <= 0xa80006) return; switch (sekAddress) { case 0xa80000: nCaveXOffset = wordValue; return; case 0xa80002: nCaveYOffset = wordValue; return; case 0xa80008: CaveSpriteBuffer(); nCaveSpriteBank = wordValue; return; case 0xa8006E: SoundLatch = wordValue; SoundLatchStatus |= 0x0C; ZetNmi(); nCyclesDone[1] += ZetRun(0x0400); return; case 0xb00000: CaveTileReg[2][0] = wordValue; break; case 0xb00002: CaveTileReg[2][1] = wordValue; break; case 0xb00004: CaveTileReg[2][2] = wordValue; break; case 0xb80000: CaveTileReg[1][0] = wordValue; break; case 0xb80002: CaveTileReg[1][1] = wordValue; break; case 0xb80004: CaveTileReg[1][2] = wordValue; break; case 0xc00000: CaveTileReg[0][0] = wordValue; break; case 0xc00002: CaveTileReg[0][1] = wordValue; break; case 0xc00004: CaveTileReg[0][2] = wordValue; break; case 0xd00000: if (~wordValue & 0x0100) { wordValue >>= 8; EEPROMWrite(wordValue & 0x04, wordValue & 0x02, wordValue & 0x08); break; } default: { bprintf(PRINT_NORMAL, _T("Attempt to write word value %x to location %x\n"), wordValue, sekAddress); } }
/* Run the virtual console emulation for one frame */ void system_frame(int skip_render) { static int iline_table[] = {0xC0, 0xE0, 0xF0}; int lpf = (sms.display == DISPLAY_NTSC) ? 262 : 313; int iline, z80cnt = 0;; INT32 nSoundBufferPos = 0; /* Debounce pause key */ if(input.system & INPUT_PAUSE) { if(!sms.paused) { sms.paused = 1; ZetNmi(); } } else { sms.paused = 0; } ZetNewFrame(); text_counter = 0; /* End of frame, parse sprites for line 0 on line 261 (VCount=$FF) */ if(vdp.mode <= 7) parse_line(0); for(vdp.line = 0; vdp.line < lpf;) { iline = iline_table[vdp.extended]; z80cnt = 0; if(!skip_render) { render_line(vdp.line); } if(vdp.line <= iline) { vdp.left -= 1; if(vdp.left == -1) { vdp.left = vdp.reg[0x0A]; vdp.hint_pending = 1; if(vdp.reg[0x00] & 0x10) { if (!(ZetTotalCycles() % CYCLES_PER_LINE)) { ZetRun(1); z80cnt++; } ZetSetIRQLine(0, CPU_IRQSTATUS_ACK); } } } else { vdp.left = vdp.reg[0x0A]; } ZetRun(228 - z80cnt); if(vdp.line == iline) { vdp.status |= 0x80; vdp.vint_pending = 1; if(vdp.reg[0x01] & 0x20) { ZetSetIRQLine(0, CPU_IRQSTATUS_ACK); } } // Render Sound Segment if (pBurnSoundOut) { INT32 nSegmentLength = nBurnSoundLen / lpf; INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); SN76496Update(0, pSoundBuf, nSegmentLength); nSoundBufferPos += nSegmentLength; } ++vdp.line; if(vdp.mode <= 7) parse_line(vdp.line); } // Make sure the buffer is entirely filled. if (pBurnSoundOut) { INT32 nSegmentLength = nBurnSoundLen - nSoundBufferPos; INT16* pSoundBuf = pBurnSoundOut + (nSoundBufferPos << 1); if (nSegmentLength) { SN76496Update(0, pSoundBuf, nSegmentLength); } } }