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