Read Processor Flags

To avoid using HLI for this purpose, the Compiler offers a set of intrinsic functions and inlines the function code. The associated intrinsic functions read the processor flags listed in the following listing.

Table 1. Read Processor Flags
Flag Flag Abbreviation Intrinsic Function Name
Carry C __isflag_carry()
Half carry H __isflag_half_carry()
Overflow V __isflag_overflow()
Interrupt pin high I __isflag_int()
Interrupt enable M __isflag_int_enabled()

Example:

  if(__isflag_carry()) goto label

  

This translates to a conditional branch to label, that is, the process branches if the carry flag is set (for the HC08, the resulting code is BCS label).