Assembly Basic Components

Laiba Razi KhanLaiba Razi Khan
2 min read

In assembly language, the [org 0x0100] directive is used to specify the starting address or offset for the program code in a .com file. However, it does not necessarily mean that the offset must always be 0100.

Memory Model

To view memory in a processor there are many angles of it which has a general term of the memory model

Concept of Memory Linear Addressing[old]

Intel's old processors 8080 & 8085 use linear addressing memory means the whole memory is arranged in the form of a linear array and those processors were 8-bit processors.

Program Functional Parts

  1. stack

  2. data

  3. code

iAPX88 Processor and old processors similarity

The iAPX88 (Intel 8088) processor, like older processors, utilizes a segmented memory model. It divides memory into segments of 64 KB each for stack, data, and code storage. This allows for addressing a larger memory space while maintaining compatibility with older programming techniques. However, managing segment registers is crucial for effective memory access.

Intel Memory Model Used Today

Intel predominantly uses the Flat Memory Model in current processors, where memory is accessed as a single continuous address space without segmentation, allowing for efficient and straightforward memory management. This model simplifies programming and enables access to a large memory capacity.

Part of the Processor's Architecture:

  1. DS (Data Segment):

    Used for accessing data and variables in memory.

  2. AX, BX, CX, DX (General-Purpose Registers):

    Used for arithmetic, data manipulation, and memory addressing.

  3. SI, DI (Index Registers):

    Used for string operations and data copying.

  4. BP (Base Pointer):

    Used for accessing stack-based data, especially in function calls.

  5. SP (Stack Pointer):

    Holds the top of the stack, used for stack management.

  6. ES

    ES (Extra Segment) register is a register in the x86 architecture that holds the segment selector for an additional data segment used for memory access.

  7. CS & SS Register

CS (Code Segment) and SS (Stack Segment) are registers in the x86 architecture with different purposes. CS holds the segment selector for the code segment, used for fetching instructions. SS holds the segment selector for the stack segment, used for managing the stack and function calls. CS is for code access, while SS is for stack management.

  1. FLAGS:

    Contains status flags indicating conditions like zero, carry, overflow, etc.

  2. Instruction Pointer[IP]

    points to the next instruction to be executed,[ it takes code ], and it is said to be relative to the base.

0
Subscribe to my newsletter

Read articles from Laiba Razi Khan directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Laiba Razi Khan
Laiba Razi Khan

I've got accomplished web development with expertise in various programming languages including PHP, Laravel, C#, and C++. My curiosity to learn more and my passion for coding drives me to constantly enhance my skills and create exceptional digital experiences.