重点推荐:
http://www.armory.com/~rstevew/Public/Tutor/Debug/index.html
老外写的东西就是好。
FLAGS REGISTER
Flags Register - determines the current state of the processor. They are modified automatically by CPU after mathematical operations, this allows to determine the type of the result, and to determine conditions to transfer control to other parts of the program.Generally you cannot access these registers directly.
- Carry Flag (CF) - this flag is set to 1 when there is an unsigned overflow. For example when you add bytes 255 + 1 (result is not in range 0...255). When there is no overflow this flag is set to 0.
- Parity Flag (PF) - this flag is set to 1 when there is even number of one bits in result, and to 0 when there is odd number of one bits.
- Auxiliary Flag (AF) - set to 1 when there is an unsigned overflow for low nibble (4 bits).
- Zero Flag (ZF) - set to 1 when result is zero. For non-zero result this flag is set to 0.
- Sign Flag (SF) - set to 1 when result is negative. When result is positive it is set to 0. (This flag takes the value of the most significant bit.)
- Trap Flag (TF) - Used for on-chip debugging.
- Interrupt enable Flag (IF) - when this flag is set to 1 CPU reacts to interrupts from external devices.
- Direction Flag (DF) - this flag is used by some instructions to process data chains, when this flag is set to 0 - the processing is done forward, when this flag is set to 1 the processing is done backward.
- Overflow Flag (OF) - set to 1 when there is a signed overflow. For example, when you add bytes 100 + 50 (result is not in range -128...127).