pub fn read_write_abs(
        cpu: &mut Cpu,
        bus: &mut dyn CpuAddressBus,
        operation: fn(&mut Cpu, u8) -> u8,
    ) {
        let addr = cpu.fetch_operand_u16(bus);
        cpu.cycle_count += 1;
        cpu.pc += 1;

        let val = bus.read(addr, cpu);
        cpu.cycle_count += 1;

        bus.write(addr, val, cpu);
        cpu.cycle_count += 1;

        let res = operation(cpu, val);
        bus.write(addr, res, cpu);
        cpu.cycle_count += 1;
    }
// fetches the absolute address at pc+1, performs 'operation' on the
// value at the address and stores it back
fetches the absolute address at pc+1, performs 'operation' on the
value at the address and stores it back
fetches the absolute address at pc + 1 performs ' operation ' on the value at the address and stores it back
pub fn read_write_abs(
        cpu: &mut Cpu,
        bus: &mut dyn CpuAddressBus,
        operation: fn(&mut Cpu, u8) -> u8,
    ) {
        let addr = cpu.fetch_operand_u16(bus);
        cpu.cycle_count += 1;
        cpu.pc += 1;
        let val = bus.read(addr, cpu);
        cpu.cycle_count += 1;
        bus.write(addr, val, cpu);
        cpu.cycle_count += 1;
        let res = operation(cpu, val);
        bus.write(addr, res, cpu);
        cpu.cycle_count += 1;
    }
pub fn read_write_abs ( cpu : & mut Cpu , bus : & mut dyn CpuAddressBus , operation : fn ( & mut Cpu , u8 ) -> u8 , ) { let addr = cpu . fetch_operand_u16 ( bus ) ; cpu . cycle_count += 1 ; cpu . pc += 1 ; let val = bus . read ( addr , cpu ) ; cpu . cycle_count += 1 ; bus . write ( addr , val , cpu ) ; cpu . cycle_count += 1 ; let res = operation ( cpu , val ) ; bus . write ( addr , res , cpu ) ; cpu . cycle_count += 1 ; }
fetches the absolute address at pc+1, performs 'operation' on the
value at the address and stores it back
fetches the absolute address at pc + 1 performs ' operation ' on the value at the address and stores it back
cpu
&mut Cpu
bus
&mut dyn CpuAddressBus
operation
fn(&mut Cpu, u8) -> u8
cpu
&mut Cpu
bus
&mut dyn CpuAddressBus
operation
fn(&mut Cpu, u8) -> u8