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. Binarylanguage or machine language is extremely cumbersome to program in, however. Assemblylanguage was invented as a symbolic representation of the underlying sequences of zeroes and ones.
Suppose we were to program a game which, upon a certain action, awards the player with five points. The computer keeps the score in a certain location; the locations are either a storage place within the CPU, called a "register," or in some space in the memory. The computer understands locations and low-level actions called operations. So if the score is kept at register RA, then it understands the command, 0101 1100 0000 0101, where the first four numbers indicate the operation ADD, the next four indicate the register RA, and the last eight indicate the number 5.
A program called an assembler converts assembly language code into the underlying machinelanguage. In earlier days, even this conversion used up expensive computing resources, so the operation codes, opcodes in short, such as Subtract were abbreviated as SUB, Copy-Move was abbreviated as MOV and in some cases even ADD was abbreviated to A.Let's go ahead and enter our program now. Type each of the instructions below into Debug exactly as they appear, and press enter after each one. When you finish entering the last instruction, press enter twice to tell Debug that we are done entering instructions.
mov ax,B800
mov ds,ax
mov byte[0F9E],24
int 20
The smallest "unit" of data on a binary computer is a single bit. Since a single bit is capable of representing only two different values (typically zero or one) you may get the impression that there are a very small number of items you can represent with a single bit. Not true! There are an infinite number of items you can represent with a single bit.
Nibbles
A nibble is a collection of four bits. It wouldn't be a particularly interesting data structure except for two items: BCD (binary coded decimal) numbers and hexadecimal numbers. It takes four bits to represent a single BCD or hexadecimal digit. With a nibble, we can represent up to 16 distinct values.
Bytes
A byte consists of eight bits and is the smallest addressable datum (data item) on the 80x86 microprocessor. Main memory and I/O addresses on the 80x86 are all byte addresses. This means that the smallest item that can be individually accessed by an 80x86 program is an eight-bit value
Words
A word is a group of 16 bits. We'll number the bits in a word starting from zero on up to fifteen. The bit numbering appears below:

Double Words
A double word is exactly what its name implies, a pair of words. Therefore, a double word quantity is 32 bits long as shown below:

CPU Registers
CPU registers are very special memory locations constructed from flip-flops. They are not part of main memory; the CPU implements them on-chip. Various members of the 80x86 family have different register sizes. The 886, 8286, 8486, and 8686 (x86 from now on) CPUs have exactly four registers, all 16 bits wide. All arithmetic and location operations occur in the CPU registers.
Because the x86 processor has so few registers, we'll give each register its own name and refer to it by that name rather than its address. The names for the x86 registers are
AX -The accumulator register
BX -The base address register
CX -The count register
DX -The data register
The Arithmetic & Logical UnitThe arithmetic and logical unit (ALU) is where most of the action takes place inside the CPU. For example, if you want to add the value five to the AX register, the CPU:
- Copies the value from AX into the ALU,
- Sends the value five to the ALU,
- Instructs the ALU to add these two values together,
- Moves the result back into the AX register.
The x86 CPUs provide 20 basic instruction classes. Seven of these instructions have two operands, eight of these instructions have a single operand, and five instructions have no operands at all. The instructions are
mov
(two forms), add, sub, cmp, and, or, not, je, jne, jb, jbe, ja, jae, jmp, brk, iret, halt, get,
and put
. The following paragraphs describe how each of these work.he control transfer instructions interrupt the sequential execution of instructions in memory and transfer control to some other point in memory either unconditionally, or after testing the result of the previous
cmp
instruction. These instructions include the following: ja dest -- Jump if above
jae dest -- Jump if above or equal
jb dest -- Jump if below
jbe dest -- Jump if below or equal
je dest -- Jump if equal
jne dest -- Jump if not equal
jmp dest -- Unconditional jump
iret -- Return from an interrupt