src/cpu.c
void rla(word addr, int cycles, int pcIncrease) {
	log_instruction(pcIncrease - 1, "\tRLA $%02X\t", addr);

	byte value = rmem_b(addr);

	byte cachedFlagC = (byte) bit_test(P, flagC);
	byte cached7 = (byte) bit_test(value, 7);

	bit_val(&P, flagC, cached7);
	byte shifted = value << 1;

	bit_val(&shifted, 0, cachedFlagC);
	wmem_b(addr, shifted);

	A &= shifted;
	bit_val(&P, flagZ, A == 0);
	bit_val(&P, flagN, bit_test(A, 7));

	cpu_cyclesThisSec += cycles;
	PC += pcIncrease;
}
/**
 * RLA ROLs the contents of a memory location and then ANDs the result with the accumulator.
 */
RLA ROLs the contents of a memory location and then ANDs the result with the accumulator.
RLA ROLs the contents of a memory location and then ANDs the result with the accumulator .
void rla(word addr, int cycles, int pcIncrease) {
	log_instruction(pcIncrease - 1, "\tRLA $%02X\t", addr);
	byte value = rmem_b(addr);
	byte cachedFlagC = (byte) bit_test(P, flagC);
	byte cached7 = (byte) bit_test(value, 7);
	bit_val(&P, flagC, cached7);
	byte shifted = value << 1;
	bit_val(&shifted, 0, cachedFlagC);
	wmem_b(addr, shifted);
	A &= shifted;
	bit_val(&P, flagZ, A == 0);
	bit_val(&P, flagN, bit_test(A, 7));
	cpu_cyclesThisSec += cycles;
	PC += pcIncrease;
}
void rla ( word addr , int cycles , int pcIncrease ) { log_instruction ( pcIncrease - 1 , " \t \t " , addr ) ; byte value = rmem_b ( addr ) ; byte cachedFlagC = ( byte ) bit_test ( P , flagC ) ; byte cached7 = ( byte ) bit_test ( value , 7 ) ; bit_val ( & P , flagC , cached7 ) ; byte shifted = value << 1 ; bit_val ( & shifted , 0 , cachedFlagC ) ; wmem_b ( addr , shifted ) ; A &= shifted ; bit_val ( & P , flagZ , A == 0 ) ; bit_val ( & P , flagN , bit_test ( A , 7 ) ) ; cpu_cyclesThisSec += cycles ; PC += pcIncrease ; }
RLA ROLs the contents of a memory location and then ANDs the result with the accumulator.
RLA ROLs the contents of a memory location and then ANDs the result with the accumulator .