1ittle_6ird
1ittle_6ird

Reputation: 23

How does mov eax store data in memory?

I have the following assembly commands:

mov eax, 10001
mov [eax], DEADCODEh

What I know is

So how does the memory look like? Is the whole hex-number stored at 10001 or only a part of it? Depending on that how do adresses 10002, 10003 and 10004 look like?

Upvotes: 1

Views: 983

Answers (1)

fuz
fuz

Reputation: 93172

The code does the following thing:

  1. Load eax with the value 10001 (decimal). This is 0x2711 in hexadecimal. The value of eax is now 0x00002711. Note the leading zeros as eax is a 32 bit register.
  2. Store the value 0xdeadc0de (note the 0, which you wrongly copy/pasted) into memory at the address contained in eax. Since the byte order is little endian, the memory around 10001 is going to have the following contents:

    10001: 0xde
    10002: 0xc0
    10003: 0xad
    10004: 0xde
    

Upvotes: 2

Related Questions