pub fn load_indirect_r16_decrement_r8(cpu: &mut CPU, r16_indirect_addr: &Reg16, r8: &Reg8) -> u8 {
    let value = cpu.registers.read8(r8);
    let indirect_addr = cpu.registers.read16(r16_indirect_addr);

    // Write to memory using 16-bit register value as address
    cpu.mmu.write8(indirect_addr, value);

    // Decrement the 16-bit indirect address register
    cpu.registers
        .write16(r16_indirect_addr, indirect_addr.wrapping_sub(1));

    8
}
/// Load an 8-bit register with an indirect value, taken from memory using a 16-bit register as an
/// address. Then decrement that 16-bit register.
///
/// Takes 8 cycles.
///
/// # Examples
///
/// ```asm
/// LD A, (HL-) ; memory[HL] <- A; HL--
/// ```
Load an 8-bit register with an indirect value, taken from memory using a 16-bit register as an
address. Then decrement that 16-bit register.

Takes 8 cycles.
Load an 8 - bit register with an indirect value taken from memory using a 16 - bit register as an address . Then decrement that 16 - bit register . Takes 8 cycles .
pub fn load_indirect_r16_decrement_r8(cpu: &mut CPU, r16_indirect_addr: &Reg16, r8: &Reg8) -> u8 {
    let value = cpu.registers.read8(r8);
    let indirect_addr = cpu.registers.read16(r16_indirect_addr);
    // Write to memory using 16-bit register value as address
    cpu.mmu.write8(indirect_addr, value);
    // Decrement the 16-bit indirect address register
    cpu.registers
        .write16(r16_indirect_addr, indirect_addr.wrapping_sub(1));
    8
}
pub fn load_indirect_r16_decrement_r8 ( cpu : & mut CPU , r16_indirect_addr : & Reg16 , r8 : & Reg8 ) -> u8 { let value = cpu . registers . read8 ( r8 ) ; let indirect_addr = cpu . registers . read16 ( r16_indirect_addr ) ; // Write to memory using 16-bit register value as address cpu . mmu . write8 ( indirect_addr , value ) ; // Decrement the 16-bit indirect address register cpu . registers . write16 ( r16_indirect_addr , indirect_addr . wrapping_sub ( 1 ) ) ; 8 }
Load an 8-bit register with an indirect value, taken from memory using a 16-bit register as an
address.
Load an 8 - bit register with an indirect value taken from memory using a 16 - bit register as an address .
cpu
&mut CPU
r16_indirect_addr
&Reg16
r8
&Reg8
cpu
&mut CPU
r16_indirect_addr
&Reg16
r8
&Reg8
examples
None