Home » Assembler » The 8086 Chip

The 8086 Chip

Before beginning to write programs in assembler, you need to know a few things about the chip for which you are writing the program. This tutorial will assume that all programs are being run on the 8086 chip and as such, they will all run on any IBM compatible PC, as the 80386, 80486 and Pentium (I, II and III) chips all are designed to run 8086 code.

The 8086 chip uses registers for performing operations. It has The following registers

General Registers

  • AX
  • BX
  • CX
  • DX
    Segment Registers
  • CS
  • DS
  • ES
  • SS
    Pointer Registers
  • IP
  • SP
  • BP
    Data Transfer Registers
  • SI
  • DI
  • Set of flags

Points to start of the Code Segment
Points to start of the Data Segment
Extra Segment pointer
Points to start fo Stack Segment

Instruction Pointer
Stack Pointer
Base Pointer

Source Index
Destination Index

When writing long or complicated programs in assembler one would need to use all these, but when using A86 for the most part one can forget about all but the first four. These 4 general purpose registers can be used alone to perform most of the tasks one would want. A86 by default assembles programs into .com files instead of .exe. Com programs are small programs, less than 64 kilobytes in size, the size of one segment in memory so in .com programs the data, code and stack all fit into one segment. Hence there is no need for the four segment pointers CS, DS, ES and SS as they are automatically set by the assembler to point to the only used segment – so forget about them for a few years!

As for the last two sets of pointers, you can forget about them for a few years as well as they will not be required when doing only simple assembler. The exception being possibly the flags register, as we will be using the zero flag in some programs.

Now that we have limited ourselves to just four registers we can look at these more closely. The four registers have names ending with X and starting with the first four letters of the alphebet, so their names should not be hard to remember. Each of the register is 16 bits wide ( as the 8086 was a 16 bit processor ). However, as one will frequently be working with bytes, each of the registers can be accessed one half at a time. To access the top half of a register simply replace the X in the name by a H, for high, and to access the lower half replace the X by an L for low. So CH is the top eight bits of the CX register and AL is the lower eight bits of the AX register.

With that basic information known, we can now start writing programs.

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *
Email *

June 2024