It is sometimes referred to as assembly or ASL, assembly language is a low-level programming language used to interface with computer hardware. Assembly language uses structured commands as substitutions for numbers allowing humans to read the code easier than looking at binary. Although easier to read than binary, assembly language is a difficult language and is usually substituted for a higher language such as C. Below, is an example of assembly language in a debug routine. An assembly language is a low-level way to instruct a computer to carry out a task.
Computers do not inherently understand instructions from people. At the most basic level, computers understand instructions in binary language, that is, sequences of zeroes and ones. Binary language or machine language is extremely cumbersome to program in, however. Assembly language was invented as a symbolic representation of the underlying sequences of zeroes and ones. A program called an assembler converts assembly language code into the underlying machine language.
Assembly language is mostly a thin layer above the machine structure. An assembly language is a low-level programming language for a computer, microcontroller, or other programmable device, in which each statement corresponds to a single machine code instruction. Each assembly language is specific to a particular computer architecture, in contrast to most high-level programming languages, which are generally portable across multiple systems. Assembly language is converted into executable machine code by a utility program referred to as an assembler; the conversion process is referred to as assembly, or assembling the code.
An assembler directive is a message to the assembler that tells the assembler something it needs to know in order to carry out the assembly process; for example, an assemble directive tells the assembler where a program is to be located in memory.
Examples of common assembler directives are ORG (origin), EQU (equate), and DS.B (define space for a byte).
The EQU assembler directive simply equates a symbolic name to a numeric value. Consider:
Sunday EQU 1
Monday EQU 2
The assembler substitutes the equated value for the symbolic name; for example, if you write the instruction ADD.B #Sunday,D2, the assembler treats it as if it were ADD.B #1,D2.
You could also write
Sunday EQU 1
Monday EQU Sunday + 1
In this case, the assembler evaluates "Sunday + 1" as 1 + 1 and assigns the value 2 to the symbolic name "Monday".
Assigns a value to a symbol (same as EQU)
sets the current origin to a new value. This is used to set the program or register address during assembly. For example, ORG 0100h tells the assembler to assemble all subsequent code starting at address 0100h.
Defines an amount of free space. No code is generated. This is sometimes used for allocating variable space.
Sets the PIC’s identification bytes. PIC16C5x chips have two ID bytes, which can be set to a 2-byte value. Newer PICs have four 7-bit ID locations, which can be filled with a 4-character text string.
Loads another source file during assembly. This allows us to insert an additional source file into your code during assembly. IF
Assembles code if expression evaluates to TRUE.
Assembles code if expression evaluates to FALSE.
Assembles code if preceding evaluation is rejected.
Ends conditional evaluation.
sets the reset start address. This address is where program execution will start following a reset. A jump to the given address is inserted at the last location in memory.