Path: blob/master/libsnes/bsnes/snes/chip/superfx/superfx.cpp
2 views
#include <snes/snes.hpp>12#define SUPERFX_CPP3namespace SNES {45#include "serialization.cpp"6#include "bus/bus.cpp"7#include "core/core.cpp"8#include "memory/memory.cpp"9#include "mmio/mmio.cpp"10#include "timing/timing.cpp"11#include "disasm/disasm.cpp"1213SuperFX superfx;1415void SuperFX::Enter() { superfx.enter(); }1617void SuperFX::enter() {18while(true) {19if(scheduler.sync == Scheduler::SynchronizeMode::All) {20scheduler.exit(Scheduler::ExitReason::SynchronizeEvent);21}2223if(regs.sfr.g == 0) {24add_clocks(6);25synchronize_cpu();26continue;27}2829(this->*opcode_table[(regs.sfr & 0x0300) + peekpipe()])();30if(r15_modified == false) regs.r[15]++;3132if(++instruction_counter >= 128) {33instruction_counter = 0;34synchronize_cpu();35}36}37}3839void SuperFX::init() {40initialize_opcode_table();41regs.r[14].on_modify = { &SuperFX::r14_modify, this };42regs.r[15].on_modify = { &SuperFX::r15_modify, this };43}4445void SuperFX::load() {46}4748void SuperFX::unload() {49}5051void SuperFX::power() {52clockmode = config.superfx.speed;53}5455void SuperFX::reset() {56create(SuperFX::Enter, system.cpu_frequency());57instruction_counter = 0;5859for(unsigned n = 0; n < 16; n++) regs.r[n] = 0x0000;60regs.sfr = 0x0000;61regs.pbr = 0x00;62regs.rombr = 0x00;63regs.rambr = 0;64regs.cbr = 0x0000;65regs.scbr = 0x00;66regs.scmr = 0x00;67regs.colr = 0x00;68regs.por = 0x00;69regs.bramr = 0;70regs.vcr = 0x04;71regs.cfgr = 0x00;72regs.clsr = 0;73regs.pipeline = 0x01; //nop74regs.ramaddr = 0x0000;75regs.reset();7677memory_reset();78timing_reset();79}8081}828384