Coding in Assembly Language

Thread Starter

leolinyes

Joined Jul 19, 2023
10
Hi everyone,

I am very curious - do engineers still use assembly language in their design nowadays? If they do, where would they typically use it?

Thank you! I am very curious about this subject.
 

WBahn

Joined Mar 31, 2012
32,703
Hi everyone,

I am very curious - do engineers still use assembly language in their design nowadays? If they do, where would they typically use it?

Thank you! I am very curious about this subject.
Yes, it is still used. If you are working directly with the hardware (such as writing an operating system), then there are going to be device level operations that probably can't be described in a high-level language. So you would implement those portions in assembly. For those portions of a system that need performance over pretty much everything else, you will probably use assembly -- this would include highly sensitive applications, such as cryptographic hardware, in which you have to consider side channel attacks such as timing or power variations. For resource-starved platforms, such as ultracheap microcontrollers, you may code everything in assembly. If you are writing a compiler, guess what you are compiling the source code to?
 
Today’s embedded hardware is so overkilled there’s no need to use assembly in most of the time.
Only designers wanted save little money use a low cost MCUs so they have to bother.

In computer area like GPU you want to use every clock cycle so there is still place for low level.
 

Rf300

Joined Apr 18, 2025
72
When using modern CPUs like ARM-Cortex-M, it is mainly not necessary to use assembly language. The assembly language is quite complex and modern optimizing compilers produce good code. You should be a really highly skilled assembly programmer to produce better code than a compiler. Assembly is nowadays only used when some CPU-specific features are used e.g. for task switching.

In former times (1980s 1990s) when using CPUs like 8051 or 8086 it was a common rule to write interrupt routines in assembly language because they performed faster and the compiler technology was less advanced.
 

MaxHeadRoom

Joined Jul 18, 2013
30,559
In former times (1980s 1990s) when using CPUs like 8051 or 8086 it was a common rule to write interrupt routines in assembly language because they performed faster and the compiler technology was less advanced.
Back then it was quite common to write the whole program in assembly .
I still prefer it today when programming small PIC processors.
 

Ian0

Joined Aug 7, 2020
13,097
Whenever you want to use processor instructions that the compiler doesn’t use, such as CLZ, SSAT on Arm Cortex.
Also, assembler is better than C for bit manipulations routines.
 

Ian0

Joined Aug 7, 2020
13,097
You can drive a car without knowing how the engine, gearbox and suspension work, but I think it’s a pretty safe bet that any professional racing driver does know how the car works.
In other words, to get the best out of the product, the better you know how it works, the better you will be able to get it to perform.
 

panic mode

Joined Oct 10, 2011
4,864
And in some cases you do not have a choice. An example is platform that does not offer anything else or when code size limitations exist.

While most do not even think of memory, some products have tiny memory. Not too long ago i was modified code on an industrial servo that had built in controller. And everything was done in ASM (homing, sequences triggered by inputs, error codes...)
 

MrChips

Joined Oct 2, 2009
34,628
I created a dewpoint readout from values of temperature and relative humidity values using a small 8-bit MCU. To fit the code in the available space I programmed it in ASM.
 
Hi everyone,

I am very curious - do engineers still use assembly language in their design nowadays? If they do, where would they typically use it?

Thank you! I am very curious about this subject.
I dont think so.C is low level enough to deal with memory mappings.However if your device for some reason cant hold a C compiler(it is a bare microprocessor) then sure assembly is used
 

MrChips

Joined Oct 2, 2009
34,628
The compiler is not on the MCU.
The compiler generates ASM code which is assembled into machine code.

If you want to debug code in the MCU without access to the original code, then you need to know ASM.
 

Papabravo

Joined Feb 24, 2006
22,058
I dont think so.C is low level enough to deal with memory mappings.However if your device for some reason cant hold a C compiler(it is a bare microprocessor) then sure assembly is used
That is a real knee slapper. Nobody runs a C compiler on an embedded microcontroller. The compiler runs on a PC and we download the code to simulator or an emulator. When debugging is complete, we program the parts and assemble the boards.
 
I've never used assembly myself but I learnt about it when learning compilers. My understanding is assembly is a very low level programming language. It's meant to offer direct access to memory registers and allow full control where a compiler might prevent or limit an operation.

On the other hand, a compiler is quick and generally very efficient at generating machine code. While it's true an operation may run faster in assembly, it's up the programmer to write the entire algorithm and all the sub-routines that normally come ready with something like C or C++.

Unless you have experience writing mathematical algorithms, C++ will do everything you probably need and better than if you wrote the program in assembly. For most things, it seems like a really slow and error prone way to write software. I'd be interested to hear from people who had their careers in assembly like languages.
 

Futurist

Joined Apr 8, 2025
721
Last edited:

Ian0

Joined Aug 7, 2020
13,097
My experience of C compilers is that they are usually quite efficient but "drivers" that the processor manufacturer provides for the peripherals are generally dreadful. I've known I2C "drivers" that are more complex to use than writing a bit-banging routine to implement I2C directly.

I find compilers annoying when they insist on a number being of a certain type (uint16_t, int32_t, etc) and then forcing you to write extra code to "convert" them, whereas in assembler a number is of whatever type you want it to be whenever you want it (but you do have to remember).
For instance, my C compiler reads values from the 14-bit A/D as type uint16_t, but my signal is AC, biassed at half supply, so I subtract 0x2000 to make it a bipolar signal, and the output number is int16_t, and the compiler gives me all sorts of warnings.
My solution is to write an assembler routine which reads the A/D, subtracts 0x2000 and presents the answer as a int16_t.
 

RonV-AU

Joined Jan 19, 2026
19
I've never used assembly myself but I learnt about it when learning compilers. My understanding is assembly is a very low level programming language. It's meant to offer direct access to memory registers and allow full control where a compiler might prevent or limit an operation.

On the other hand, a compiler is quick and generally very efficient at generating machine code. While it's true an operation may run faster in assembly, it's up the programmer to write the entire algorithm and all the sub-routines that normally come ready with something like C or C++.

Unless you have experience writing mathematical algorithms, C++ will do everything you probably need and better than if you wrote the program in assembly. For most things, it seems like a really slow and error prone way to write software. I'd be interested to hear from people who had their careers in assembly like languages.
I learned HLASM in the mid ‘80s and started work as an application programmer on IBM mainframes.
I can only agree software took long to build and testing tools were limited at the time, so it was easy to have bugs in your code that wouldn’t come out in testing, sometimes not until much later in production. But even in assembler we had macros which helped in writing code.
Those were the days that a 4095 byte program was big.
From memory C compiler was available in the late 90s, I’ve used that a little but I’ve not written assembly code for mainframe production environments since 2005.

Ron
 
Top