17-11-2012, 04:02 PM
8086 Assembler Tutorial for Beginners
8086 Assembler.pdf (Size: 369.76 KB / Downloads: 265)
This tutorial is intended for those who are not familiar with
assembler at all, or have a very distant idea about it. Of course if you
have knowledge of some other programming language (Basic, C/C++,
Pascal...) that may help you a lot.
But even if you are familiar with assembler, it is still a good idea to
look through this document in order to study emu8086 syntax.
It is assumed that you have some knowledge about number
representation (HEX/BIN), if not it is highly recommended to study
Numbering Systems Tutorial before you proceed.
What is an assembly language?
Assembly language is a low level programming language. You need
to get some knowledge about computer structure in order to understand
anything.
GENERAL PURPOSE REGISTERS
Despite the name of a register, it's the programmer who determines
the usage for each general purpose register. The main purpose of a
register is to keep a number (variable). The size of the above registers is
16 bit, it's something like: 0011000000111001b (in binary form), or
12345 in decimal (human) form.
4 general purpose registers (AX, BX, CX, DX) are made of two separate
8 bit registers, for example if AX= 0011000000111001b, then
AH=00110000b and AL=00111001b. Therefore, when you modify any
of the 8 bit registers 16 bit register is also updated, and vice-versa. The
same is for other 3 registers, "H" is for high and "L" is for low part.
Because registers are located inside the CPU, they are much faster
than memory. Accessing a memory location requires the use of a system
bus, so it takes much longer. Accessing data in a register usually takes no
time. Therefore, you should try to keep variables in the registers. Register
sets are very small and most registers have special purposes which limit
their use as variables, but they are still an excellent place to store
temporary data of calculations.
SPECIAL PURPOSE REGISTERS
· IP - the instruction pointer.
· Flags Register - determines the current state of the processor.
IP register always works together with CS segment register and it
points to currently executing instruction.
Flags Register is modified automatically by CPU after mathematical
operations, this allows to determine the type of the result, and to
determine conditions to transfer control to other parts of the program.
Generally you cannot access these registers directly.