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

I would like to know how we can use two dimensional arrays in strings? I would also know whether we can compare two dimensional strings?
// Two-dimensional array. int array2D = new int { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7, 8 } }; // The same array with dimensions specified. int array2Da = new int { { 1, 2 }, { 3, 4 }, { 5, 6 }, { 7,...
Harsha
Why are operating systems written in C? Why aren't other languages used?
C is commonly used for developing operating systems due to its low-level capabilities, efficiency, and direct access to hardware. Its minimalistic design allows for better control over system resources,...
Deepa
0 0
7
Are there coding standards or a style guide for Python programs?
The PEP 8 -- Style Guide for Python Code provides a fairly comprehensive list of Python naming conventions. Here are a few examples, but you should consult the PEP 8 style guide for more detailed information...
A
0 0
7
Is it better to bitshift a value than to multiply by 2?
yes in bitshifting operation, u know the shifting position of bit
Nadare
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


File Handling in C++ : Lesson 1 Data Persistence
Data persistence refers to the existence of data in the program. In other words, it means the life of data. Data is the most significant part of a program and it must be stored properly and easily retrieved...
J

How do i get best Campus / Off Campus Placement?
Companies are looking for Skilled Freshers. So build your technical skills while doing MCA / BTech / BCA / BSc (IT or CS) into below areas- 1. Strong your programming & debugging skills ...

Why Do People Choose Python?
Lot of programming languages are available in the market today, but why do people choose python over them? What made it different from other scirpting languages. So factors made it unique, as below: Software...

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...

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