Results 1 to 4 of 4

Thread: [RESOLVED] [MASM] Clarification about Symbolic Constants

  1. #1

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Resolved [RESOLVED] [MASM] Clarification about Symbolic Constants

    Theres an ambiguous part in a book I'm reading about MASM, I won't quote it here but tell me how the following code behaves...


    Code:
    NUMBER = 20 ;does this really mean 5?
    mov eax, NUMBER 
    NUMBER = 5
    mov ebx, NUMBER 
    add eax, ebx
    I inferred from the book that the very last instance of ...

    Code:
    NUMBER = ??
    ... propagates through the whole file rendering all of the other instances useless. Is this right?

    If this is the case then eax now contains 10 (5+5). But my own mind makes me think that it would actually contain 25.

    I know how things like this behave in other languages and they way the book says it sounds weird.

    Can anyone shed any light?

    (I would try it but I haven't got MASM on this machine)
    Last edited by wossname; Oct 5th, 2005 at 10:09 AM.
    I don't live here any more.

  2. #2
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: [MASM] Clarification about Symbolic Constants

    the final result must be 25..........i checked in the inline assembler of C++!!!
    Code:
    NUMBER = 20 ;does this really mean 5?

    it means that NUMBER now contains 20!!!
    If this is the case then eax now contains 10 (5+5).
    how you mean by this????
    Code:
    add eax, ebx
    if that statement is related to this one then here eax will contain 25, 20 from the first mov stment then adding BX = 5 to it.........adding upto 25!!!
    Show Appreciation. Rate Posts.

  3. #3

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: [MASM] Clarification about Symbolic Constants

    "The assignment to symbolic constants has nothing to do with the order of the lines of code"
    is roughly what the book says, looks like I've been thinking the same thing as you said.

  4. #4

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: [MASM] Clarification about Symbolic Constants

    Nevermind it is 25 after all
    I don't live here any more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width