Advertisement
Lawnknome

Untitled

Jul 18th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. Two’s Complement for signed numbers
  2. Starting value 00000001
  3. Step 1: Reverse the bits 11111110
  4. Step 2: Add 1 to the value from Step 1 11111110 + 00000001
  5. Sum: Two’s-complement representation 11111111 (can be reversed same way)
  6.  
  7. 1. First, the CPU has to fetch the instruction from an area of memory called the instruction
  8. queue. Right after doing this, it increments the instruction pointer.
  9. 2. Next, the CPU decodes the instruction by looking at its binary bit pattern. This bit pattern
  10. might reveal that the instruction has operands (input values).
  11. 3. If operands are involved, the CPU fetches the operands from registers and memory. Sometimes,
  12. this involves address calculations.
  13. 4. Next, the CPU executes the instruction, using any operand values it fetched during the earlier
  14. step. It also updates a few status flags, such as Zero, Carry, and Overflow.
  15. 5. Finally, if an output operand was part of the instruction, the CPU stores the result of its execution
  16. in the operand.
  17.  
  18. EAX – automatically used by MUL and DIV (extended accumulator register)
  19. ECX – CPU uses as a loop counter
  20. ESP – addresses data on the stack (extended stack pointer)
  21. ESI/EDI – high speed memory transfer (extended source/ extended destination)
  22. EBP – High level languages, should not be used as general purpose. (extended frame pointer)
  23.  
  24. • The Carry flag (CF) is set when the result of an unsigned arithmetic operation is too large to
  25. fit into the destination.
  26. • The Overflow flag (OF) is set when the result of a signed arithmetic operation is too large or
  27. too small to fit into the destination.
  28. • The Sign flag (SF) is set when the result of an arithmetic or logical operation generates a
  29. negative result.
  30. • The Zero flag (ZF) is set when the result of an arithmetic or logical operation generates a
  31. result of zero.
  32. • The Auxiliary Carry flag (AC) is set when an arithmetic operation causes a carry from bit 3
  33. to bit 4 in an 8-bit operand.
  34. • The Parity flag (PF) is set if the least-significant byte in the result contains an even number
  35. of 1 bits. Otherwise, PF is clear. In general, it is used for error checking when there is a possibility
  36. that data might be altered or corrupted.
  37.  
  38. Bit = 1 bit
  39. Nybble = 4 bits
  40. Byte = 8 bits
  41. WORD = 2 bytes
  42. DWORD = 4 bytes
  43. QWORD = 8 bytes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement