The rebirth of assembly language programming
- By Dan Romanchik
Randall Hyde has taught assembly language programming at the university level for more than a decade and his Web site, Webster: The Place on the Net to Learn Assembly Language Programming, is one of the most well-surfed sites on the topic. Hyde's book, "The Art of Assembly Language Programming," has been available online for 10 years, but now No Starch Press is publishing a printed version. I recently asked Hyde about how programmers use assembly language and why it seems to be gaining in popularity.
Q: Do you think programmers rely too much on high-level languages?
A: In the sense that they expect the high-level language to take care of all the low-level details for them, yes. Programmers should have a good understanding of what language translators are doing with their code in order to write great software.
I don't, however, feel that all programmers should give up high-level languages and do more work in low-level languages like assembly. Assembly language has its place, but a large reason for learning assembly language is to allow programmers to understand what compilers are doing with their code so they can write better, high-level language code.
Q: Why would a programmer choose to write a particular piece of code in assembly rather than a high-level language?
A: The traditional answer has been speed and space. Although speed isn't much of an issue any more, space can be. Assembly applications are still much smaller than comparable applications written in HLLs. Though machines have considerable memory and disk space today, space is still an important consideration. Indeed, bloated applications often run 10 to 1,000 times slower because of virtual memory problems. So while there may only be a factor of a two to 10 difference in speed on the basis of compiled vs. hand-written assembly code, when you factor in cache and virtual memory effects due to the size of an application, you see a much bigger difference in performance. This is one of the reasons Windows always seems to run at a constant speed, even as the processors' frequencies increase -- the OS is running at memory [and virtual memory] speeds rather than CPU speeds.
Of course, once you get off the PC platform and start working in embedded systems [microcontrollers and the like], space and speed become very important. This is where assembly language is still a primary choice for development today.
Q: Do you think the use of assembly language is becoming more popular?
A: Absolutely. Assembly language came close to dying in the early to middle 1990s. This was largely due to the fact that there was very little information about writing Windows applications in assembly and people weren't interested in running DOS applications. They wanted to create Windows applications.
It wasn't until around 1998 or 1999 that the tools and documentation really became available to write full applications in assembly that ran under Windows. Since there, there has been a tremendous increase in interest in assembly language programming on the PC.
New tools targeted at assembly language programmers, such as HLA, RadASM (an integrated development environment) and OllyDbg (a machine language debugger), are slowly providing the advanced development tools that high-level languages have long enjoyed under Windows but, until recently, weren't available for assembly programmers. Today, assembly language programming under Windows is about to hit "critical mass," meaning people will discuss it as a good programming alternative rather than simply discussing it as a historical footnote or as part of a "don't do this" warning.
Webster: The Place on the Net to Learn Assembly Language Programming, http://webster.cs.ucr.edu/
Win32ASM Community messageboard, http://board.win32asmcommunity.net
Masm Forum, www.masmforum.com
AoA Programming group on Yahoo!, http://groups.yahoo.com/groups/aoaprogramming
Hutch's home page, www.movsd.com
For other Programmers Report articles, please click here.
Dan Romanchik is an engineering manager turned writer and Web developer. His current passion is amateur radio. You can read his amateur radio blog at www.blurty.com/~kb6nu.