2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::step(unsigned clocks) -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
if(regs.romcl) {
|
|
|
|
regs.romcl -= min(clocks, regs.romcl);
|
|
|
|
if(regs.romcl == 0) {
|
|
|
|
regs.sfr.r = 0;
|
2011-01-16 13:17:45 +00:00
|
|
|
regs.romdr = bus_read((regs.rombr << 16) + regs.r[14]);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(regs.ramcl) {
|
|
|
|
regs.ramcl -= min(clocks, regs.ramcl);
|
|
|
|
if(regs.ramcl == 0) {
|
2011-01-16 13:17:45 +00:00
|
|
|
bus_write(0x700000 + (regs.rambr << 16) + regs.ramar, regs.ramdr);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-29 06:16:44 +00:00
|
|
|
Coprocessor::step(clocks);
|
2010-08-09 13:28:56 +00:00
|
|
|
synchronize_cpu();
|
|
|
|
}
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::rombuffer_sync() -> void {
|
2012-04-29 06:16:44 +00:00
|
|
|
if(regs.romcl) step(regs.romcl);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::rombuffer_update() -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
regs.sfr.r = 1;
|
2015-06-28 08:44:56 +00:00
|
|
|
regs.romcl = regs.clsr ? 5 : 6;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::rombuffer_read() -> uint8 {
|
2010-08-09 13:28:56 +00:00
|
|
|
rombuffer_sync();
|
|
|
|
return regs.romdr;
|
|
|
|
}
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::rambuffer_sync() -> void {
|
2012-04-29 06:16:44 +00:00
|
|
|
if(regs.ramcl) step(regs.ramcl);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::rambuffer_read(uint16 addr) -> uint8 {
|
2010-08-09 13:28:56 +00:00
|
|
|
rambuffer_sync();
|
2011-01-16 13:17:45 +00:00
|
|
|
return bus_read(0x700000 + (regs.rambr << 16) + addr);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::rambuffer_write(uint16 addr, uint8 data) -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
rambuffer_sync();
|
2015-06-28 08:44:56 +00:00
|
|
|
regs.ramcl = regs.clsr ? 5 : 6;
|
2010-08-09 13:28:56 +00:00
|
|
|
regs.ramar = addr;
|
|
|
|
regs.ramdr = data;
|
|
|
|
}
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::r14_modify(uint16 data) -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
regs.r[14].data = data;
|
|
|
|
rombuffer_update();
|
|
|
|
}
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::r15_modify(uint16 data) -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
regs.r[15].data = data;
|
|
|
|
r15_modified = true;
|
|
|
|
}
|
|
|
|
|
2015-06-27 02:38:47 +00:00
|
|
|
auto SuperFX::timing_reset() -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
r15_modified = false;
|
|
|
|
|
|
|
|
regs.romcl = 0;
|
|
|
|
regs.romdr = 0;
|
|
|
|
|
|
|
|
regs.ramcl = 0;
|
|
|
|
regs.ramar = 0;
|
|
|
|
regs.ramdr = 0;
|
|
|
|
}
|