There are five major advantages of assembly language, as compared to machine language:
There are also certain disadvantages:
In this appendix, we shall use 8085 microprocessor machine code and assembly language as a running example. A typical small program in assembly language: this program copies 100-bytes from location 400016 to 406416. The program starts at location 700016.
As indicated above, we shall use Intel 8085 microprocessor's assembly language as a running example.
Statements: The statements in this language are written one per line. The structure of a statement looks like:
<lable> : <Mnemonic> <blank/s> <operand1>
[ , <operand2>] [; <comments>]
Mnemonic may be a machine code or a pseudo-operation like data definition. Labels are upto 5 characters from set [A–Z@?0–9] with first character from [A–Z@?].
Pseudo-operations: There are several pseudo-operations available:
DB – define a byte or a sequence of bytes.
DS – define storage in terms of bytes.
DW – define 16-bit word data, order is Little-Endian.
EQU – equate a symbol to some value.
ORG – set origin of the following code.
Note that EQU requires a label (without colons), DB, DW and DS usually have label and ORG should not have a label.
Addresses: Addresses may be expressed in any of the following forms:
Decimal: Using digits [0–9], not more than 5 digits.
Hexadecimal: Using digits[0–9A–F], not more than 4 digits, followed by ‘H’ and starting with [0–9].
Octal: Using digits [0–7], followed by ‘O’ or ‘Q’.
Binary: Using digits [0–1], followed by ‘B’.
Symbolic: A data label defined somewhere in the program. Address arithmetic may be done – allowed operations are +, -, MOD, *. All address calculations using 16-bit numbers.
Offset from Location Counter (LC): LC is denoted by ‘$’ in the operand field. Offset can be positive or negative.
18.219.81.43