Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

Create Describe the difference between immediate addressing and direct addressing.md

Abdul Wahab Junaidc1b5d1b01426
diff --git a/Assembly language/Basics of Assembly language/Describe the difference between immediate addressing and direct addressing.md b/Assembly language/Basics of Assembly language/Describe the difference between immediate addressing and direct addressing.md
new file mode 100644
index 0000000..e8c70fd
--- /dev/null
+++ b/Assembly language/Basics of Assembly language/Describe the difference between immediate addressing and direct addressing.md
@@ -0,0 +1,67 @@
+# Difference Between Immediate Addressing and Direct Addressing in Assembly Language
+
+## Immediate Addressing
+
+### Definition
+- **Immediate addressing** involves specifying a constant value directly within the instruction.
+
+### Usage
+- Used when the operand is a constant or an immediate value.
+- The actual value is part of the instruction itself.
+
+### Example
+```assembly
+MOV AX, 5 ; Move the immediate value 5 into register AX
+```
+
+### Characteristics
+- Operand value is fixed at assembly or compile time.
+- No memory access is required to fetch the operand.
+
+## Direct Addressing
+
+### Definition
+- **Direct addressing** involves specifying the memory address of the operand directly within the instruction.
+
+### Usage
+- Used when the operand is located in a specific memory address.
+- The operand is accessed directly from the specified memory location.
+
+### Example
+```assembly
+MOV AX, [1234] ; Move the value at memory address 1234 into register AX
+```
+
+### Characteristics
+- Operand value is stored in memory, and its address is specified in the instruction.
+- Requires a memory access to fetch the operand.
+
+## Key Differences
+
+1. **Operand Representation:**
+ - **Immediate Addressing:** Operand value is part of the instruction.
+ - **Direct Addressing:** Operand's memory address is part of the instruction.
+
+2. **Flexibility:**
+ - **Immediate Addressing:** Suited for constant values or literals.
+ - **Direct Addressing:** Suited for variables or values stored in memory.
+
+3. **Memory Access:**
+ - **Immediate Addressing:** No memory access is required to fetch the operand.
+ - **Direct Addressing:** Requires memory access to fetch the operand.
+
+4. **Usage Scenario:**
+ - **Immediate Addressing:** Useful for operations involving constants or literals.
+ - **Direct Addressing:** Useful when working with variables or values stored in memory.
+
+5. **Example:**
+ - **Immediate Addressing Example:**
+ ```assembly
+ MOV AX, 5 ; Move the immediate value 5 into register AX
+ ```
+ - **Direct Addressing Example:**
+ ```assembly
+ MOV AX, [1234] ; Move the value at memory address 1234 into register AX
+ ```
+
+Understanding these addressing modes is crucial for writing efficient assembly code and choosing the most appropriate method based on the nature of the operands and the requirements of the program.