Assembly language

Assembly language
Typical secondary output from an assembler—showing original assembly language (right) for the Motorola MC6800 and the assembled form
ParadigmImperative, unstructured, often metaprogramming (through macros), certain assemblers are structured or object-oriented
First appeared1947; 77 years ago (1947)
Typing disciplineNone
Filename extensions.asm, .s, .S, .inc, .wla, .SRC as well as several others depending on the assembler

In computer programming, assembly language (alternatively assembler language[1] or symbolic machine code),[2][3][4] often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence between the instructions in the language and the architecture's machine code instructions.[5] Assembly language usually has one statement per machine instruction (1:1), but constants, comments, assembler directives,[6] symbolic labels of, e.g., memory locations, registers, and macros[7][1] are generally also supported.

The first assembly code in which a language is used to represent machine code instructions is found in Kathleen and Andrew Donald Booth's 1947 work, Coding for A.R.C..[8] Assembly code is converted into executable machine code by a utility program referred to as an assembler. The term "assembler" is generally attributed to Wilkes, Wheeler and Gill in their 1951 book The Preparation of Programs for an Electronic Digital Computer,[9] who, however, used the term to mean "a program that assembles another program consisting of several sections into a single program".[10] The conversion process is referred to as assembly, as in assembling the source code. The computational step when an assembler is processing a program is called assembly time.

Because assembly depends on the machine code instructions, each assembly language[nb 1] is specific to a particular computer architecture.[11][12][13]

Sometimes there is more than one assembler for the same architecture, and sometimes an assembler is specific to an operating system or to particular operating systems. Most assembly languages do not provide specific syntax for operating system calls, and most assembly languages can be used universally with any operating system,[nb 2] as the language provides access to all the real capabilities of the processor, upon which all system call mechanisms ultimately rest. In contrast to assembly languages, most high-level programming languages are generally portable across multiple architectures but require interpreting or compiling, much more complicated tasks than assembling.

In the first decades of computing, it was commonplace for both systems programming and application programming to take place entirely in assembly language. While still irreplaceable for some purposes, the majority of programming is now conducted in higher-level interpreted and compiled languages. In "No Silver Bullet", Fred Brooks summarised the effects of the switch away from assembly language programming: "Surely the most powerful stroke for software productivity, reliability, and simplicity has been the progressive use of high-level languages for programming. Most observers credit that development with at least a factor of five in productivity, and with concomitant gains in reliability, simplicity, and comprehensibility."[14]

Today, it is typical to use small amounts of assembly language code within larger systems implemented in a higher-level language, for performance reasons or to interact directly with hardware in ways unsupported by the higher-level language. For instance, just under 2% of version 4.9 of the Linux kernel source code is written in assembly; more than 97% is written in C.[15]

  1. ^ a b Cite error: The named reference IBM_2014_ASM was invoked but never defined (see the help page).
  2. ^ Cite error: The named reference Ohio_2016 was invoked but never defined (see the help page).
  3. ^ Cite error: The named reference Archer_2016 was invoked but never defined (see the help page).
  4. ^ Streib, James T. (2020). "Guide to Assembly Language". Undergraduate Topics in Computer Science. Cham: Springer International Publishing. doi:10.1007/978-3-030-35639-2. ISBN 978-3-030-35638-5. ISSN 1863-7310. S2CID 195930813. Programming in assembly language has the same benefits as programming in machine language, except it is easier.
  5. ^ Cite error: The named reference Saxon_1962 was invoked but never defined (see the help page).
  6. ^ Cite error: The named reference Kornelis_2010 was invoked but never defined (see the help page).
  7. ^ Cite error: The named reference IBM_2014_Macro was invoked but never defined (see the help page).
  8. ^ Booth, Andrew D; Britten, Kathleen HV (1947). Coding for A.R.C. (PDF). Institute for Advanced Study, Princeton. Retrieved 2022-11-04.
  9. ^ Cite error: The named reference Wilkes_1951 was invoked but never defined (see the help page).
  10. ^ Cite error: The named reference Fairhead_2017 was invoked but never defined (see the help page).
  11. ^ Cite error: The named reference OS360_2011 was invoked but never defined (see the help page).
  12. ^ Austerlitz, Howard (2003). "Computer Programming Languages". Data Acquisition Techniques Using PCs. Elsevier. pp. 326–360. doi:10.1016/b978-012068377-2/50013-9. ISBN 9780120683772. Assembly language (or Assembler) is a compiled, low-level computer language. It is processor-dependent since it basically translates the Assembler's mnemonics directly into the commands a particular CPU understands, on a one-to-one basis. These Assembler mnemonics are the instruction set for that processor.
  13. ^ Carnes, Beau (2022-04-27). "Learn Assembly Language Programming with ARM". freeCodeCamp.org. Retrieved 2022-06-21. Assembly language is often specific to a particular computer architecture so there are multiple types of assembly languages. ARM is an increasingly popular assembly language.
  14. ^ Cite error: The named reference Brooks_1986_NSB was invoked but never defined (see the help page).
  15. ^ Anguiano, Ricardo. "linux kernel mainline 4.9 sloccount.txt". Gist. Retrieved 2022-05-04.


Cite error: There are <ref group=nb> tags on this page, but the references will not show without a {{reflist|group=nb}} template (see the help page).