0% found this document useful (0 votes)
8 views

Msi Assignment 2 (Fa22-Bee-014)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Msi Assignment 2 (Fa22-Bee-014)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Microprocessor System and Interfacing

Assignment # 02
Title:Microprocessor Programming with Unique Problem
Set

Submitted to:
Sir. Akbar Ali Khan Afridi

Submitted by:
Name:Daniyal Shabbir
Reg no:FA22-BEE-014
Date:October25 ,2024
Q: Data Transfer: Move the immediate value 0x1E to Register A and the value
from memory pointed by Register SI to Register C (indexed addressing).
Arithmetic: Add Register A and Register C, then multiply the result by the value
from Memory Address 220H.

Code :
segment .data
mem220h dw 0x10 ; Replace with the actual value at memory address 220H

segment .code
_start:
; Data Transfer
mov al, 0x1E ; Move immediate value 0x1E to register A (AL)
mov cx, [si] ; Move value from memory addressed by SI into register C
(CX)

; Arithmetic
add al, cl ; Add AL and CL (A and C registers)
mov ax, [mem220h] ; Move value from memory address 220H into AX
mul ax ; Multiply AL by AX (result in AX)

Output:
Explanation:
Understanding Addressing Modes:
 Immediate Addressing Mode:
Instruction: mov al, 0x1E
In this instruction, the value 0x1E (which is a hexadecimal number) is directly provided in the
instruction and loaded into the AL register. This is known as immediate addressing because the
data is provided immediately in the instruction itself rather than from a memory location or
another register.
·Impact: The processor directly stores the value 0x1E into register A (AL), making it ready for
arithmetic operations.
b. Indexed Addressing Mode:
Instruction: mov cx, [si]
the program uses the indexed addressing mode. The value stored in the memory address
pointed to by the SI (Source Index) register is moved into the CX register. This means the actual
memory location is determined by the contents of the SI register, which acts as an offset into
memory.
Impact: The program can dynamically access data from memory by adjusting the value of SI.
This allows for flexibility in data retrieval without hardcoding specific memory addresses.

c. Direct Addressing Mode:


Instruction: mov ax, [mem220h]
In this instruction, direct addressing is used. The instruction directly specifies the memory
location 220H (hexadecimal) from which the value is loaded into the AX register.
Impact: The processor accesses a fixed memory location (220H) to retrieve the data. This is
useful when data is stored at known memory locations.

2. Logical Operations Explanation:


a. Addition (Arithmetic Operation):
Instruction: add al, cl
This instruction adds the values of register AL (which holds 0x1E after the move operation) and
register CL (the lower byte of register CX), and stores the result back in AL. Addition is a logical
operation that combines two values by summing them.
Impact: The result of the addition impacts the contents of the AL register, which will be used in
subsequent operations. It also affects flags like the Zero Flag and Carry Flag in the processor,
which can influence conditional branching in the program.

b. Multiplication (Arithmetic Operation):

Instruction: mul ax
The mul instruction performs an unsigned multiplication between the contents of AL and AX.
After the addition in the previous step, the result in AL is multiplied by the value loaded from
memory address 220H (stored in AX).

Impact: This logical operation multiplies two values, and the result is stored in the AX
register. The operation can affect the Overflow Flag and Carry Flag, which indicate
whether the result was too large to fit in the destination register.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy