What is PSW in Microprocessors?
PSW stands for “program status word” or the status register that pertains to the current state of a particular processor. It consists of several flag bits for a processor which is why PSW is sometimes referred to as a “flag register”. Some people also refer to the Program Status Word as the “condition code register”.
Flag bits are what describe the actual and current state of the processor. These bits include details such as recent arithmetic operations that may have produced either zero, negative, or positive result. Like in the case of an instruction with a “branch on zero” result using the subtraction method, this particular branch will be taken if the processor status flag gives a zero value as the end-product of the subtraction process.
PSW also contains details on the process state of the microprocessor. The status flags are written by machine code instructions that are currently running on the processor. In basic processor designs, there are three standard flags namely the “zero” flag, “carry flag, and “overflow” flag. The zero flag basically tells that the result of a logical or arithmetic operation is zero. The carry flag meanwhile pertains to the ability of large numbers to carry a binary digit from a bit that is considered the least significant. The overflow flag literally means that the result of a logical operation cannot fit in the involved register and therefore overflows. Other common status flags in microprocessors include the S/N flag and the P flag. S/N flag is short for sign / negative flag and this flag is used when the result is negative. But there are also processors that use the S and N flags separately with distinct meanings from each other. The N flag represents a negative result while the S or sign flag involves an addition or subtraction in the process.