void nes_reset(NES *nes) { joypad_reset(&(nes->pad)); mmc_reset (&(nes->mmc)); ppu_reset (&(nes->ppu)); apu_reset (&(nes->apu)); cpu_reset (&(nes->cpu)); }
void reset(bool hard_reset) { if(hard_reset) { memset(cpu_->mem_page[0], 0, NES_RAMSIZE); if(rominfo_->vram) { mem_trash_(rominfo_->vram, 0x2000 * rominfo_->vram_banks); } } apu_reset(); ppu_reset(hard_reset == true ? 1 : 0); mmc_reset(); nes6502_reset(); scanline_ = 241; }
void nes_reset(int hard) { int i; if(nes->rom == 0) return; //set default read/write handlers for(i=0;i<16;i++) { mem_setread(i,0); mem_setwrite(i,0); } //set rom read handlers (mappers might use these) for(i=8;i<16;i++) mem_setread(i,nes_read_rom); //ram mem_setreadptr(0,nes->ram); mem_setwriteptr(0,nes->ram); mem_setreadptr(1,nes->ram); mem_setwriteptr(1,nes->ram); //ppu mem_setread(2,ppu_read); mem_setwrite(2,ppu_write); mem_setread(3,ppu_read); mem_setwrite(3,ppu_write); //apu mem_setread(4,nes_read_4000); mem_setwrite(4,nes_write_4000); //mapper will set its read/write handlers nes->mapper->reset(hard); nes->frame_irqmode = 0; apu_reset(hard); ppu_reset(); dead6502_reset(); if(hard) { memset(nes->ram,0,0x800); for(i=0;i<32;i++) pal_write(i,startup_pal[i]); } log_message("nes reset ok\n"); }
// 内部函数实现 static void nes_do_reset(NES *nes) { // mmc need reset first mmc_reset(&(nes->mmc)); // reset cpu & ppu & apu cpu_reset(&(nes->cpu)); ppu_reset(&(nes->ppu)); apu_reset(&(nes->apu)); // reset joypad joypad_reset(&(nes->pad)); // reset replay replay_reset(&(nes->replay)); // restart ndb ndb_set_debug(&(nes->ndb), NDB_DEBUG_MODE_RESTART); }