UrbanPro

Learn Programming Languages from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

how to write assembly language programs in c++? what is use of asm ?

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

Java with web technologies tutor

in simple advanced PHP contains object oriented concepts like inheritance,abstraction, and encapsulation,polymarphisim, and in general uses of classes , interface and abstract etc concepts come in to the picture,for implementing complex projects in PHP we have somany frame works ex: ZEND frame work...
read more
in simple advanced PHP contains object oriented concepts like inheritance,abstraction, and encapsulation,polymarphisim, and in general uses of classes , interface and abstract etc concepts come in to the picture,for implementing complex projects in PHP we have somany frame works ex: ZEND frame work and codeignitor, kohana MVC frame works and ,Drupal(CMS) . read less
Comments

Software Professional Trainer with 26+ years of Experience in Software Design and Development

asm is KEYWORD used to write assembly code inside C or C++ code. Use __asm key for Microsoft Compiler Use __asm__ key for GCC Compiler Microsoft Inline Assembly: The assembly code is wrapped in curly braces The destination register is on the *left*, just like yasm. int...
read more
asm is KEYWORD used to write assembly code inside C or C++ code. Use __asm key for Microsoft Compiler Use __asm__ key for GCC Compiler Microsoft Inline Assembly: The assembly code is wrapped in curly braces The destination register is on the *left*, just like yasm. int func() { __asm{ mov eax,25 ret }; } GCC Inline Assembly The assembly code is wrapped in parenthesis. The assembly code shows up as a string int func(void) { __asm__( " mov $25,%eax\n" " leave\n" " ret\n" ); } read less
Comments

Assembly language appears in two flavors: Intel Style & AT&T style. GNU C compiler i.e. GCC uses AT&T syntax and this is what we would use. Let us look at some of the major differences of this style as against the Intel Style. Register Naming: Register names are prefixed with %, so that registers...
read more
Assembly language appears in two flavors: Intel Style & AT&T style. GNU C compiler i.e. GCC uses AT&T syntax and this is what we would use. Let us look at some of the major differences of this style as against the Intel Style. Register Naming: Register names are prefixed with %, so that registers are %eax, %cl etc, instead of just eax, cl. Ordering of operands: Unlike Intel convention (first operand is destination), the order of operands is source(s) first, and destination last. For example, Intel syntax "mov eax, edx" will look like "mov %edx, %eax" in AT&T assembly. Operand Size: In AT&T syntax, the size of memory operands is determined from the last character of the op-code name. The suffix is b for (8-bit) byte, w for (16-bit) word, and l for (32-bit) long. For example, the correct syntax for the above instruction would have been "movl %edx, %eax". Immediate Operand: Immediate operands are marked with a $ prefix, as in "addl $5, %eax", which means add immediate long value 5 to register %eax). Memory Operands: Missing operand prefix indicates it is a memory-address; hence "movl $bar, %ebx" puts the address of variable bar into register %ebx, but "movl bar, %ebx" puts the contents of variable bar into register %ebx. Indexing: Indexing or indirection is done by enclosing the index register or indirection memory cell address in parentheses. For example, "movl 8(%ebp), %eax" (moves the contents at offset 8 from the cell pointed to by %ebp into register %eax). read less
Comments

c,c++,vb,vb.net,php.joomal,basic,all computer subjects

Generally the inline term is used to instruct the compiler to insert the code of a function into the code of its caller at the point where the actual call is made. Such functions are called "inline functions". The benefit of inlining is that it reduces function-call overhead. Now, it's easier to guess...
read more
Generally the inline term is used to instruct the compiler to insert the code of a function into the code of its caller at the point where the actual call is made. Such functions are called "inline functions". The benefit of inlining is that it reduces function-call overhead. Now, it's easier to guess about inline assembly. It is just a set of assembly instructions written as inline functions. Inline assembly is used for speed, and you ought to believe me that it is frequently used in system programming. We can mix the assembly statements within C/C++ programs using keyword asm. Inline assembly is important because of its ability to operate and make its output visible on C/C++ variables. Assembly language appears in two flavors: Intel Style & AT&T style. GNU C compiler i.e. GCC uses AT&T syntax and this is what we would use. Let us look at some of the major differences of this style as against the Intel Style. If you are wondering how you can use GCC on Windows, you can just download Cygwin from www.cygwin.com. Register Naming: Register names are prefixed with %, so that registers are %eax, %cl etc, instead of just eax, cl. Ordering of operands: Unlike Intel convention (first operand is destination), the order of operands is source(s) first, and destination last. For example, Intel syntax "mov eax, edx" will look like "mov %edx, %eax" in AT&T assembly. Operand Size: In AT&T syntax, the size of memory operands is determined from the last character of the op-code name. The suffix is b for (8-bit) byte, w for (16-bit) word, and l for (32-bit) long. For example, the correct syntax for the above instruction would have been "movl %edx, %eax". Immediate Operand: Immediate operands are marked with a $ prefix, as in "addl $5, %eax", which means add immediate long value 5 to register %eax). Memory Operands: Missing operand prefix indicates it is a memory-address; hence "movl $bar, %ebx" puts the address of variable bar into register %ebx, but "movl bar, %ebx" puts the contents of variable bar into register %ebx. Indexing: Indexing or indirection is done by enclosing the index register or indirection memory cell address in parentheses. For example, "movl 8(%ebp), %eax" (moves the contents at offset 8 from the cell pointed to by %ebp into register %eax). read less
Comments

