Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

register indirect mode in Assembly

register indirect mode in Assembly

register indirect mode in Assembly

Is it allowed to do the following?:

mov CX, [EAX]
mov [EAX], CX


mov W1, [EAX]
mov [EAX],W1
where W1 is not doubleword (word or byte)

In plain english, what is the real difference between direct and indirect access mode ?
I can't find examples of invalid descriptions and the reasons why.

RE: register indirect mode in Assembly

All of the above are correct.

Indirect addressing, as it says, lets you get the memory
value that is pointed by the given register.

So if EAX = 100

    mov ebx,[eax] gets the 100th dword relativ to DS into

    mov [eax],ebx puts the contents of EBX into the double
word at address DS:100

Succes, Tessa

RE: register indirect mode in Assembly

Thank you TessaBonting, but I don't understand what exactly happens in case I try to do this kind of thing:
mov W1, [EAX]     W1 - type of the W1: word or byte
mov BX, [EAX]

if the number, that [EAX] points to, is a doubleword, is this number going to be just truncated when trying to put into BX or W1(which is in the memory), because BX and W1 can contain only word meaning ? Or because of the different types is it going to display an error, just like in case of move BX, EAX ?

(I just started learning Assembly recently, and don't get some of that abstract stuff)

RE: register indirect mode in Assembly

Quote (TessaBonting):

So if EAX = 100

    mov ebx,[eax] gets the 100th dword relativ to DS into
shouldn't that be the 25th dword??


most assemblers will fetch the byte/word (depends on the size of W1) from [EAX] and handle this correctly.

if W1 is a word and you want to be sure the assembler will
treat it that way you can explicitely tell it with what it
is dealing with:

  mov W1,word ptr [EAX]

or in case of a byte sized variable:

  mov W1,byte ptr [EAX]

i'm a 16bit programmer myself, so i'm not 100% convinced
if it will work for you. just try it and you'll see.

RE: register indirect mode in Assembly

Thank you denc4

I've tried it in a program practically, and actually this is what is going on:
it accepts when I use mov BX, [EAX]
but it doesn't when I use
mov W1, [EAX]   where W1 - word

Actually it gives the same number of the error which appears in case I put for expample add W1, W2
so, I guess that declaration is incorrect because parameters are affiliated only with the memory, which is incorrect

RE: register indirect mode in Assembly

to add a value in memory to another value in memory you have to use an intermediate step.

for example:
to add word at [eax] to W1 use:

  mov ax,[eax]
  add W1,ax

to add W2 to W1 use:

  mov ax,W2
  add W1,ax

RE: register indirect mode in Assembly

yeah, after I tried that experimentally, practically, and also compared numbers of mistakes, I finally realized what is the difference between [EAX] and EAX - indirect and direct register access, - which I could not understand before, that's why in the first post I asked what it means in plain english.

Anyway, everybody, thanks for participation in the thread! :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close