

Ask HN: Do people still program in machine code? - solipsist

"<i>Looking at a program written in machine language is vaguely comparable to looking at a DNA molecule atom by atom.</i>" - Douglas Hofstadter<p>I am curious if there still are a few, select number of people who write machine code for a living. Is there a need for machine code, or even assembly code, to be written when new pieces of hardware come out?<p>And also, does anyone here on HN have experience with machine or assembly code?
======
mcpherrinm
In the open source community, there's certainly a bunch. The FFMPEG h.264
decoder consists of big chunks of assembly. WebM will require more to be
written as it becomes production-quality in various decoders. JIT for
Javascript is causing the browser developers to be working on low-level code,
but of course that's very contained. LLVM is another project that gets a lot
of attention that involves assembly programming.

I just spent some time writing ARM assembly for some operating-system type
things. The rise of ARM is causing some work to has to happen here, as a lot
of legacy x86-only stuff will need to be replaced.

All the low-level stuff still has to happen, but there's very little happening
in the startup-type crowd that tends to be around HackerNews. The only startup
that I can think of offhand that would require that low-level type code is
inPulse, <http://getinpulse.com/> but I'm sure there's more around.

------
hoodoof
I believe assembly language programming is pretty common in embedded systems
programming and for some performance critical parts of games programming.

MenuetOS is entirely written in assembly language <http://www.menuetos.net/>

I haven't done any assembly language programming but I enjoy reading about it
because it's good to understand what a computer does down deep.

Jeff Duntemann's Assembly Language Step-by-step: Programming with DOS and
Linux [http://www.amazon.com/Assembly-Language-Step-step-
Programmin...](http://www.amazon.com/Assembly-Language-Step-step-
Programming/dp/0471375233) is a great book.

------
zwieback
Haven't done machine code since my Apple ][ days. Assembly, however is still
heavily used in embedded systems. Most commonly in boot code and interrupt
handlers. Handcrafting inner loops for DSP applications is also still common.

The percentage of assembly in my projects is typically very small, I'm sure
it's way less than 1% in my case.

Another area where assembly is still common is around specialized HW features,
e.g. putting the processor into low power modes or other situations where
specific instructions have to be issued in a specific order.

For speed optimisation more often than not I start out with the output of the
C compiler to see where I can optimize.

------
fbnt
Instruction List (IL) on PLC & other microcontrollers is widely used in
automatic controls, My engneering course had some odd classes of PLC assembly-
like programming (and some 8086 and useless PXA assembly, a 1st gen. PocketPC
processor, aswell)

Anyway, writing machine code from scratch might still be readable, looking at
compiler-generated code could be really complicated, as lots of redundant
information is added.

I remember dealing with x86 assembly only when.. ermm.., 'bypassing' some
software restrictons. It's amazing how much money a single JMP instruction,
surgically replaced in an executable file, can save you :)

------
drallison
Yes, of course. There are problems or portions of problems where direct hands-
on control of the bare metal gives better performance, sometimes spectacularly
better performance. Programming in assembly language for this kind of problem
is often simpler than trying to make a compiler do what's needed. As the size
and complexity of the problem grows, the structuring and abstraction support
of programming languages provide win out.

And, of course, the last refuge of the assembly language programmer is the
optimization and code generation phases of a compiler where reasoning about
programs at a very low level pays off.

------
cerebrum
LuaJIT is done in assembly and the author explains why:

<http://article.gmane.org/gmane.comp.lang.lua.general/75426>

Source(reddit):
[http://www.reddit.com/r/programming/comments/hkzg8/author_of...](http://www.reddit.com/r/programming/comments/hkzg8/author_of_luajit_explains_why_compilers_cant_beat/)

------
diminium
Let me see. The last biggest commonly used software project I remember
(desktop software, not embedded and industrial stuff) that was programmed in
assembly was this game

<http://en.wikipedia.org/wiki/RollerCoaster_Tycoon>

Now, that's one level above machine code but you get the idea.

------
walrus
Some smaller microcontrollers don't have any RAM, so C doesn't work too well
with them.

For example: [http://www.nongnu.org/avr-libc/user-
manual/FAQ.html#faq_tiny...](http://www.nongnu.org/avr-libc/user-
manual/FAQ.html#faq_tinyavr_c)

------
veyron
Assembly code is used frequently in ultra low latency trading and in other
contexts for which special instructions are not exposed in C libraries or
constructs. For example, there is no libc exposure to the RDTSC x86
instruction

------
winkv
yes,especially in area of digital signal processing,people still write the
code in assembly and get paid for it.though there aren't many.its a low demand
low supply area.

