Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/libsnes/bsnes/snes/alt/cpu/memory.cpp
2 views
1
#ifdef CPU_CPP
2
3
uint8 CPU::pio() {
4
return status.pio;
5
}
6
7
bool CPU::joylatch() {
8
return status.joypad_strobe_latch;
9
}
10
11
bool CPU::interrupt_pending() {
12
return false;
13
}
14
15
uint8 CPU::port_read(uint8 port) {
16
return port_data[port & 3];
17
}
18
19
void CPU::port_write(uint8 port, uint8 data) {
20
port_data[port & 3] = data;
21
}
22
23
void CPU::op_io() {
24
add_clocks(6);
25
}
26
27
uint8 CPU::op_read(unsigned addr, eCDLog_Flags flags) {
28
cdlInfo.currFlags = flags;
29
regs.mdr = bus.read(addr);
30
add_clocks(speed(addr));
31
return regs.mdr;
32
}
33
34
void CPU::op_write(unsigned addr, uint8 data) {
35
add_clocks(speed(addr));
36
bus.write(addr, regs.mdr = data);
37
}
38
39
unsigned CPU::speed(unsigned addr) const {
40
if(addr & 0x408000) {
41
if(addr & 0x800000) return status.rom_speed;
42
return 8;
43
}
44
if((addr + 0x6000) & 0x4000) return 8;
45
if((addr - 0x4000) & 0x7e00) return 6;
46
return 12;
47
}
48
49
#endif
50
51