Why Use Assembly Language in Modern Programming?

  • Thread starter Thread starter ChrisLeslie
  • Start date Start date
  • Tags Tags
    x86
Click For Summary
The discussion centers on the use of assembler programming among forum members, highlighting several key points. Many participants acknowledge that assembler is primarily utilized for performance-critical tasks, such as tight loops and graphics routines, with historical examples like the Quake graphic system illustrating its significance. The conversation touches on the advantages of high-level languages (HLLs) over assemblers, noting that skilled optimizing compilers can often produce more efficient code than hand-optimized assembler due to their deeper understanding of CPU architecture. The necessity of using assembler is emphasized for specific tasks requiring precise control over machine code, such as initializing hardware or managing power states. Additionally, the quality of assemblers varies, with Linux compilers generally regarded as effective, while Microsoft’s assembler also receives positive mentions. The discussion briefly contrasts 16-bit and 32-bit architectures, although specific opinions on this aspect are less pronounced. Overall, the use of assembler is framed as a specialized skill for particular applications rather than a common practice in modern programming.
ChrisLeslie
Just curious about how many forum members use assembler programming, and:
1. what sort of assembler they may use,
2. the pros and cons of various assemblers,
3. capability of assemblers vs HLL's,
4. their thoughts on 16 vs 32 bit,
5. and why they may use assemblers at all?

Chris
 
Technology news on Phys.org
Not something I know much about but I would imagine that it'd only be used for the tightest of loops, things like shader routines for video processors and stuff. An interesting use of assembler was the graphic system in Quake, they couldn't quite get it to run well on a 486 but nevertheless I think it was a great achievement.
 
A good optimizing compiler (and there are a lot of bad ones!) should be able to generate code that runs tighter than "simple-minded" hand-optimised assembler, because the compiler writers should know more details about exactly how the CPU works than most application programmers. For example, reordering instructions to get maximum overlap of fetch-execute, look-ahead branch resolution, optimum use of the cache, etc.

I suspect the main reason for using an assembler now would be if you need to generate some precise sequence of machine code instructions for some reason - for example at power on reset, or putting the CPU into "sleep mode" and waking it up again.
 
My brother-in-law used assembly for chip level programing, if you ahve to make a process work in micro-seconds you use assembly. Th Linux compilers are pretty good, last time i tried the microsoft version of assembly lanugauge wasn't too bad either.
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 102 ·
4
Replies
102
Views
2K
Replies
16
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 18 ·
Replies
18
Views
7K
Replies
60
Views
18K
Replies
15
Views
11K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
756