Related to:
If you are writing co
There is one other time when writing in assembly may be necessary: if you need to do some low-level RAM test or similar, which requires absolute control over where data is being stored.
For example, software which confirms to SIL-2 (Safety Integrity Level) and above may require continual checks on RAM, in order to detect any possible data corruption. The area of RAM you're checking can't be changing while it's being checked, and so writing the test in assembler allows you to ensure that this is true, for example by storing any local variables in specific registers or in another area of RAM. This would be difficult, if not impossible, in C.
Startup code which zeroes the RAM and initialises non-zero static variables may also be written in assembler for the same written, though this sort of code is normally provided.