bsnes/higan/sfc/cpu/memory.cpp
Tim Allen 680d16561e Update to v097r29 release.
byuu says:

Changelog:
- fixed DAS instruction (Judgment Silversword score)
- fixed [VH]TMR_FREQ writes (Judgement Silversword audio after area 20)
- fixed initialization of SP (fixes seven games that were hanging on
  startup)
- added SER_STATUS and SER_DATA stubs (fixes four games that were
  hanging on startup)
- initialized IEEP data (fixes Super Robot Taisen Compact 2 series)
  - note: you'll need to delete your internal.com in WonderSwan
    (Color).sys folders
- fixed CMPS and SCAS termination condition (fixes serious bugs in four
  games)
- set read/writeCompleted flags for EEPROM status (fixes Tetsujin 28
  Gou)
- major code cleanups to SFC/R65816 and SFC/CPU
  - mostly refactored disassembler to output strings instead of using
    char* buffer
  - unrolled all the subfolders on sfc/cpu to a single directory
  - corrected casing for all of sfc/cpu and a large portion of
    processor/r65816

I kind of went overboard on the code cleanup with this WIP. Hopefully
nothing broke. Any testing one can do with the SFC accuracy core would
be greatly appreciated.

There's still an absolutely huge amount of work left to go, but I do
want to eventually refresh the entire codebase to my current coding
style, which is extremely different from stuff that's been in higan
mostly untouched since ~2006 or so. It's dangerous and fickle work, but
if I don't do it, then the code will be a jumbled mess of several
different styles.
2016-03-26 12:56:15 +11:00

49 lines
1.0 KiB
C++

auto CPU::portRead(uint2 port) const -> uint8 {
return status.port[port];
}
auto CPU::portWrite(uint2 port, uint8 data) -> void {
status.port[port] = data;
}
auto CPU::io() -> void {
status.clock_count = 6;
dmaEdge();
addClocks(6);
aluEdge();
}
auto CPU::read(uint24 addr) -> uint8 {
status.clock_count = speed(addr);
dmaEdge();
addClocks(status.clock_count - 4);
regs.mdr = bus.read(addr, regs.mdr);
addClocks(4);
aluEdge();
debugger.op_read(addr, regs.mdr);
return regs.mdr;
}
auto CPU::write(uint24 addr, uint8 data) -> void {
aluEdge();
status.clock_count = speed(addr);
dmaEdge();
addClocks(status.clock_count);
bus.write(addr, regs.mdr = data);
debugger.op_write(addr, regs.mdr);
}
auto CPU::speed(uint24 addr) const -> uint {
if(addr & 0x408000) {
if(addr & 0x800000) return status.rom_speed;
return 8;
}
if((addr + 0x6000) & 0x4000) return 8;
if((addr - 0x4000) & 0x7e00) return 6;
return 12;
}
auto CPU::disassemblerRead(uint24 addr) -> uint8 {
return bus.read(addr, regs.mdr);
}