473,465 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Visual c++ Inline assembler problem

can sombody tell me why if i create a global variable i
cant acces the OFFSET inside de _asm statment??

i mean:

UCHAR MyVar;

void Main(void)
{

_asm {

mov ebx, offset MyVar //The Error
lea ebx, MyVar //Error again...
}

}

It throw me the error "operand type not correct"...
why??
Nov 16 '05 #1
1 2359
Lucas wrote:
can sombody tell me why if i create a global variable i
cant acces the OFFSET inside de _asm statment??

i mean:

UCHAR MyVar;

void Main(void)
{

_asm {

mov ebx, offset MyVar //The Error
lea ebx, MyVar //Error again...
}

}

It throw me the error "operand type not correct"...
why??


Because ebx is a 32-bit register and (I assume) MyVar is an unsigned 8-bit
character. Try:

__asm
{
mov bl,MyVar
}

if you want the value of MyVar.

If you want the address of MyVar, you could use:

__asm
{
lea ebx,[MyVar]
}

Brian Gladman


Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: __PPS__ | last post by:
Hello I have a simple question about inline asm. suppose I have asm { push eax, 123 } does it mean that it will have exactly this effect as in usual asm or it's just a suggestion to the compiler...
5
by: Somesh | last post by:
#include<map> #include<iostream> #include<string> using namespace std; int main() { map <string,int> test;
10
by: Protoman | last post by:
I'm having the trouble getting the inline assembler and/or linker of Dev-Cpp to see my variable that's been passed into the C++ fn where the inline ASM code is. Can anyone help me figure out how to...
3
by: starffly | last post by:
I overloaded operator+ in a class, and I want to invoke this operator in inline assemble like this: _asm call operator+ but it cannot be complied OK. compiler says there are some illegalI...
12
by: Peter Anthony | last post by:
There are times it would be good to be able to write assembly code to integrate with other VS languages, such as VS C++ .NET. For example, I might want to write a REALLY fast algorithm that does...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.