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 )
"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
create a flowchart showing average score for the 3 quizzes assume that there are 3 sections each having 5 students the only valid number to be entered is 1-100 for the quizzes shou

Give birth to new life forms A research of Artificial Life will definitely throw light on what it means for a complex application to be 'alive'. Moreover, ALife researchers th

I. Write an application that accomplishes the following tasks: 1. Read a text file that contains, integers, doubles, alphabet, alphanumeric, and others. The name of the input fil

You recently returned some homework I completed but i left of the final 10 questions. Should not take long just needs some commands interpreted. How much will it cost for me to get

Open Source Software: Open Source Software (OSS) is software that comes with source code, and importantly also provides rights (typically reserved for copyright holders) to st

what is the computer science

compare encoders and multiplers

Explain how ICT can be used for achievement of each of the following business objectives, illustrating your answer with examples: 1. Customer intimacy 2. Low-cost leadership

creating programs in scheme