bsnes/higan/sfc/coprocessor/superfx/timing/timing.cpp

71 lines
1.4 KiB
C++
Raw Normal View History

auto SuperFX::step(unsigned clocks) -> void {
if(regs.romcl) {
regs.romcl -= min(clocks, regs.romcl);
if(regs.romcl == 0) {
regs.sfr.r = 0;
regs.romdr = bus_read((regs.rombr << 16) + regs.r[14]);
}
}
if(regs.ramcl) {
regs.ramcl -= min(clocks, regs.ramcl);
if(regs.ramcl == 0) {
bus_write(0x700000 + (regs.rambr << 16) + regs.ramar, regs.ramdr);
}
}
Update to v098r01 release. byuu says: Changelog: - SFC: balanced profile removed - SFC: performance profile removed - SFC: code for handling non-threaded CPU, SMP, DSP, PPU removed - SFC: Coprocessor, Controller (and expansion port) shared Thread code merged to SFC::Cothread - Cothread here just means "Thread with CPU affinity" (couldn't think of a better name, sorry) - SFC: CPU now has vector<Thread*> coprocessors, peripherals; - this is the beginning of work to allow expansion port devices to be dynamically changed at run-time - ruby: all audio drivers default to 48000hz instead of 22050hz now if no frequency is assigned - note: the WASAPI driver can default to whatever the native frequency is; doesn't have to be 48000hz - tomoko: removed the ability to change the frequency from the UI (but it will display the frequency used) - tomoko: removed the timing settings panel - the goal is to work toward smooth video via adaptive sync - the model is broken by not being in control of the audio frequency anyway - it's further broken by PAL running at 50hz and WSC running at 75hz - it was always broken anyway by SNES interlace timing varying from progressive timing - higan: audio/ stub created (for now, it's just nall/dsp/ moved here and included as a header) - higan: video/ stub created - higan/GNUmakefile: now includes build rules for essential components (libco, emulator, audio, video) The audio changes are in preparation to merge wareya's awesome WASAPI work without the need for the nall/dsp resampler.
2016-04-09 03:40:12 +00:00
Cothread::step(clocks);
synchronizeCPU();
}
auto SuperFX::rombuffer_sync() -> void {
if(regs.romcl) step(regs.romcl);
}
auto SuperFX::rombuffer_update() -> void {
regs.sfr.r = 1;
regs.romcl = regs.clsr ? 5 : 6;
}
auto SuperFX::rombuffer_read() -> uint8 {
rombuffer_sync();
return regs.romdr;
}
auto SuperFX::rambuffer_sync() -> void {
if(regs.ramcl) step(regs.ramcl);
}
auto SuperFX::rambuffer_read(uint16 addr) -> uint8 {
rambuffer_sync();
return bus_read(0x700000 + (regs.rambr << 16) + addr);
}
auto SuperFX::rambuffer_write(uint16 addr, uint8 data) -> void {
rambuffer_sync();
regs.ramcl = regs.clsr ? 5 : 6;
regs.ramar = addr;
regs.ramdr = data;
}
auto SuperFX::r14_modify(uint16 data) -> void {
regs.r[14].data = data;
rombuffer_update();
}
auto SuperFX::r15_modify(uint16 data) -> void {
regs.r[15].data = data;
r15_modified = true;
}
auto SuperFX::timing_reset() -> void {
r15_modified = false;
regs.romcl = 0;
regs.romdr = 0;
regs.ramcl = 0;
regs.ramar = 0;
regs.ramdr = 0;
}