GoConqr has a new look! Let us know what you think.

Flowchart

Untitled

Jossy Ivan Mejia Vargas Spanish

Flowchart content

  1. Status Flags

  2. You should note that once a flag is set or cleared, it remains in that state until another instruction changes its value.

  3. not all assembly language instructions affect all the flags

  4. instructions affect all six status flags

  5. The mov, push, and pop instructions , on the other hand, do not affect any of the flags.

  6. The Zero Flag

  7. The purpose of the zero flag is to indicate whether the execution of the last instruction that affects the zero flag has produced a zero result

  8. Usage: There are two main uses for the zero flag: testing for equality, and counting to a preset value.

  9. The Carry Flag

  10. The carry flag records the fact that the result of an arithmetic operation on unsigned numbers is out of range (too big or too small) to fit the destination register or memory location

  11. Usage The carry flag is useful in several situations

  12. To propagate carry or borrow in multiword addition or subtraction operations.

    To detect overflow/underflow conditions.

    T o test a bit using the shift/rotate family of instructions.

  13. The Overflow Flag

  14. How does the system know how your program is interpreting a given bit pattern?

  15. the processor does not have a clue. It is up to our program logic to interpret a given bit pattern correctly

  16. Usage Th e main purpose of the overflow flag is to indicate whether an arithmetic operation on signed numbers has produced an out-of-range result.

  17. The Sign Flag

  18. Usage Th e main use of the sign flag is to test the sign of the result produced by arithmetic and related instructions

  19. Another use for the sign flag is in implementing counting loops that should iterate until (and including) the control variable is zero.

  20. The Auxiliary Flag

  21. The auxiliary flag indicates whether an operation has produced a result that has generated a carry out of or a borrow into the low-order four bits of 8-, 16, or 32-bit operand

  22. The Parity Flag

  23. This flag indicates the parity of the 8-bit result produced by an operation;

  24. if this result is 16 or 32 bits long, only the lower-order 8 bits are considered to set or clear the parity flag.

  25. The parity flag is set if the byte contains an even number of 1 bits; if there are an odd number of 1 bits , it is cleared.

  26. Arithmetic Instructions

  27. Addition

    Subtraction

    Multiplication

    Division

  28. Multiplication Instructions

  29. Multiplication is more complicated than the addition and subtraction operations for two reasons

  30. First , multiplication produces double-length results. Tha t is, multiplying two n-bit values produces a 2n-bit result.

  31. Second , unlike the addition and subtraction operations , multiplication o f signed numbers should be treated differently from tha t of unsigned numbers.

  32. A Note on Multiplication Th e multiplication instruction is an expensive one in the sense it takes more time than the other arithmetic instructions like add and sub.

  33. The add instruction takes only one clock cycle whereas the multiplication instruction takes 10+ clock cycles.

  34. Division Instructions

  35. The division operation is even more complicated than multiplication for two reasons

  36. Divisio n generates two result components: a quotient and a remainder.

  37. In division, divide overflow is a real possibility. The processor generates a special software interrupt when a divide overflow occurs.

  38. If the source operand is a byte, the dividend is assumed to be in the AX register and 16 bits long.

  39. Conditional Execution

  40. Unconditional Jump

  41. It unconditionally transfers control to the instruction located at the target address.

  42. There are several versions of the j mp instruction depending on how the target address is specified and where the target instruction is located.

  43. Specification of Target

  44. There are two distinct ways by which the target address of the j mp instruction can be specified: direct and indirect

  45. Direct Jumps I n the direct jump instruction, the target address is specified direcdy as part of the instruction

  46. As an assembly language programmer, you only specify the target address by using a label

  47. Relative Address Th e address specified in a jump instruction is not the absolute address of the target.

  48. The specification of relative address as opposed to absolute address of the target instruction is appropriate for dynamically relocatable code

  49. Where Is the Target?

  50. I f the target of a jump instruction is located in the same segment as the jump itself, it is called an intrasegment jump; if the target is located in another segment, it is called an intersegment jump.

  51. If the target is outside this range, 2 or 4 bytes are used to specify the relative displacement. A two-byte displacement is used for 16-bi t segments, and 4-byte displacement for 32-bit segments.

  52. Compare Instruction

  53. Implementation of high-level language decision structures like if - then- el se in assembly language is a two step process:

  54. An arithmetic or comparison instruction updates one or more arithmetic flags

  55. A conditional jump instruction causes selective execution of the appropriate code fragment based on the values of the flags.

  56. Th e main purpose o f the cmp instruction is to update the flags so that a subsequent conditional jump instruction can test these flags.

  57. Conditional Jumps

  58. Conditional jump instructions can be divided into three groups

  59. Jump s based on the value of a single arithmetic flag;

  60. Jump s based on unsigned comparisons;

  61. Jump s based on signed comparisons.

  62. Jumps Based on Single Flags

  63. Jumps Based on Unsigned Comparisons

  64. Jumps Based on Signed Comparisons

  65. A Note on Conditional Jumps

  66. The IA-32 instruction set provides two conditional jump instructions—one for jumps i f the flag tested is set, and the other for jumps when the flag is cleared—for each arithmetic flag except the auxiliary flag

  67. When comparing two numbers it is necessary to know whether these numbers numl and num2 represent singed or unsigned numbers in order to establish a relationship between them should appropriately update flags to yield that AL > DL if we treat their contents as representing unsigned numbers.

  68. The = and != comparison s work with either signed or unsigned numbers, as we essentially compare the bit pattern for a match.

  69. For signed comparisons, three flags record the necessary information : th e sign flag (SF), the overflow flag (OF), and the zero flag (ZF). Testing for = and ^ simpl y involves testing whether the ZF is set or cleared, respectively.

  70. All conditional jump instructions are encoded into the machine language using only 2 bytes

  71. . A s a consequence, al l jumps should be shor t jumps. Tha t is , the target instruction of a conditional jump must be 128 bytes before or 127 bytes after the instruction following the conditional jump instruction.

  72. TEC, sede central, Fundamentos de organizacion de computadoras

    Resumen #10 (Sivarama caps 14 y 15)

    Jossy Mejia Vargas 2017109693

    Lunes 13 de noviembre, 2 semestre, Esteban Arias Mendez

Information

Description
Flowchart on Untitled, created by Jossy Ivan Mejia Vargas on 14/11/2017.
Views
0
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?