Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 156137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:16:44+00:00 2026-05-11T10:16:44+00:00

In assembly language if we use mov eax, dword ptr[ebx] then it means copy

  • 0

In assembly language if we use

mov eax, dword ptr[ebx] 

then it means copy the value pointed by ebx (ebx contains the address value, not the actual value, this instruction copies the actual value in the address)?

If we use

mov eax, dword ptr[some_variable] 

then it means copy the value of variable ‘some_variable’ itself to eax, not copy the value pointed by variable ‘some_variable’?

Is my understanding correct?

If yes, I’m confused why the same assembly instruction has two different meansings – in the first case there is a level of indirection, but in the second there is no additional level of indirection.

Any comment?

EDIT:

Not every [] does not taking any effect, for example, instruction xchg will take a level of in-direction, which loads value pointed by edx.

Whole source code could be found from,

http://www.codeproject.com/KB/threads/spinlocks.aspx

#ifdef WIN32 inline int CPP_SpinLock::TestAndSet(int* targetAddress, int nValue) {     __asm {         mov edx, dword ptr [pTargetAddress]         mov eax, nValue         lock xchg eax, dword ptr [edx]     } } #endif // WIN32 
  • 1 1 Answer
  • 2 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:16:44+00:00Added an answer on May 11, 2026 at 10:16 am

    In both cases you ask the processor to move the value from a specified address. It’s one level of indirection. In the first case you ask it to take the address from a specified register. In the second case you specify an offset directly.

    x86 processors don’t support dual level indirection, so it’s not possible to request to load a value from an address specified somewhere in memory – you have to load the address onto a register.

    Under a number of assemblers (MASM and built into VC++ assembler for example) you could as well write just

    mov eax, dword ptr some_variable 

    without brackets, it would mean the same.

    You could write

    mov eax, dword ptr [variable][ebx] 

    this would instruct to take the address of ‘variable’, then add value of ebx and use the sum as an address from which to load a value. This is often used for accessing array elements by index. (Variations on the syntax are supported, like mov eax, dword ptr variable[ebx] being commonly used and mov eax, dword ptr [variable + ebx] also being common.)

    In all these cases the processor would do the same – load a value from a specified address. It’s one level of indirection each time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As the title described, how to use c library function fgets in assembly language?
Do I absolutely have to learn assembly language to be able to use the
What technology does QT use at its core? Is it assembly language of Win32
I decided to learn Assembly language. The main reason to do so is being
I was reading PC assembly language by Carter and I saw this phrase in
I am learning assembly language in my spare time to become a better developer.
I'm a beginner to reading assembly language and I'm looking for a good assembly
I have just started the Assembly language programming and in the first lecture our
Recently I've been using lot of assembly language in *NIX operating systems. I was
I am relatively new to assembly language. I have found so many tutorials that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.