Understanding ASM
-
Hi. I have close to one year C++ experience and six months MFC experience. I love programming using C++ and enjoy the simplicity MFC brings to Windows programming. I will begin my senior year in college this coming fall semester and hopefully, I will fullfil all required courses to graduate spring 2003 and work as a programmer. I am looking at various job descriptions for entry-level programmers especially for C++ programmers. Anyways, I often see ASM in the description. I have no experience with ASM. I will take a required ASM course this fall. Nonetheless, I would like to know some fundamentals of ASM. First, I hear about the power of ASM because anything is possible. I hear about ASM being "clean" coding. I know some Java, but have not done any real projects using Java and I do not plan on it either. I think C++ is elite! In real projects including commercial software, games, OS, and the like, how does ASM fit into the equation? Basically, I just would like to know at what point do programmers prefer ASM over C/C++? Second, I hear that it is possible to incorporate multiple language when developing one software. How is that possible (especial with C/C++ and ASM)? Again, please take into considering that I have no knowledge of ASM and very limited experience with software engineering. Thanks, Kuphryn
-
Hi. I have close to one year C++ experience and six months MFC experience. I love programming using C++ and enjoy the simplicity MFC brings to Windows programming. I will begin my senior year in college this coming fall semester and hopefully, I will fullfil all required courses to graduate spring 2003 and work as a programmer. I am looking at various job descriptions for entry-level programmers especially for C++ programmers. Anyways, I often see ASM in the description. I have no experience with ASM. I will take a required ASM course this fall. Nonetheless, I would like to know some fundamentals of ASM. First, I hear about the power of ASM because anything is possible. I hear about ASM being "clean" coding. I know some Java, but have not done any real projects using Java and I do not plan on it either. I think C++ is elite! In real projects including commercial software, games, OS, and the like, how does ASM fit into the equation? Basically, I just would like to know at what point do programmers prefer ASM over C/C++? Second, I hear that it is possible to incorporate multiple language when developing one software. How is that possible (especial with C/C++ and ASM)? Again, please take into considering that I have no knowledge of ASM and very limited experience with software engineering. Thanks, Kuphryn
Generally ASM (assembly) is used when performace is needed. having said that C++ is pretty fast, generally if you have performance problem with your C++ its prob. your design, not the language. In C/C++ you can use compiler directives in your code to inline assembly. The other main reason to use assembly is because you want to work directly with some device or driver that is better suited to talking to via assembly - especially if a lot of special interrupts or registers have to be accessed. Most of the time, its a case of fix the design, if you have to use ASM its best that you only do if you really need too - its much harder to maintain, and intrinsically as about as portable as registry. note that you can take your existing C++ code and get the compiler to show you what the assembly would be... hope this helps.
-
Generally ASM (assembly) is used when performace is needed. having said that C++ is pretty fast, generally if you have performance problem with your C++ its prob. your design, not the language. In C/C++ you can use compiler directives in your code to inline assembly. The other main reason to use assembly is because you want to work directly with some device or driver that is better suited to talking to via assembly - especially if a lot of special interrupts or registers have to be accessed. Most of the time, its a case of fix the design, if you have to use ASM its best that you only do if you really need too - its much harder to maintain, and intrinsically as about as portable as registry. note that you can take your existing C++ code and get the compiler to show you what the assembly would be... hope this helps.
Thanks. From all responses and my limited experience, I believe every programming language has/had its imporantance in the world of software design and implementation. I believe C/C++ is currently the most dynamic, most extensible programming language. I have seen ASM code of small projects. ASM programming seems redundant when you code certain code many times. Without ASM experience, I am not able to determine what the programmer is doing at each part of the code. I hope to be able to read an ASM source and know exactly what the programmer wants to do. I believe programmers should know a little ASM. Oh, this is somewhat off topic, but do software engineers use ASM to develope compilers especially C and C++ compilers? Kuphryn
-
Thanks. From all responses and my limited experience, I believe every programming language has/had its imporantance in the world of software design and implementation. I believe C/C++ is currently the most dynamic, most extensible programming language. I have seen ASM code of small projects. ASM programming seems redundant when you code certain code many times. Without ASM experience, I am not able to determine what the programmer is doing at each part of the code. I hope to be able to read an ASM source and know exactly what the programmer wants to do. I believe programmers should know a little ASM. Oh, this is somewhat off topic, but do software engineers use ASM to develope compilers especially C and C++ compilers? Kuphryn
Assembly is not portable from one type of computer operating system to another, for example from a PC running MS Windows to a Sun computer running UNIX. So if you write a neat piece of code to optimize your program under Windows 2000, and later decide to port it onto a unix box, you will have to completly rewrite the assembly module. The same code written in C/C++ "might" be ported with no code changes (it depends on the program and what it is doing.) With assembly, that is a WILL not a MIGHT.
-
Assembly is not portable from one type of computer operating system to another, for example from a PC running MS Windows to a Sun computer running UNIX. So if you write a neat piece of code to optimize your program under Windows 2000, and later decide to port it onto a unix box, you will have to completly rewrite the assembly module. The same code written in C/C++ "might" be ported with no code changes (it depends on the program and what it is doing.) With assembly, that is a WILL not a MIGHT.
Okay. Thanks. One last subtopic. As I mentioned, I have seen simple ASM code and for some reason, I believe ASM can be fun. Again, maybe I feel that way because I have absolutely no knowledge of ASM. Nonetheless, I find incorporating ASM into a C++ program seems fun, interesting, and even innovative. At what point do you learn to incorporate ASM code into C/C++? For example, do ASM books teaches the procedure or it is sort of like an individual discovery type of thing? I understand completely that to incorporate ASM into C/C++ one must understand ASM well. Kuphryn
-
Okay. Thanks. One last subtopic. As I mentioned, I have seen simple ASM code and for some reason, I believe ASM can be fun. Again, maybe I feel that way because I have absolutely no knowledge of ASM. Nonetheless, I find incorporating ASM into a C++ program seems fun, interesting, and even innovative. At what point do you learn to incorporate ASM code into C/C++? For example, do ASM books teaches the procedure or it is sort of like an individual discovery type of thing? I understand completely that to incorporate ASM into C/C++ one must understand ASM well. Kuphryn
Using assembly in programs was fun in the old MS DOS 6.XX days, but now things have become so complicated, and compilers so good at optimizing C/C++ code, that its not really worth while for most Windows programs. But, if you really want to venture into assembly, the first "must have" book is by Peter Norton, although I don't know if his books are still in print or not. There are lots of ways to learn, including viewing the assembly languate that your compiler produces. You can do this by selecting Projects | Settings | C++ Tab, then change the Category to "Listing Files" and in the Listing File Type select one of the items that include assembly code.
-
Using assembly in programs was fun in the old MS DOS 6.XX days, but now things have become so complicated, and compilers so good at optimizing C/C++ code, that its not really worth while for most Windows programs. But, if you really want to venture into assembly, the first "must have" book is by Peter Norton, although I don't know if his books are still in print or not. There are lots of ways to learn, including viewing the assembly languate that your compiler produces. You can do this by selecting Projects | Settings | C++ Tab, then change the Category to "Listing Files" and in the Listing File Type select one of the items that include assembly code.
-
Using assembly in programs was fun in the old MS DOS 6.XX days, but now things have become so complicated, and compilers so good at optimizing C/C++ code, that its not really worth while for most Windows programs. But, if you really want to venture into assembly, the first "must have" book is by Peter Norton, although I don't know if his books are still in print or not. There are lots of ways to learn, including viewing the assembly languate that your compiler produces. You can do this by selecting Projects | Settings | C++ Tab, then change the Category to "Listing Files" and in the Listing File Type select one of the items that include assembly code.
Mel Stober wrote: that its not really worth while for most Windows programs. You are right, unless of course you are trying to exploit a buffer overflow...or are trying to build your own Operating System.
-
Hi. I have close to one year C++ experience and six months MFC experience. I love programming using C++ and enjoy the simplicity MFC brings to Windows programming. I will begin my senior year in college this coming fall semester and hopefully, I will fullfil all required courses to graduate spring 2003 and work as a programmer. I am looking at various job descriptions for entry-level programmers especially for C++ programmers. Anyways, I often see ASM in the description. I have no experience with ASM. I will take a required ASM course this fall. Nonetheless, I would like to know some fundamentals of ASM. First, I hear about the power of ASM because anything is possible. I hear about ASM being "clean" coding. I know some Java, but have not done any real projects using Java and I do not plan on it either. I think C++ is elite! In real projects including commercial software, games, OS, and the like, how does ASM fit into the equation? Basically, I just would like to know at what point do programmers prefer ASM over C/C++? Second, I hear that it is possible to incorporate multiple language when developing one software. How is that possible (especial with C/C++ and ASM)? Again, please take into considering that I have no knowledge of ASM and very limited experience with software engineering. Thanks, Kuphryn
ASM is great for real-time programming in embedded systems. Optimal use of ASM requires intimate knowledge of the hardware it will be used with, though, making it impractical for a lot of applications. Each ASM instruction translates directly into one machine opcode, allowing very tight control of system timing. This makes it ideal for dedicated real-time control and measurement. In a general purpose system, this advantage is lost due to the background operations of the OS - when the OS can suspend processes at will, there is no control over the timing. It is fun, though, especially if you want to really understand what goes on inside the CPU. Enjoy the class! Instead of marrying again, I think I'll just find a woman I don't like very much and give her a house...