mirror of
https://github.com/FranLMSP/snes.git
synced 2026-01-01 07:21:35 -05:00
fix more instructions
This commit is contained in:
@@ -15,6 +15,11 @@ impl CPUInstruction for PLP {
|
||||
if registers.emulation_mode {
|
||||
registers.set_memory_select_flag(true);
|
||||
registers.set_index_register_select_flag(true);
|
||||
} else {
|
||||
if !registers.is_16bit_index() {
|
||||
registers.x &= 0xFF;
|
||||
registers.y &= 0xFF;
|
||||
}
|
||||
}
|
||||
let (bytes, cycles) = cycles::increment_cycles_plp();
|
||||
registers.increment_pc(bytes); registers.cycles += cycles;
|
||||
|
||||
@@ -10,11 +10,14 @@ pub struct XCE {}
|
||||
|
||||
impl CPUInstruction for XCE {
|
||||
fn execute(&self, registers: &mut Registers, _bus: &mut Bus) {
|
||||
let did_mode_change = registers.emulation_mode != registers.get_carry_flag();
|
||||
registers.exchange_carry_and_emulation();
|
||||
if did_mode_change {
|
||||
if registers.emulation_mode {
|
||||
registers.set_memory_select_flag(true);
|
||||
registers.set_index_register_select_flag(true);
|
||||
registers.x &= 0xFF;
|
||||
registers.y &= 0xFF;
|
||||
registers.sp &= 0xFF;
|
||||
registers.sp |= 0x100;
|
||||
}
|
||||
let (bytes, cycles) = cycles::increment_cycles_exchange();
|
||||
registers.increment_pc(bytes); registers.cycles += cycles;
|
||||
|
||||
@@ -274,6 +274,7 @@ impl PPURegisters {
|
||||
_ => unreachable!(),
|
||||
};
|
||||
if address_translation_rotate > 0 {
|
||||
println!("ADDRESS ROTATE {}", address_translation_rotate);
|
||||
// TODO: implement address translation
|
||||
}
|
||||
let increment_when_lo = (register >> 7) == 0;
|
||||
|
||||
@@ -190,7 +190,8 @@ fn build_vram_window(ctx: &egui::Context, ppu_debug_options: &mut PPUDebugContro
|
||||
for row in chunks {
|
||||
let mut address_row = format!("{:04X} | ", row[0]);
|
||||
for address in row {
|
||||
address_row = format!("{}{:04X} ", address_row, ppu_registers.vram()[((*address) & 0x7FFF) as usize]);
|
||||
let effective_vram_address = ((*address) & 0x7FFF) as usize;
|
||||
address_row = format!("{}{:04X} ", address_row, ppu_registers.vram()[effective_vram_address]);
|
||||
}
|
||||
ui.monospace(address_row);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user