,mov ax,2h //2 cycles to execute + 4 cycles to fetch
mov bx,3h //2 cycles to execute + 4 cycles to fetch
mul bx //5 cycles to execute + 4 cycles to fetch add
ax,bx //4 cycles to execute + 4 cycles to fetch
Total cycles = 29 cycles which requires 29 x 0.00125 μsec = 0.03625 μsec
Disadvantages
1. Development time. Writing code in assembly language takes much longer than
, writing in a high-level language.
2. Reliability and security. It is easy to make errors in assembly code. The assembler is not
checking if the calling conventions and register save conventions are obeyed.
3. Debugging and verifying. Assembly code is more difficult to debug and verify because there are
more possibilities for errors than in high-level code.
4. Maintainability. Assembly code is more difficult to modify and maintain because the language
allows unstructured spaghetti code and all kinds of tricks that are difficult for others to
understand. Thorough documentation and a consistent programming style are needed. 5.
Portability. Assembly code is platform-specific. Porting to a different platform is difficult.
1. Debugging and verifying. Looking at compiler-generated assembly code or the disassembly
window in a debugger is useful for finding errors and for checking how well a compiler
optimizes a particular piece of code.
2. Making compilers. Understanding assembly coding techniques is necessary for making
compilers, debuggers and other development tools.
3. Embedded systems. Small embedded systems have fewer resources than PCs and
mainframes. Assembly programming can be necessary for optimizing code for speed or size
in small embedded systems.
4. Hardware drivers and system code. Accessing hardware, system control registers, and so
on may sometimes be difficult or impossible with high level code.
5. Accessing instructions that are not accessible from high-level language.
Certain assembly instructions have no high-level language equivalent.
6. Self-modifying code. Self-modifying code is generally not profitable because it
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Jennifer2024. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $2.60. You're not tied to anything after your purchase.