TrietPhan_FinalProject.c
// Update condition code if there is a destination register
Update condition code if there is a destination register
Update condition code if there is a destination register
void update_cc(CPU *cpu) {
  Address check_reg = extract_bits(cpu -> ir, 9, 12);
  Word value = cpu -> reg[check_reg];
  if(value == 0) {
    cpu -> condition_code = CC_ZERO;
  }
  else if(value > 0) {
    cpu -> condition_code = CC_POSITIVE;
  }
  else {
    cpu -> condition_code = CC_NEGATIVE;
  }
}
void update_cc ( CPU * cpu ) { Address check_reg = extract_bits ( cpu -> ir , 9 , 12 ) ; Word value = cpu -> reg [ check_reg ] ; if ( value == 0 ) { cpu -> condition_code = CC_ZERO ; } else if ( value > 0 ) { cpu -> condition_code = CC_POSITIVE ; } else { cpu -> condition_code = CC_NEGATIVE ; } }
Update condition code if there is a destination register
Update condition code if there is a destination register