MVS _asm

This is a discussion on MVS _asm within the C++ Programming forums, part of the General Programming Boards category; I downloaded MVS[2005] a few days ago and I am wondering what Microsoft did to inline assembly. Why is: Code: ...

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    3

    MVS _asm

    I downloaded MVS[2005] a few days ago and I am wondering what Microsoft did to inline assembly.
    Why is:
    Code:
    _asm mov ebx,[asm_FindEIP]
    The same as:
    Code:
    _asm mov ebx,asm_FindEIP
    I asked some and he told me to try:
    Code:
    _asm mov ebx, OFFSET asm_FindEIP
    I then get:
    error C2415: improper operand type
    I assume [] was taken out due to arrays, but what was it replaced by?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Try
    Code:
    _asm mov ebx, dword ptr [asm_FindEIP]
    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    3
    Quote Originally Posted by matsp View Post
    Try
    Code:
    _asm mov ebx, dword ptr [asm_FindEIP]
    --
    Mats
    I tried that before I posted it compiles but is the same as:
    Code:
    _asm mov ebx,asm_FindEIP
    MVS is lame =/

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    what is "asm_findEIP"? A variable, or something else?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    May 2008
    Posts
    3
    Quote Originally Posted by matsp View Post
    what is "asm_findEIP"? A variable, or something else?
    Mats
    Its a Variable.
    Last edited by IceRay; 05-20-2008 at 04:01 PM.

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by IceRay View Post
    Its a Variable.
    And do you want ebx to hold the value of the variable or the address of the variable?
    This loads the value from the variable.
    Code:
    _asm mov ebx, dword ptr var
    This sets ebx to the address of the variable
    Code:
    _asm mov ebx, offset var
    However, if var is a local variable in a function, then you probably need to do:
    Code:
    _asm lea ebx, var
    since var's address is not a constant value, but rather an offset from ESP (usually via EBP, but it's still technically an offset from ESP).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Config MVS to complie C
    By ph071 in forum C Programming
    Replies: 14
    Last Post: 12-04-2008, 12:30 PM
  2. command: borland v. mvs
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 05-15-2002, 07:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21