bsnes/higan/sfc/cpu/memory.cpp
Tim Allen 40802b0b9f Update to v103r05 release.
byuu says:

Changelog:

  - fc/controller: added ControllerPort class; removed Peripherals class
  - md/controller/gamepad: removed X,Y,Z buttons since this isn't a
    6-button controller
  - ms/controller: added ControllerPort class (not used in Game Gear
    mode); removed Peripherals class
  - pce/controller: added ControllerPort class; removed Peripherals
    class
  - processor/spc700: idle(address) is part of SMP class again, contains
    flag to detect mov (x)+ edge case
  - sfc/controller/super-scope,justifier: use CPU frequency instead of
    hard-coding NTSC frequency
  - sfc/cpu: move 4x8-bit SMP ports to SMP class
  - sfc/smp: move APU RAM to DSP class
  - sfc/smp: improved emulation of TEST registers bits 4-7 [information
    from nocash]
      - d4,d5 is RAM wait states (1,2,5,10)
      - d6,d7 is ROM/IO wait states (1,2,5,10)
  - sfc/smp: code cleanup to new style (order from lowest to highest
    bits; use .bit(s) functions)
  - sfc/smp: $00f8,$00f9 are P4/P5 auxiliary ports; named the registers
    better
2017-07-01 16:15:27 +10:00

38 lines
880 B
C++

auto CPU::idle() -> void {
status.clockCount = 6;
dmaEdge();
step(6);
aluEdge();
}
auto CPU::read(uint24 addr) -> uint8 {
status.clockCount = speed(addr);
dmaEdge();
step(status.clockCount - 4);
auto data = bus.read(addr, r.mdr);
step(4);
aluEdge();
//$00-3f,80-bf:4000-43ff reads are internal to CPU, and do not update the MDR
if((addr & 0x40fc00) != 0x4000) r.mdr = data;
return data;
}
auto CPU::write(uint24 addr, uint8 data) -> void {
aluEdge();
status.clockCount = speed(addr);
dmaEdge();
step(status.clockCount);
bus.write(addr, r.mdr = data);
}
auto CPU::speed(uint24 addr) const -> uint {
if(addr & 0x408000) return addr & 0x800000 ? io.romSpeed : 8;
if(addr + 0x6000 & 0x4000) return 8;
if(addr - 0x4000 & 0x7e00) return 6;
return 12;
}
auto CPU::readDisassembler(uint24 addr) -> uint8 {
return bus.read(addr, r.mdr);
}