Chapter 6 Summary
1. There are three types of unconditional jump instructions: short, near, and far. The short jump
allows a branch to within +127 and -128 bytes. The near jump (using a displacement of
±32K) allows a jump to any location in the current code segment (intrasegment). The far
jump allows a jump to any location in the memory system (intersegment). The near jump in
an 80386 through a Core2 is within ±2G bytes because these microprocessors can use a
32-bit signed displacement.
2. Whenever a label appears with a JMP instruction or conditional jump, the label, located in
the label field, must be followed by a colon (LABEL:). For example, the JMP DOGGY
instruction jumps to memory location DOGGY:.
3. The displacement that follows a short or near jump is the distance from the next instruction
to the jump location.
4. Indirect jumps are available in two forms: (1) jump to the location stored in a register and
(2) jump to the location stored in a memory word (near indirect) or doubleword (far
indirect).
5. Conditional jumps are all short jumps that test one or more of the flag bits: C, Z, O, P,
or S. If the condition is true, a jump occurs; if the condition is false, the next sequential
instruction executes. Note that the 80386 and above allow a 16-bit signed displacement for
the conditional jump instructions. In 64-bit mode, the displacement is 32 bits allowing a
range of ±2G.
6. A special conditional jump instruction (LOOP) decrements CX and jumps to the label when
CX is not 0. Other forms of loop include LOOPE, LOOPNE, LOOPZ, and LOOPNZ. The
LOOPE instruction jumps if CX is not 0 and if an equal condition exists. In the 80386
through the Core2, the LOOPD, LOOPED, and LOOPNED instructions also use the
ECX register as a counter. In the 64-bit mode, these instructions use the RCX register as for
iteration.
7. The 80386 through the Core2 contain conditional set instructions that either set a byte to
01H or clear it to 00H. If the condition under test is true, the operand byte is set to 01H; if
the condition under test is false, the operand byte is cleared to 00H.
8. The .IF and .ENDIF statements are useful in assembly language for making decisions. The
instructions cause the assembler to generate conditional jump statements that modify the
flow of the program.
9. The .WHILE and .ENDW statements allow an assembly language program to use the
WHILE construction, and the .REPEAT and .UNTIL statements allow an assembly lan
guage program to use the REPEAT-UNTIL construct.
10. Procedures are groups of instructions that perform one task and are used from any point in
a program. The CALL instruction links to a procedure and the RET instruction returns
from a procedure. In assembly language, the PROC directive defines the name and type of
procedure. The ENDP directive declares the end of the procedure.
11. The CALL instruction is a combination of a PUSH and a JMP instruction. When CALL exe
cutes, it pushes the return address on the stack and then jumps to the procedure. A near
CALL places the contents of IP on the stack, and a far CALL places both IP and CS on the
stack.
12. The RET instruction returns from a procedure by removing the return address from the stack
and placing it into IP (near return), or IP and CS (far return).
13. Interrupts are either software instructions similar to CALL or hardware signals used to call
procedures. This process interrupts the current program and calls a procedure. After the pro
cedure, a special IRET instruction returns control to the interrupted software.
14. Real mode interrupt vectors are 4 bytes long and contain the address (IP and CS) of the inter
rupt service procedure. The microprocessor contains 256 interrupt vectors in the first 1K
bytes of memory. The first 32 are defined by Intel; the remaining 224 are user interrupts. In
protected mode operation, the interrupt vector is 8 bytes long and the interrupt vector table
may be relocated to any section of the memory system.
15. Whenever an interrupt is accepted by the microprocessor, the flags IP and CS are pushed
onto the stack. Besides pushing the flags, the T and I flag bits are cleared to disable both the
trace function and the INTR pin. The final event that occurs for the interrupt is that the
interrupt vector is fetched from the vector table and a jump to the interrupt service procedure
occurs.
16. Software interrupt instructions (INT) often replace system calls. Software interrupts save
3 bytes of memory each time they replace CALL instructions.
17. A special return instruction (IRET) must be used to return from an interrupt service proce
dure. The IRET instruction not only removes IP and CS from the stack, it also removes the
flags from the stack.
18. Interrupt on an overflow (INTO) is a conditional interrupt that calls an interrupt service
procedure if the overflow flag (O) = 1.
19. The interrupt enable flag (I) controls the INTR pin connection on the microprocessor. If the
STI instruction executes, it sets I to enable the INTR pin. If the CLI instruction executes, it
clears I to disable the INTR pin.
20. The carry flag bit (C) is clear, set, and complemented by the CLC, STC, and CMC
instructions.
21. The WAIT instruction tests the condition of the BUSY or pin on the microprocessor.
If BUSY or = 1, WAIT does not wait; but if BUSY or = 0, WAIT continues test
ing the BUSY or pin until it becomes a logic 1. Note that the 8086/8088 contains the
pin, while the 80286–80386 contain the BUSY pin. The 80486 through the Core2 do
not contain a BUSY or pin.
22. The LOCK prefix causes the pin to become a logic 0 for the duration of the locked
instruction. The ESC instruction passes instruction to the numeric coprocessor.
23. The BOUND instruction compares the contents of any 16-bit register against the contents
of two words of memory: an upper and a lower boundary. If the value in the register
compared with memory is not within the upper and lower boundary, a type 5 interrupt ensues.
24. The ENTER and LEAVE instructions are used with stack frames. A stack frame is a mecha
nism used to pass parameters to a procedure through the stack memory. The stack frame also
holds local memory variables for the procedure. The ENTER instruction creates the stack
frame, and the LEAVE instruction removes the stack frame from the stack. The BP register
addresses stack frame data.
1. There are three types of unconditional jump instructions: short, near, and far. The short jump
allows a branch to within +127 and -128 bytes. The near jump (using a displacement of
±32K) allows a jump to any location in the current code segment (intrasegment). The far
jump allows a jump to any location in the memory system (intersegment). The near jump in
an 80386 through a Core2 is within ±2G bytes because these microprocessors can use a
32-bit signed displacement.
2. Whenever a label appears with a JMP instruction or conditional jump, the label, located in
the label field, must be followed by a colon (LABEL:). For example, the JMP DOGGY
instruction jumps to memory location DOGGY:.
3. The displacement that follows a short or near jump is the distance from the next instruction
to the jump location.
4. Indirect jumps are available in two forms: (1) jump to the location stored in a register and
(2) jump to the location stored in a memory word (near indirect) or doubleword (far
indirect).
5. Conditional jumps are all short jumps that test one or more of the flag bits: C, Z, O, P,
or S. If the condition is true, a jump occurs; if the condition is false, the next sequential
instruction executes. Note that the 80386 and above allow a 16-bit signed displacement for
the conditional jump instructions. In 64-bit mode, the displacement is 32 bits allowing a
range of ±2G.
6. A special conditional jump instruction (LOOP) decrements CX and jumps to the label when
CX is not 0. Other forms of loop include LOOPE, LOOPNE, LOOPZ, and LOOPNZ. The
LOOPE instruction jumps if CX is not 0 and if an equal condition exists. In the 80386
through the Core2, the LOOPD, LOOPED, and LOOPNED instructions also use the
ECX register as a counter. In the 64-bit mode, these instructions use the RCX register as for
iteration.
7. The 80386 through the Core2 contain conditional set instructions that either set a byte to
01H or clear it to 00H. If the condition under test is true, the operand byte is set to 01H; if
the condition under test is false, the operand byte is cleared to 00H.
8. The .IF and .ENDIF statements are useful in assembly language for making decisions. The
instructions cause the assembler to generate conditional jump statements that modify the
flow of the program.
9. The .WHILE and .ENDW statements allow an assembly language program to use the
WHILE construction, and the .REPEAT and .UNTIL statements allow an assembly lan
guage program to use the REPEAT-UNTIL construct.
10. Procedures are groups of instructions that perform one task and are used from any point in
a program. The CALL instruction links to a procedure and the RET instruction returns
from a procedure. In assembly language, the PROC directive defines the name and type of
procedure. The ENDP directive declares the end of the procedure.
11. The CALL instruction is a combination of a PUSH and a JMP instruction. When CALL exe
cutes, it pushes the return address on the stack and then jumps to the procedure. A near
CALL places the contents of IP on the stack, and a far CALL places both IP and CS on the
stack.
12. The RET instruction returns from a procedure by removing the return address from the stack
and placing it into IP (near return), or IP and CS (far return).
13. Interrupts are either software instructions similar to CALL or hardware signals used to call
procedures. This process interrupts the current program and calls a procedure. After the pro
cedure, a special IRET instruction returns control to the interrupted software.
14. Real mode interrupt vectors are 4 bytes long and contain the address (IP and CS) of the inter
rupt service procedure. The microprocessor contains 256 interrupt vectors in the first 1K
bytes of memory. The first 32 are defined by Intel; the remaining 224 are user interrupts. In
protected mode operation, the interrupt vector is 8 bytes long and the interrupt vector table
may be relocated to any section of the memory system.
15. Whenever an interrupt is accepted by the microprocessor, the flags IP and CS are pushed
onto the stack. Besides pushing the flags, the T and I flag bits are cleared to disable both the
trace function and the INTR pin. The final event that occurs for the interrupt is that the
interrupt vector is fetched from the vector table and a jump to the interrupt service procedure
occurs.
16. Software interrupt instructions (INT) often replace system calls. Software interrupts save
3 bytes of memory each time they replace CALL instructions.
17. A special return instruction (IRET) must be used to return from an interrupt service proce
dure. The IRET instruction not only removes IP and CS from the stack, it also removes the
flags from the stack.
18. Interrupt on an overflow (INTO) is a conditional interrupt that calls an interrupt service
procedure if the overflow flag (O) = 1.
19. The interrupt enable flag (I) controls the INTR pin connection on the microprocessor. If the
STI instruction executes, it sets I to enable the INTR pin. If the CLI instruction executes, it
clears I to disable the INTR pin.
20. The carry flag bit (C) is clear, set, and complemented by the CLC, STC, and CMC
instructions.
21. The WAIT instruction tests the condition of the BUSY or pin on the microprocessor.
If BUSY or = 1, WAIT does not wait; but if BUSY or = 0, WAIT continues test
ing the BUSY or pin until it becomes a logic 1. Note that the 8086/8088 contains the
pin, while the 80286–80386 contain the BUSY pin. The 80486 through the Core2 do
not contain a BUSY or pin.
22. The LOCK prefix causes the pin to become a logic 0 for the duration of the locked
instruction. The ESC instruction passes instruction to the numeric coprocessor.
23. The BOUND instruction compares the contents of any 16-bit register against the contents
of two words of memory: an upper and a lower boundary. If the value in the register
compared with memory is not within the upper and lower boundary, a type 5 interrupt ensues.
24. The ENTER and LEAVE instructions are used with stack frames. A stack frame is a mecha
nism used to pass parameters to a procedure through the stack memory. The stack frame also
holds local memory variables for the procedure. The ENTER instruction creates the stack
frame, and the LEAVE instruction removes the stack frame from the stack. The BP register
addresses stack frame data.