Understanding %eax, (%eax), Cmp, And Jumps In Assembly Language.pdf

rec4-J.pdf
Preview of Understanding %eax, (%eax), cmp, and Jumps in Assembly Language
🔗 Source: cs.cmu.edu
📊 Size: 68 KB
📄 Pages: 3 pages
⬇️ Downloads: 894

Summary

Additional Notes - Brandon Lum

This note clarifies concepts related to `%eax` and jump instructions (`cmp`, `test`, and their associated jumps).

%eax vs (%eax):

- `%eax` refers to the register %eax.
- `(%eax)` refers to the value stored in the register %eax.

Example:

- If `%eax = 0xffffe008`, then `movw %eax, %ebx` will copy the value 0xffffe008 into %ebx.
- Conversely, `movw (%eax), %ebx` will load the value stored at the memory location pointed to by %eax into %ebx (which is 0xaabbccdd in this case).

Cmp and Test Instructions:

These instructions are used for conditional jumps. They compare values and set flags within the processor based on the result.

Jump Types: `je` (jump if equal), `jne` (jump if not equal), `jg` (jump if greater), `jge` (jump if greater or equal), etc.

How it Works:

- `cmp x, y`: Calculates `y - x` and sets flags based on the result.
- `test x, y`: Calculates `y & x` and sets flags based on the result.

Flag Explanation:

Flags within the processor are set based on the comparison:

Zero Flag (ZF): 1 if result is zero, 0 otherwise.
Sign Flag (SF): 1 if most significant bit of the result is set, 0 otherwise.
Other Flags: Carry (CF), Parity (PF), Overflow (OF) - see recitation slides for details.

Examples:

- `cmp 0x3, 0x1`: Sets ZF to 0 (not equal) and SF based on the sign of -2.
- `test %eax, %eax`: Sets ZF to 1 (zero) if `%eax` is zero, else 0.

Jumping Based on Flags:

Jumps (`jmp *Operand`, `je`, etc.) only execute if the corresponding flag is set.

Description

Recitation J clarifies the distinction between `%eax` (register) and `(%eax)` (register's value), providing examples. It also explains various conditional jump instructions, including intuitive and less obvious names used in specific scenarios.

Technical Information

  • File Format: PDF
  • File Size: 68 KB
  • Pages: 3
  • Language: EN
  • Total Downloads: 894
  • Last Updated: 2 hours ago

Document Overview

This PDF document about Understanding %eax, (%eax), cmp, and Jumps in Assembly Language provides comprehensive information and guidance. Whether you're a beginner or advanced user, this resource offers valuable insights into Understanding %eax, (%eax), cmp, and Jumps in Assembly Language.

Related Topics

If you're interested in Understanding %eax, (%eax), cmp, and Jumps in Assembly Language, you might also want to explore:

Download Understanding %eax, (%eax), cmp, and Jumps in Assembly Language eBooks for free and learn more about Understanding %eax, (%eax), cmp, and Jumps in Assembly Language. These books contain exercises and tutorials to improve your practical skills, at all levels!

Not satisfied with this document? We have related documents to Understanding %eax, (%eax), cmp, and Jumps in Assembly Language, try searching with similar keywords: Understanding %eax, (%eax), cmp, and Jumps in Assembly Language, CMP PX2KX Data Sheet Metric CMP T3CDS Data Sheet , Eax Estimated Payment, Eax Worldwide, Eax Worldwide Llc, station d_epuration des eax usee, What Is Eax Estimated Payment, cheerleading motions and jumps

You can download PDF versions of the user's guide, manuals and ebooks about Understanding %eax, (%eax), cmp, and Jumps in Assembly Language, you can also find and download for free A free online manual (notices) with beginner and intermediate, Downloads Documentation, You can download PDF files (or DOC and PPT) about Understanding %eax, (%eax), cmp, and Jumps in Assembly Language for free, but please respect copyrighted ebooks.