The Status Register contains information about the result of the most recently executed arithmetic instruction. This information can be used for altering program flow in order to perform conditional operations. The Status Register is updated after all ALU operations. This will in many cases remove the need for using the dedicated compare instructions, resulting in faster and more compact code.
The Status Register is not automatically stored when entering an interrupt routine and restored when returning from an interrupt. This must be handled by software.
When addressing I/O Registers as data space using LD and ST instructions, the provided offset must be used. When using the I/O specific commands IN and OUT, the offset is reduced by 0x20, resulting in an I/O address offset within 0x00 - 0x3F.
STATUS: Status Register
|bit 7||bit 0|
I : Global Interrupt Enable: The Global Interrupt Enable bit must be set for the interrupts to be enabled. The individual interrupt enable control is then performed in separate control registers. If the Global Interrupt Enable register is cleared, none of the interrupts are enabled independently of the individual interrupt enable settings. The I-bit (bit 7) is cleared by hardware after an interrupt has occurred, and is set by the RETI instruction to enable subsequent interrupts. The I-bit can also be set and cleared by the application with the SEI and CLI instructions, as described in the instruction set reference.
T : Copy Storage: The Bit Copy instructions BLD (Bit LoaD) and BST (Bit STore) use the T-bit as source or destination for the operated bit. A bit from a register in the register file can be copied into T by the BST instruction, and a bit in T can be copied into a bit in a register in the register file by the BLD instruction.
H : Half Carry Flag: The Half Carry Flag, H indicates a half carry in some arithmetic operations. The Half Carry Flag is useful in BCD arithmetic.
S : Sign Flag, S = N xor V: The S-bit is always an exclusive or between the Negative Flag and the Two’s Complement Overflow Flag.
V : Two's Compliment Overflow Flag: The Two’s Complement Overflow Flag, V supports two’s complement arithmetic.
N : Negative Flag: The Negative Flag, N indicates a negative result in an arithmetic or logic operation.
Z : Zero Flag: The Zero Flag, Z indicates a zero result in an arithmetic or logic operation.
C : Carry Flag: The Carry Flag, C indicates a carry in an arithmetic or logic operation.