mirror of
https://github.com/FranLMSP/rmg-001.git
synced 2024-11-23 10:12:11 +00:00
Prevent crashing on debug
This commit is contained in:
parent
707e9d76e1
commit
d655442b9a
@ -76,7 +76,7 @@ impl Bus {
|
||||
}
|
||||
|
||||
pub fn read_16bit(&self, address: u16) -> u16 {
|
||||
join_bytes(self.read(address + 1), self.read(address))
|
||||
join_bytes(self.read(address.wrapping_add(1)), self.read(address))
|
||||
}
|
||||
|
||||
pub fn write(&mut self, address: u16, data: u8) {
|
||||
@ -105,6 +105,6 @@ impl Bus {
|
||||
pub fn write_16bit(&mut self, address: u16, data: u16) {
|
||||
let bytes = data.to_le_bytes();
|
||||
self.write(address, bytes[0]);
|
||||
self.write(address + 1, bytes[1]);
|
||||
self.write(address.wrapping_add(1), bytes[1]);
|
||||
}
|
||||
}
|
||||
|
@ -227,9 +227,9 @@ impl OpcodeParameterBytes {
|
||||
pub fn from_address(address: u16, bus: &Bus)-> OpcodeParameterBytes {
|
||||
OpcodeParameterBytes(
|
||||
bus.read(address),
|
||||
bus.read(address + 1),
|
||||
bus.read(address + 2),
|
||||
bus.read(address + 3),
|
||||
bus.read(address.wrapping_add(1)),
|
||||
bus.read(address.wrapping_add(2)),
|
||||
bus.read(address.wrapping_add(3)),
|
||||
)
|
||||
}
|
||||
|
||||
@ -872,7 +872,7 @@ impl CPU {
|
||||
// self.log(parameter_bytes);
|
||||
self.increment_cycles(cycles);
|
||||
self.exec(opcode, bus);
|
||||
self.increment_exec_calls_count();
|
||||
// self.increment_exec_calls_count();
|
||||
}
|
||||
|
||||
pub fn exec(&mut self, opcode: Opcode, bus: &mut Bus) {
|
||||
|
Loading…
Reference in New Issue
Block a user