mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-22 06:02:28 +01:00
byuu says: Changelog: - fixed FC AxROM / VRC7 regression - BitField split to BooleanBitField/NaturalBitField (in preparation for IntegerBitField) - BitFieldReference removed - GB CPU cleaned up - GB Cartridge + Mappers cleaned up - SFC CGRAM is now emulated as uint15[256] instead of uint[512] - sfc/ppu/memory.cpp no longer needed; removed - purged SFC Debugger hooks for now (some of the operator[] calls were bypassing them anyway) Unfortunately, for reasons that defy all semblance of logic, the CGRAM change caused a slight speed hit. As have the last few changes. We're now down to around 129.5fps compared to 123.fps for v099 and 134.5fps at our peak (v099r01-r02). I really like the style I came up with for the Game Boy mappers to settle the purpose(ROM,RAM) vs (rom,ram)Purpose naming convention. If I ever get around to redoing the NES mappers, that's likely the approach I'll take.
114 lines
2.1 KiB
C++
114 lines
2.1 KiB
C++
#include <sfc/sfc.hpp>
|
|
|
|
namespace SuperFamicom {
|
|
|
|
SMP smp;
|
|
|
|
#include "memory.cpp"
|
|
#include "timing.cpp"
|
|
#include "serialization.cpp"
|
|
|
|
auto SMP::step(uint clocks) -> void {
|
|
clock += clocks * (uint64)cpu.frequency;
|
|
dsp.clock -= clocks;
|
|
}
|
|
|
|
auto SMP::synchronizeCPU() -> void {
|
|
if(clock >= 0 && !scheduler.synchronizing()) co_switch(cpu.thread);
|
|
}
|
|
|
|
auto SMP::synchronizeDSP() -> void {
|
|
if(dsp.clock < 0 && !scheduler.synchronizing()) co_switch(dsp.thread);
|
|
}
|
|
|
|
auto SMP::Enter() -> void {
|
|
while(true) scheduler.synchronize(), smp.main();
|
|
}
|
|
|
|
auto SMP::main() -> void {
|
|
instruction();
|
|
}
|
|
|
|
auto SMP::load(Markup::Node node) -> bool {
|
|
if(auto name = node["smp/rom/name"].text()) {
|
|
if(auto fp = interface->open(ID::System, name, File::Read, File::Required)) {
|
|
fp->read(iplrom, 64);
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
auto SMP::power() -> void {
|
|
//targets not initialized/changed upon reset
|
|
timer0.target = 0;
|
|
timer1.target = 0;
|
|
timer2.target = 0;
|
|
}
|
|
|
|
auto SMP::reset() -> void {
|
|
create(Enter, system.apuFrequency());
|
|
|
|
regs.pc.l = iplrom[62];
|
|
regs.pc.h = iplrom[63];
|
|
regs.a = 0x00;
|
|
regs.x = 0x00;
|
|
regs.y = 0x00;
|
|
regs.s = 0xef;
|
|
regs.p = 0x02;
|
|
|
|
for(auto& byte : apuram) byte = random(0x00);
|
|
apuram[0x00f4] = 0x00;
|
|
apuram[0x00f5] = 0x00;
|
|
apuram[0x00f6] = 0x00;
|
|
apuram[0x00f7] = 0x00;
|
|
|
|
status.clockCounter = 0;
|
|
status.dspCounter = 0;
|
|
status.timerStep = 3;
|
|
|
|
//$00f0
|
|
status.clockSpeed = 0;
|
|
status.timerSpeed = 0;
|
|
status.timersEnable = true;
|
|
status.ramDisable = false;
|
|
status.ramWritable = true;
|
|
status.timersDisable = false;
|
|
|
|
//$00f1
|
|
status.iplromEnable = true;
|
|
|
|
//$00f2
|
|
status.dspAddr = 0x00;
|
|
|
|
//$00f8,$00f9
|
|
status.ram00f8 = 0x00;
|
|
status.ram00f9 = 0x00;
|
|
|
|
timer0.stage0 = 0;
|
|
timer1.stage0 = 0;
|
|
timer2.stage0 = 0;
|
|
|
|
timer0.stage1 = 0;
|
|
timer1.stage1 = 0;
|
|
timer2.stage1 = 0;
|
|
|
|
timer0.stage2 = 0;
|
|
timer1.stage2 = 0;
|
|
timer2.stage2 = 0;
|
|
|
|
timer0.stage3 = 0;
|
|
timer1.stage3 = 0;
|
|
timer2.stage3 = 0;
|
|
|
|
timer0.line = 0;
|
|
timer1.line = 0;
|
|
timer2.line = 0;
|
|
|
|
timer0.enable = false;
|
|
timer1.enable = false;
|
|
timer2.enable = false;
|
|
}
|
|
|
|
}
|