Coaching

The __asm keyword invokes the inline assembler and can appear wherever a C or C++ statement is legal. It must be followed by an assembly instruction, a group of instructions enclosed in braces, or, at the very least, an empty pair of braces. The term "__asm block" here refers to any instruction or group...
read more
The __asm keyword invokes the inline assembler and can appear wherever a C or C++ statement is legal. It must be followed by an assembly instruction, a group of instructions enclosed in braces, or, at the very least, an empty pair of braces. The term "__asm block" here refers to any instruction or group of instructions, whether or not in braces. example: __asm { mov al, 2 mov dx, 0xD007 out dx, al } read less
Comments

Trainer

Nice Questions , Assemble language or coding are use to interface with processors , You can say direct command , C or C++ is just another layer who offer user friendly commands who invoke action and transfer asm to machine level language .Asm Language is Processor language who use memory management...
read more
Nice Questions , Assemble language or coding are use to interface with processors , You can say direct command , C or C++ is just another layer who offer user friendly commands who invoke action and transfer asm to machine level language .Asm Language is Processor language who use memory management operation mostly , keywords are like PUSH-POP etc .MAchine just understand "0" and "1" i.e machine level language . *.a(lib) ,*.o(object) are input for Linker , Linker offer -*.lib,*.dll.*.exe,*.out files which is the input for Loader ,Loader relocate Memory For Task. For More Information please click on following links for better understanding.. http://www.bogotobogo.com/cplusplus/assembly.php read less
Comments

View 4 more Answers

Related Questions

What does # mean in C?
#include is a preprocessor directive which is used to include user-defined file.
Sridevi
0 0
5
What are the toughest topics in C language?
1. pointer 2. dynamic memory allocation 3. File handling
Lokayya
0 0
5
What is a copy constructor?
The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously. The copy constructor is used to: 1.Initialize one...
Kartik Chandra
0 0
7
How can I learn C easily and rapidly?
You can learn C by three ways 1. Practise 10 programs daily for 10 days. 2. Understand the programming concept before going to make an attempt 3. Try to do some simple projects on your own will improve your skills rapidly.
Umamahesh
0 0
5

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Static and dynamic libraries
A library is a package of code that is meant to be reused by many programs. A static library (also known as an archive) consists of routines that are compiled and linked directly into your program. When...

Simulation of a die-roll:Usage of random module
Task:Simulation of a simple die-rolling game,where we keep rolling a six-sided die until we have rolled a total of 20. To simulate a six-sided die roll, we need a way to generate a random integer between...

A Brief About Php And MySQL
PHP is a recursive acronym which stands for Hypertext Preprocessor. PHP is essentially a coding or scripting language which can be utilized in diverse web development and software based applications. If...

Can we store different data types in a stack?
Yesterday, one of my Facebook friend asked me this question. My answer is "yes", and in this post I will discuss how could we do this.I am a great supporter of working with unions and I will be using union...

Necessity of Theory and Practical in Computer Science.
Upon studying a subject both theory and practical are important. Usually many schools concentrate more on theory and the marks not on the practical. Other and opposite kind of people prefer practical...

Recommended Articles

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Whether it was the Internet Era of 90s or the Big Data Era of today, Information Technology (IT) has given birth to several lucrative career options for many. Though there will not be a “significant" increase in demand for IT professionals in 2014 as compared to 2013, a “steady” demand for IT professionals is rest assured...

Read full article >

Hadoop is a framework which has been developed for organizing and analysing big chunks of data for a business. Suppose you have a file larger than your system’s storage capacity and you can’t store it. Hadoop helps in storing bigger files than what could be stored on one particular server. You can therefore store very,...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Looking for Programming Languages Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Programming Languages Classes?

The best tutors for Programming Languages Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Programming Languages with the Best Tutors

The best Tutors for Programming Languages Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more