Assembly Language — X86

Topgyal Gurung
6 min readMay 13, 2021

Assembly is among one of the oldest tools in a computer-programmer’s toolbox. It is also one of the closest forms of communication that humans can engage with a computer. With assembly, the programmer can precisely track the flow of data and execution in a program. Assembly code are translated by an assembler into machine language which gets loaded into memory and executed.

Photo by Science in HD on Unsplash

“CPU” refers to a processor, central processor or microprocessor, which is a Central Processing Unit of the computer. The CPU was first developed at Intel with the help of Ted Hoff and others in the early 1970s. CPU fetches, decodes and executes program instructions. The first processor released by Intel was the 4004-processor which had 2300 transistors, performed 60 thousand operations per second(OPS), addressed 640 bytes of memory and cost $200 that time (Computer Hope).

Intel introduces its first 16 bit microprocessor in April 1978. “Production was started in May and eventually the 8086 was official released on June 8” (Digital History). Intel’s first 16-bit microprocessor with the 8087 as its floating-point coprocessor and with a 20-bit address bus; which enables to address up to 1 Megabytes. “x86” can refer both to an instruction set architecture and to microprocessor which implements it. 8086 architecture became Intel’s most successful line of processor. Therefore, it’s important to understand the properties of the 8086-intel processor.

Actual Architecture: “x86” can refer both to an instruction set architecture and to microprocessor which implement it. 8086 most prominent features include its instruction queue capable of storing six instruction bytes from the memory resulting in faster processing. “x86” microprocessor requires single phase clock with 33% duty cycle to provide internal timing. It was the first 16- bit processor having 16 bit ALU, 16-bit registers, internal data bus, and 16-bit external bus resulting in faster processing. It has 356 vectored interrupts and consists of 29,000 transistors. 8086 microprocessor supports 8 types of instructions which are data transfer, arithmetic, bit manipulation, string, program transfer (branch and loop), processor control, iteration control and interrupt instructions.

Photo by Aler Kiv on Unsplash

8086 does 2- stage pipelining i.e. overlapping fetching and execution. It architecture is divided into two units. They are BIU (Bus Interface Unit) and EU (Execution Unit). The BIU takes care of all transactions of data and addresses on the buses for EU. It functions include generating 20-bit physical address for memory access, fetching instruction from memory, transferring data to and from memory and I/O and supporting pipelining using 6 byte instruction queue. BIU contains Segment registers, Instruction pointer, Address Generation Circuit and 6 Byte Pre-fetch Queue. EU contains General purpose registers, Special purpose registers, ALU (Arithmetic Logic Unit), Operand register, Instruction Register and instruction Decoder and Flag register. EU gives instructions to BIU starting from where to fetch the data and then decode and execute those instructions. It performs arithmetic, logic and internal data transfer operations within the microprocessor. It sends request signals to the BIU to access the external module. It also operates with the respect to T-stats and does not depend upon which machine cycle is being performed by the BIU.

It supports two modes of operation, i.e. Maximum mode and Minimum mode. Maximum mode is suitable for system having multiple processors. In Maximum mode, external mode controller is responsible for generating all control signals for Memory and I/O. It is primarily used for complex and large applications. Minimum mode is suitable for system having a single processor. In Minimum mode, 8086 is responsible for generating all control signals for memory and I/O. It is primarily used in simple applications.

Purpose of each register: The processor provides the programmer with 16 internal registers each with 16 bits wide. They are categorized into several categories. There are four general purpose registers, AX, BX, CX and DX, four special-purpose registers, SP, BP, SI and DI, six segment registers, CS, DS, SS, ES, FS and GS, an instruction pointer (IP) or program counter and a status flag register, EFLAGS (Howard, Brian). Each general register is a combination of two 8 bit registers which are accessible as AL, BL, CL, DL (the “low” bytes) and AH, BH, CH and DH (the “high” bytes). All registers can be also accessed in 32 bit modes with an ‘E’(extended). For example, ‘EAX’ is the accumulator register as a 32-bit value. Likewise, in the 64-bit version, the ‘E’ is replaced with an ‘R’, so the 64-bit version of ‘EAX’ is called ‘RAX’. The least significant byte (LSB, or low half, is identified by replacing the ‘X’ with an ‘L’. The most significant byte (MSB), or high half, uses an ‘H’ instead. For example, CL is the LSB of the counter register, whereas CH is its MSB. In total, this gives programmers five ways to access the accumulator, counter, data and base registers: 64-bit, 32-bit, 16-bit, 8-bit LSB and 8-bit MSB.

Photo by Nathan Dumlao on Unsplash

All the registers have its own purpose and functions. The order in which they are listed has a reason as it is used in a push-to-stack operation. General purpose registers’ Accumulator register (AX) is used in arithmetic operations, Counter Register (CX) is used in shift or rotate instructions and loops, Data Register (DX) is used in arithmetic operations and I/O operations and Base Register (BX) is used as a pointe to data. Special- purpose registers’ Stack segment (SS) is a pointer to the top of the stack, Code segment (CS) is a pointer to the code, Data Segment (DS) is a pointer to the data, Extra segment (ES) is a pointer to extra data, F segment (FS) is a pointer to more extra data and G segment is a pointer still more extra data. The Instruction Pointer, IP, gives the address of the next instruction to be executed, relative to the code segment. The status register, EFLAGS, is a 32-bit register used as collection of bits representing Boolean values to shows that present state of processor and the results of recent operations. Nine of the sixteen bits used in the 8086 are carry (bit 0), parity (bit 2), adjust (bit 4), zero (bit 6), sign (bit 7), trap (bit 8), interrupt (bit 9), direction (bit 10) and overflow (bit 11).

Conclusion: The above brief description on 8086 architecture discusses the history of intel’s development of processor an history of CPU. Moreover, it presents the purpose of registers of 8086 microprocessor. Still there are some disadvantages and things that needs to be fixed with the present in use processor technology. Nowadays, processors are made from silicon which is abundant materials found on earth. The processor technology has moved from 90nm fabrication in 2000s to 14nm now. Moreover, it is predicted to shrink upto 5nm by 2021(Marshall, Gary). Therefore, chipmakers like Intel. AMD and others are looking for alternatives to save the cost and for more efficient technology. One of the option they are researching on are by rethinking the CPU itself, creating carbon nanotubes etc. In such a short time, computers have changed the lifestyles of people on earth. Therefore, better chip technology and advancement in computer can bring enormous amount of change and advancement to the present human civilization.

Annotated Bibliography

Computer processor history, Computer Hope 2017. Web. May 17, 2017.

Digital History- Intel Introduces the 8086 Microprocessor, Old-computers.com (on- line museum since 1995). Web. May 20 2017

Howard, Brian, Assembly Language Tutorial, April 1998. Web. May 20, 2017

Marshall, Gary. Beyond Silicon: We discover the processors of your future tech. Techradar.com

August 26, 2016. Web. May 21, 2017.

--

--