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

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

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

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

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

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

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

View 4 more Answers

Related Questions

Is it possible to write big safe programs in C++?
yes. C++ is generally used to write system software. For example windows operating system are writeen in C++. Most of the operating system, device driver and antivirus programs are written by using C++.
Sapna
0 0
6
From where the older version of Visual Basic has been derived?
Visual basic has been derived from basic programming language and was developed by microsoft corporation
Dinesh
What is meant by high-order and low-order bytes?
Lower order and higher-order bytes are the terms used while computing calculations in a programming language. Usually, numbers are written from left to right. The left is the most significant bit, and...
Vishal
0 0
9
Where can I get Python online training?
You can get many institutes in google which are providing online training.
Taranum
Is C++ is next version of C?
This feature looks pretty sweet. This would be great because you wouldn't need getters any more. You could make member variables public; later, if you change your mind, you can turn them into property.
Subham

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

Ask a Question

Related Lessons

Introduction to Programming Languages
What is a Programming Language? A programming language is a formal computer language or constructed language designed to communicate instructions to a machine, particularly a computer. Programming languages...

Array vs Linked List
Array Linked List Accessing element is easy. Accessing element is difficult compare to Array. Easy to use. Difficult to use. Memory is Fixed size. Memory is variable size. If...

PHP Intro.
What is PHP? PHP is an acronym for "PHP Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP costs nothing, it is free to download and...

Difference Of Inheritance In C++ And Java
In Java , multiple inheritance is not applicable directly but we can implement the concept by using the interfaces. In c++ and Java, the common types of inheritances are: Single Multi level Hybrid Hierarchical

Do (pre & post)Increment and decrement operators behave differently when printed in the same and different line in C++?
Before I explain anything,I would like you to run the following program. void main() {int j =10; cout<<“j before increment =“<<j; cout<<“++j =“<< ++j; cout<<“...

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