Solved

Accessing registers (ax, etc.) thru C/C++ variables

Posted on 1998-04-22
1
400 Views
Last Modified: 2012-06-21
How do you assign the value of a register, at any given time, to a variable.  In particular, I would like to do something like this (I know it's a crude example):

int blah;
 asm
  {
      :
   mov ax, some_value
      :
  }
blah=ax;  //blah now equals some_value

0
Comment
Question by:mcoyle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 10

Accepted Solution

by:
RONSLOW earned 50 total points
ID: 1163160
you should be able to put
  mov blah,ax
into your asm block

Of course asm (or __asm) etc is all compiler/platform specific.

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question