Basics of Assembly Language : Part 2

Basic Micro Computer Design

  • A Clock Clock syncs internal operations of components with each other. Each operation involving system bus and CPU is synchronised by a constantly pulsing clock.
  • Control Unit Control Unit coordinates the steps involved in Executing instructions.
  • Arithmetic Logic Unit ALU performs all the arithmetic operations such as addition,subtraction,division and logical Operations using gates such as AND,NOT,OR.
  • Memory Unit MU is where all the memory and storage related functions take place such as moving data from to RAM or hard disk and vice-versa.
  • Buses:
  • Computer contains a bus which is used to transfer data from one point to another. There are four types of buses.
  • Data Bus
  • Control Bus Uses Binary Signals to synchronize all the actions between all devices attached to the system bus.
  • I/O Bus
  • Address Bus The Address Bus holds the address of instructions. (Remember using DCIA (da CIA))

Clock Cycles

Instruction Execution Cycle

  • First , the instruction itself is fetched from a memory area called instruction queue.
  • The instruction is then read by decoding its binary pattern . The decoded pattern might reveal that operands are involved meaning input values are needed , at which point they are fetched from the registers and memory.
  • After that, instruction is executed and some flag included Zero , carry and overflow get updated.
  • Finally the result of execution is stored.
  • Fetch An address from Address Bus is used.
  • Decode A code or algorithm required for execution is placed in code cache.
  • Execute Instruction pointer determines in which order will the instruction be executed.These instructions are decoded and then sent to Control unit which works with ALU and MU in coordination.

Reading From Memory

  • Place the address of data on address bus.
  • Change the value of processors RD or read pin.
  • Wait one clock cycles for memory chips to respond.
  • Copy the data from data bus to destination operand.

Loading and Executing a Program

32 bit x86 processors

Modes of operation

Basic Execution Environment


Basic Program Execution Registers

  • Eight General Purpose register
  • six Segment registers
  • A process status flag register
  • An instruction or EIP

General Purpose Registers

  • General purpose registers are used for arithmetic and data movement.
  • EAX is used for multiplication and division.It is called Extended accumulator register (EAX)
  • ECX is used as loop counter.
  • ESP addresses data on stack.
  • EBP is used by high-level languages to reference function parameters and local variables on the stack.

Segment Registers

  • In real address mode 16 bit segment registers store memory addresses of memory areas called segments.
  • In protected mode segment registers hold pointers to segment descriptive tables.
  • Some segments hold program instructions(code) while others hold variables.
  • Stack Segment holds local variables and function parameters.

Instruction Pointer

Flag Registers


Control Flags

  • causing a break to CPU after every execution
  • interrupt when arithmetic flow is detected.

Status Flags



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store

I am a Cyber Security Engineer(currently studying) and a technology enthusiast.Looking forward to engage with the Medium community and share knowledge!