learn,how to mix C and Assembly Language ?, Basic Computer Science

The technique to mix C and assembly language is to apply the "asm" directive. To access C-language variables from assembly language, you just use the C identifier that name is a memory operand. These variables cannot be local to a procedure, and also cannot be static within a procedure. They have to be global (but can be static global). The newline characters are essential.
unsigned long a1, r;
void junk( void )
{
asm(
"pushl %eax \n"
"pushl %ebx \n"
"movl $100,%eax \n"
"movl a1,%ebx \n"
"int $59 \n"
"movl %eax,r \n"
"popl %ebx \n"
"popl %eax \n"
);
}

This instance does the following:
1. Pushes the value stored in %eax and %ebx onto the stack.
2. Puts a value of 100 into %eax.
3. Copies the value in global variable a1 into %ebx.
4. Executes a software interrupt number 59.
5. Copies the value in %eax into the global variable r.
6. Restores (pops) the contents of the temporary registers %eax and %ebx.
Posted Date: 5/4/2012 8:26:11 AM | Location : United States







Related Discussions:- learn,how to mix C and Assembly Language ?, Assignment Help, Ask Question on learn,how to mix C and Assembly Language ?, Get Answer, Expert's Help, learn,how to mix C and Assembly Language ? Discussions

Write discussion on learn,how to mix C and Assembly Language ?
Your posts are moderated
Related Questions


Word Processing Software : The main use for word processing is found in secretarial offices and small publishing companies. However, if you are involved in generating your own cor

Data buses: The availability of reliable digital semi-conductor technology has enabled the inter-communication task between different equipment to be significantly improved. P


IPv6 documented in 1994 (RFC 1752) is still a collection of Draft and Proposed standards Several pre-standard implementations exist IPv6 was intended to be a pragmatic up

Ask question #Minimum assignment on generations of computers 100 words accepted#

In-door Patient Department Ideally all features of OPD.  Both OPD and IPD modules should be inter-linked.  In addition all details pertaining to the patient's medica

Question 1 Explain the naming conventions of functions in WML scripts and also explain characteristics of functions in WML Question 2 What is WML input field? Explain WML

Python is an interpreted, high-level, interactive and object oriented-scripting language. Python was designed to be extremely readable which uses English keywords commonly where as