Programming Languages; System-level Programming; Embedded Systems
Assembly language is the most fundamental programming language. It is used to directly manipulate data in working memory, allowing the programmer to account for each clock cycle and use the available computing resources most efficiently. Assembly language programming is very compact, making it ideal for use in embedded systems that are designed to carry out specific functions or are not generally accessible to the end user.
The principal register in CPU memory is the accumulator. It is the standard location for the accumulated value of a combination of instructions that are being carried out. Locations called “R registers” hold values being used in intermediate processes to generate the value that will go into the accumulator. The third vital register is the “program counter,” which holds the location of the next instruction to be executed in code memory. Other locations are termed “data pointers,” and contain the location in memory at which a series of stored data is located. Each line of an assembly language program consists typically of three parts: an operation instruction, followed by a memory location and data, and finally a documentation phrase. Though not absolutely required, it is perhaps the most essential for understanding what the purpose of the instruction. It is a statement that is not recognized as an instruction or data by the CPU. For example, the statement
is made readily understandable to a human by the documentation phrase, while the CPU understands only the MOV A,30h statement. Data can be addressed in an Assembly language program in various ways. The statement MOV A,#20h is an example of “immediate addressing,” in which the value to be stored in memory immediately follows the “op-code” in code memory. The above statement MOV A,30h is an example of “direct addressing.” The statement MOV A,@R0 is an example of “indirect addressing,” in which the value to be stored in memory is retrieved from the location in internal RAM specified, or “pointed to,” by the value stored in the first R-register (R0). Two commands are used for “external direct” addressing. The first, MOVX A,@DPTR reads a value in external RAM at the location identified by the value stored in the DPTR (data pointer) register and loads it into the accumulator. The second, MOVX @DPTR,A writes the value in the accumulator to the location in external RAM identified by the value stored in the DPTR register. The statement MOVX @R0,A is an example of external indirect addressing and functions in the same way using the value stored in the specified R-register. A final example is termed “code indirect” addressing, and is used to access data stored in the program code memory. Since code memory represents only a fairly small amount of actual memory, code indirect addressing is generally useful only for very small projects.
Because the coding of Assembly language programs is so compact and functions directly within the CPU of a device, it is the programming language of choice for all manner of embedded systems and other digital control devices that do not require the power or resources of a larger computer. The programs are typically installed directly into the device during manufacture and so are not accessible to the user afterwards. The vast majority of electronically-controlled devices such as household appliances, mp3 players, digital cameras, and any number of other devices, are controlled by the functioning of Assembly language programming.
—Richard M. Renneboog M.Sc.
Cavanagh, Joseph (2013) X86 Assembly Language and C Fundamentals Boca Raton, FL: CRC Press. Print.
Duntemann, Jeff (2011) Assembly Language Programming Step-by-Step: Programming with Linux 3rd ed., Hoboken, NJ: John Wiley & Sons. Print.
Gilder, Jules H. (1986) Apple Iic and Iie Assembly Language New York, NY: Chapman and Hall. Print.
Hyde, Randall (2010) The Art of Assembly Language 2nd ed., San Francisco, CA: No Starch Press. Print.
Margush, Timothy S. (2012) Some Assembly Required. Assembly Language Programming with the AVR Microcontroller Boca Raton, FL: CRC Press. Print.
Peterson, James L. (1978) Computer Organization and Assembly Language Programming New York, NY: Academic Press. Print.
Steiner, Craig (1990) The 8051/8052 Microcontroller: Architecture, Assembly Language and Hardware Interfacing Boca Raton, FL: Universal Publishers. Print.
Streib, James T. (2011) Guide to Assembly Language. A Concise Introduction New York, NY: Springer. Print.