1,885
edits
Changes
→Relationship to Assembly Language
Machine language is very hard to write and read, although it can be hand-coded on simple processors (it was not uncommon for 6502 programmers to memorize the complete instruction set, for example). It is particularly difficult to write and read when the ISA uses bit-packing.
[[Assembly languageLanguage]] (or just "Assembly") is closely related to machine language, but uses a [[Symbolic|symbolic]] representation of instructions and memory locations and is therefore easier to write and read. A compiler for assembly language is called an [[Assembler|assembler]], and a tool to convert machine code to assembly is called a [[Disassembler|disassembler]].
Assembly is [[Portable|architecture-specific]] but allows precise control over the exact instructions which will be executed by the CPU. It is therefore used for the most basic functions of the bootloader and operating system kernel, the lowest-level operating system devices drivers, and code where performance is critical. However, assemblers do not usually perform [[Optimizations|optimizations]], so C code which has been optimized by a good compiler will often perform as well as or better than assembly code unless it is very painstakingly written.