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

Assignment Help:
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.

Related Discussions:- learn,how to mix C and Assembly Language ?

Describe FCFS Scheduling algorithm ?, FCFS algorithm also known as: • Firs...

FCFS algorithm also known as: • First-In-First-Out (FIFO) • Run-Until-Done • Run-to-Completion • Possibly, First-Come-First-Served algorithm is the easiest scheduling algorithm i

Database management, Suppose you are designing a database for an art museum...

Suppose you are designing a database for an art museum that owns a large volume of works of art. Each work of art is described by a unique item code, a title, a type, and a size. T

Php, Which of the following is NOT a type of SQL constraint?

Which of the following is NOT a type of SQL constraint?

Cathode ray tube monitors, Cathode Ray Tube Monitors (CRT): Monitors d...

Cathode Ray Tube Monitors (CRT): Monitors display what is going on in your computer. They can run at various resolutions. It is the part of computer which looks like a TV set.

Explain the concept of a transition graph, Question 1 Define the concept o...

Question 1 Define the concept of equivalence relation. Give atleast two examples of equivalence relation Question 2 Prove that a graph G is connected if and only if it has a

Microwave transmission, Microwave Transmission: Using space as transmi...

Microwave Transmission: Using space as transmission medium, microwave emanates from an origination point on earth, such as telephone exchange, where many individual messages h

Concept in programming language, CONCEPT IN PROGRAMMING LANGUAGE: A Pr...

CONCEPT IN PROGRAMMING LANGUAGE: A Programming Language is used to design and describe a set of instructions and computations to be executed by a computer. To do programming,

cpp programming assignment help, wrap that computes a customer water bill....

wrap that computes a customer water bill. The bill include Rs.100 water demand charge + a consumption charge of Rs.1.5 for every thousand gallons used. Consumption is figured from

Access database, 1.Add a Validation Rule for Date of Birth so no one under ...

1.Add a Validation Rule for Date of Birth so no one under the age of 18 can be added to the table. Hint: subtract the DOB from today''s date and divide by 365.25 (watch the parenth

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd