Results 1 to 34 of 34

Thread: Why use Assembly language

Hybrid View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    167

    Question Why use Assembly language

    I don't know Assembly language. I just know that it is Low Level Language.
    I wonder why one still uses Assembly language. Now there are many High Level Language that is easy to develop application. Could one tell me the advantage of using Assembly language today?

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Why use Assembly language

    Assembly language is very useful for routines that require high speed and highly optimized code. It is also required for Boot Loaders (i.e. LILO, GRUB, etc...) and Operating Systems.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    167

    Question Re: Why use Assembly language

    So it means that we use Assembly Language because of high speed.
    Are there any advantages of Assembly Language?

  4. #4
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Why use Assembly language

    Quote Originally Posted by ychhuong
    So it means that we use Assembly Language because of high speed.
    Are there any advantages of Assembly Language?
    So, if I will say: The advantages are high speed and highly optimized code (as kasracer was saying)
    Will you still ask what are the advantages ?

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    167

    Question Re: Why use Assembly language

    I think that if the advantages are high speed and highly optimized code, it is not the reason that some body still using Assembly because today computer are very high speed.

  6. #6
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: Why use Assembly language

    Quote Originally Posted by ychhuong
    I think that if the advantages are high speed and highly optimized code, it is not the reason that some body still using Assembly because today computer are very high speed.
    Well, if you need to make a super fast program for... say, a few hundred people, what do you choose ?
    Tell ALL your customers to pay thousands of extra $ to buy super fast computer ? (on top of the cost of your program)
    Or invest extra time and effort (and $) to make a super fast program in ASM, and tell your customers the computers they have now is fine for your program ?

  7. #7
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Why use Assembly language

    Most high level languages are very slow in comparison to ASM as has already been stated but this is mainly due to the multiple levels of abstraction that separates native binary from the HL language in question.

    High Level languages have HUGE runtime dependancies, ASM can be optimised to have none whatsoever which is why they are indeed used in bootstrapping and OS installers, it lets you run a program on a completely blank computer.

    The other benefits of knowing ASM include gaining a much deeper understanding of how a computer works at the lowest level. Thi definitely affects the way you write code in HLL too.
    I don't live here any more.

  8. #8
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253

    Re: Why use Assembly language

    Quote Originally Posted by wossname
    Most high level languages are very slow in comparison to ASM as has already been stated but this is mainly due to the multiple levels of abstraction that separates native binary from the HL language in question.

    High Level languages have HUGE runtime dependancies, ASM can be optimised to have none whatsoever which is why they are indeed used in bootstrapping and OS installers, it lets you run a program on a completely blank computer.

    The other benefits of knowing ASM include gaining a much deeper understanding of how a computer works at the lowest level. Thi definitely affects the way you write code in HLL too.
    Hmmm C# vs ASM . . . .

    I didn't want to bring up the bloated nature of modern HLL, but hey, Wossy . . . .
    "As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein

    It's turtles! And it's all the way down

  9. #9
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Why use Assembly language

    if you know assembly language, stick with it, it is THE BEST, the compiler does not mess with your code, it does not change any of the ASM code, it simply directly, converts each instruction to machine code, and thats it. It wont check for extensive errros like VB or others, such as 'runtime error file not found' - none of that because the compiler has not messed with your code.

    Other advantages...
    The programmer has COMPLETE control over how the program works, unlike other high level languages.

    Final advantage, filezise - a program which only displays a messagbox then quits (including the windows DLLs)

    ASM: 3kb
    VB6: 16kb

    ^thats a huge difference
    Chris

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    167

    Question Re: Why use Assembly language

    Thank all. I have 2 more question.
    What is ASM?
    What do i need if i want to develop application using Assembly Language?

  11. #11
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253

    Re: Why use Assembly language

    Assembly Language is the closest abstract to machine code. In many cases, you might have a processor directive say 0010101001010101010111111111000111, in assembly - instead of remembering all those 1, an 0's you might have to remember MOV es,ax

    (I have no idea, btw, what that binary sequence means!)

    You then use an assembler to convert your instructions into machine code - with no interference or optimisation done by the assembler.
    "As far as the laws of mathematics refer to reality, they are not certain; and as far as they are certain, they do not refer to reality." - Albert Einstein

    It's turtles! And it's all the way down

  12. #12
    New Member
    Join Date
    Mar 2006
    Posts
    4

    Resolved Re: Why use Assembly language

    Assembler is still a high level programming language and is the next step up in making code easier to understand or human readable, it is still converted to machine language in order for the computer to understand it which is the lowest level.

    It's quicker to develop applications using the latest higher level language tools and the differences in performance these days is hard to notice as most machines tote enough power it doesn't make much of a real difference.

    But in terms of speed, effeciency, can easily create your own programming language and re-invent the wheel, and portability assembler stands out a bit.

    The downside is there's alot missing in terms of all the latest tools and features for using syntax for simplicity and rapid application development.

    The programs are small, lightweight, and don't require bulky runtimes which need to be downloaded, plus you develop totally for free.

    Size and speed isn't so much an issue as time, money, and ease of development these days, plus, people aren't as deeply educated and focus is only on working with the IDE more so than how the internal code itself works, this develops false positives and leaves many security exploit possibilities open in the higher level languages.

    A big comparison would be this, let's say you needed an application with moderate to complicated functionality complete for commercial business application for a client, you aren't well skilled in assembler but could popup something in short amount of time in higher level language, if it takes a few to several years to complete in assembler and you only have a few days to a week your best bet is higher level language to get it done now and get paid.

    Either way, it's all about picking the language that you're comfortable working with and can understand, don't be afraid to try something new and keep developing!

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Oct 2005
    Posts
    167

    Question Re: Why use Assembly language

    I don't know assembly language at all. I don't know where to start. I don't have any assembly book and assembler. Which book should i read(for beginer)?

  14. #14
    Frenzied Member the182guy's Avatar
    Join Date
    Nov 2005
    Location
    Cheshire, UK
    Posts
    1,473

    Re: Why use Assembly language

    if you code the project that your boss gives you aswell as VB.NET or whatever, you will probably get a BIG FAT ass bonus. Anyway the reward of just being able to program in the lowest level is good enough for me.
    Chris

  15. #15
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Why use Assembly language

    Everyone's forgetting a very huge world market - most small embedded systems are written in assembly. There's really not much need for listboxes in the controller for a microwave oven.

    Anyone in Hong Kong can see a nice little assembly-language system that's been running for decades - the Hong Kong Space Museum Planetarium is run on 3 Z-80 CPUs, and all the code was written in assembler - back in the Dark Ages.

  16. #16
    New Member
    Join Date
    May 2006
    Posts
    15

    Re: Why use Assembly language

    I think, that u shouldn't comapre Assembly with High Level languages.
    There are a lot of different structures, extened assembler use mnenomics and so on...

    Althought I don't use assembly, but as I remember it's extremely fast, because you can communicate with the machine in its languages(binary, hex etc.) directly, and it don't need to waste time translating this one to understandable methods, functions.

    Th other side, that it's a very complicate and hard-to-learned language, but don't try to write i.e. a whole kernel in HLPL.

    My last oppinion, that always must a Low level language, and it not depends on the year where we currently live in

  17. #17
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Why use Assembly language

    Quote Originally Posted by reloader81
    Th other side, that it's a very complicate and hard-to-learned language, but don't try to write i.e. a whole kernel in HLPL.
    Why not? The entire PCDOS was written in assembly. So was CP/M, ISIS, SOLOS, TRSDOS, the Mac OS, the Apple OS ... whole entire operating systems. Windows and Linux could be written entirely in assembly, it's just more efficient to write graphic operating systems in a higher level language. (All of CP/M was around 4k of 8 bit code.)

    (BTW, assembler is a lot simpler than, say, VB - it's not complicated at all.)
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  18. #18
    Addicted Member
    Join Date
    Aug 2005
    Location
    York
    Posts
    197

    Re: Why use Assembly language

    Once you understand the fundamentals - say registers, instructions and how they work - basically how a computer works, assembly language is easier than any other language - because what you see is what you get.(unless the model of processor has bugs - which it sometimes has )

    The difficult part of assembly is maintenance - it needs to be well commented because unless your fellow programmers understand assembly really well, understanding other people's assembly code is a real *****. Another small issue is implementing - its easier to work out algos in HLL and then port them to assembly.

    But all in all - knowledge of assembly is essential for any HLL - as it helps optimise code and create decisions in efficiency. This may not apply for Java/.NET unless you want to learn the ILDASM and Java byte codes assembly - this might be useful - but maybe less so.

    Major games, somewhere along the line make use of assembly language - especially when using newer instruction sets on the processor e.g. SSE2, SSE3 because compilers find difficulty optimising parallelisation. However, some compilers (I think MSVC and Intel?) now have methods like loading 4 floating pt stuff into a xmm register etc. so it hints to the compiler what to do
    Alternatively, just using inline assembly is sufficient.

    Another rant on assembly from me .

    Cheers.

    Raedwulf

  19. #19
    Addicted Member
    Join Date
    Aug 2005
    Location
    York
    Posts
    197

    Re: Why use Assembly language

    Side note: I often see people use the word "assembler" to refer to the language - "assembler" refers to the the tool which converts assembly language into machine code.
    Yes, I see that problem a lot - but I guess we can forgive them because a lot of programmers' native language isn't english. Mine is Visual Basic .

  20. #20
    Fanatic Member damasterjo's Avatar
    Join Date
    Nov 2005
    Location
    In front of my Comp DirectX7 EXpert
    Posts
    827

    Re: Why use Assembly language

    I just wanted to honestly say that I really enjoyed reading this thread and will probably learn some ASM sometime now. Thanks for the detialed discusion.

    (PS Im glad the character counter thing is gone now, that thing lagged like a beast!)
    Software languages known:
    Qbasic - TI-Basic - Liberty Basic - Visual Basic 6
    Software API's known:
    Directx 7 and 8
    Internet languages, in the process of learning:
    HTML - JAVASCRIPT - PHP - CSS - MYSQL - AJAX

  21. #21
    Addicted Member
    Join Date
    Aug 2005
    Location
    York
    Posts
    197

    Re: Why use Assembly language

    Welcome aboard the asm train

    I recommend you to start with either MASM or FASM.
    They have slightly different syntaxes, but otherwise if you know one, its easyto pick up the other.

    Advantage of MASM:
    - Better tutorials
    - Can assemble asm listings from MS compilers more easily(but some can't be reassembled)
    - Supports debugging information

    Advantage of FASM:
    - Faster assembling than MASM
    - Supports linking within the assembler (so you don't generate obj -> then link them like a compiler, but gen exe files straight from asm)
    - Better code generation (Generates smallest instructions/optimised assembly codes)
    - Actively developed (updates 4/5 times a month!) / bug fixes come very quickly

    HLA:
    - Not tried it but it sounds good(slow though/bascially a syntax translator from HLA to other assembly languages.)

    Advantage of these over other assemblers:
    - Very good support (FASM forums are very friendly - so are the masm ones)
    - Good Macro Support

    I've posted links to tutorials elsewhere on this forum- and i don'thave time now to list out the links again...cheers anyway.
    Last edited by Raedwulf; Jun 6th, 2006 at 02:48 AM.

  22. #22
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Why use Assembly language

    I started writing ASM for intel chips last year and I've done almost none this year.
    But I've recently started playing with PIC chip programming in GPASM (Gnu PIC Assembler).

    Basically the only way to write good programs that run on PIC chips is to write them in ASM. There simply isn't enough ROM space to allow things like C libs to reside on the chips themselves so you end up writing everything the low level way.

    Its great though because these little chips are pretty fast (4MHz - 20 MHz depending on your oscillator) and you can do a hell of a lot with them with hardly any complex electronics knowledge.

    Intel ASM is a joy to use because it has a lot of registers and HUGE amounts of ram on modern machines. PIC asm is a joy because the instruction set is small and there is a great challenge in getting your code small and fast enough to run on a PIC.

    I recommend PIC programming to any hobbyist programmer.

    useful resources...
    www.microchip.com (downloads, datasheets)
    forum.microchip.com (decent forums for beginners and pro's alike)
    www.maplin.co.uk

    GPASM is for linux, for windows use MPLab (free download from microchip.com)
    I don't live here any more.

  23. #23
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Why use Assembly language

    Quote Originally Posted by wossname
    Intel ASM is a joy to use because it has a lot of registers and HUGE amounts of ram on modern machines. PIC asm is a joy because the instruction set is small and there is a great challenge in getting your code small and fast enough to run on a PIC.
    Hello World. Intel? Probably 32k, at the very least, until we get to Vista. PIC? Depending on the display, maybe 20-30 bytes. Slight difference.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  24. #24
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Why use Assembly language

    I never said PIC == intel.

    I was merely saying that they are both good. However most of the rest of your reply made no sense at all.
    I don't live here any more.

  25. #25
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Why use Assembly language

    I wasn't trying to contradict you - just pointing out that you can do an awful lot in a little PIC, while HLL programming in Windows is bloatware even for the smallest function. I did a little binary counter in a PIC, outputting to a 10-LED display, in about 25 bytes. Even writing a .com program for a PC takes at least that much just to start and end the program if you want to interact with the OS at all. (Unless you use something like FORTH )
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  26. #26
    New Member
    Join Date
    Aug 2011
    Posts
    3

    Re: Why use Assembly language

    Machine language = Binary (0,1)
    Assembly language = machine language but summarised
    C = Summarised Assembly language
    VB = compiled from C

    Got it? Its the lowest form of language. If you have problems in high level language and it cannot be solved you should try debugging with ASM. If again problem in ASM then try 0,1 :P

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width